2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:57:22
|
2020-09-04 08:45:09 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", &foo);
|
|
|
|
| ^^^^
|
2020-09-04 08:45:09 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
note: the lint level is defined here
|
|
|
|
--> $DIR/function-references.rs:3:9
|
|
|
|
|
|
|
|
|
LL | #![warn(function_item_references)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
2020-09-04 08:45:09 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:59:20
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | print!("{:p}", &foo);
|
|
|
|
| ^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:61:21
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | format!("{:p}", &foo);
|
|
|
|
| ^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:64:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", &foo as *const _);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:66:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", zst_ref);
|
|
|
|
| ^^^^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:68:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", cast_zst_ptr);
|
|
|
|
| ^^^^^^^^^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:70:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", coerced_zst_ptr);
|
|
|
|
| ^^^^^^^^^^^^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:73:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", &fn_item);
|
|
|
|
| ^^^^^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:75:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 08:51:10 -05:00
|
|
|
LL | println!("{:p}", indirect_ref);
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `nop` with `as fn()` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:78:22
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &nop);
|
2020-09-10 21:53:14 -05:00
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:80:22
|
2020-09-04 08:45:09 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &bar);
|
2020-09-10 21:53:14 -05:00
|
|
|
| ^^^^
|
2020-09-04 08:45:09 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `baz` with `as fn(_, _) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:82:22
|
2020-09-04 08:45:09 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &baz);
|
2020-09-10 21:53:14 -05:00
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `unsafe_fn` with `as unsafe fn()` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:84:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &unsafe_fn);
|
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `c_fn` with `as extern "C" fn()` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:86:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &c_fn);
|
|
|
|
| ^^^^^
|
2020-09-04 08:45:09 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `unsafe_c_fn` with `as unsafe extern "C" fn()` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:88:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &unsafe_c_fn);
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `variadic` with `as unsafe extern "C" fn(_, ...)` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:90:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
LL | println!("{:p}", &variadic);
|
|
|
|
| ^^^^^^^^^
|
2020-09-10 21:53:14 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `var` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:92:22
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p}", &std::env::var::<String>);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `nop` with `as fn()` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:95:32
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
|
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:95:38
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
|
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:95:44
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
|
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:110:41
|
2020-09-10 21:53:14 -05:00
|
|
|
|
|
|
|
|
LL | std::mem::transmute::<_, usize>(&foo);
|
|
|
|
| ^^^^
|
2020-09-04 08:45:09 -05:00
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:112:50
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar));
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:112:50
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar));
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:122:15
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | print_ptr(&bar);
|
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:124:24
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | bound_by_ptr_trait(&bar);
|
|
|
|
| ^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:126:30
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | bound_by_ptr_trait_tuple((&foo, &bar));
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
2020-10-06 10:59:14 -05:00
|
|
|
warning: cast `foo` with `as fn() -> _` to obtain a function pointer
|
|
|
|
--> $DIR/function-references.rs:126:30
|
2020-10-06 08:51:10 -05:00
|
|
|
|
|
|
|
|
LL | bound_by_ptr_trait_tuple((&foo, &bar));
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
warning: 27 warnings emitted
|
|
|
|
|