I thought he would be forced to *const _, and then ptr-addr-cast is applied ....
Firstly, implicit coercion does not occur everywhere and, of course, not inside a part of an expression of the type e as T, as you have noticed. The places where coercion occurs are called coercion sites , usually you do an expression assessment, for example.
RHS let/const/static:
let x = foo
:
foo(bar)
:
fn f() -> u32 {
foo
// ^~~
}
struct/array/tuple:
[foo, bar, baz]
(foo, bar, baz)
Foo { field: foo }
:
{ ...; foo }
foo as isize .
-, , , Rust , . &mut Test &Test *mut Test *const Test &mut SomeTrait .., ! , , :
#![feature(type_ascription)]
let b = {&a}: *const _ as isize;
, &a as *const _ as isize.