pub fn f<T>(a: &T) -> *const T {
&1 as *const i32
}
(Playground)
The error includes a label that says "this type parameter", but it doesn't complete the sentence:
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
1 | pub fn f<T>(a: &T) -> *const T {
| - -------- expected `*const T` because of return type
| |
| this type parameter
2 | &1 as *const i32
| ^^^^^^^^^^^^^^^^ expected type parameter `T`, found `i32`
|
= note: expected raw pointer `*const T`
found raw pointer `*const i32`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground`
To learn more, run the command again with --verbose.
(Playground)
The error includes a label that says "this type parameter", but it doesn't complete the sentence: