Closed
Description
openedon Oct 21, 2020
pub fn f<T>(a: &T) -> *const T {
&1 as *const i32
}
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The type systemCategory: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.