Closed
Description
I wrote something like the following code:
// fn function_that_doesnt_exist() -> String {
// String::new()
// }
fn test(s: &str) {
println!("{}", s);
}
fn test2(s: String) {
println!("{}", s);
}
fn main() {
let s = function_that_doesnt_exist();
test(&s);
test2(s);
}
Notice that the actual error is the missing function_that_doesnt_exist
, but the compiler confusingly reports errors about str
not having a size known at compile time, presumably because it infers the type of s
as str
. When I was writing this code, I missed the message about the missing function, so I was left scratching my head for a bit. It might be nice to silence such errors when the type of the variable is unknowable.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that needs small tweaks.Diagnostics: Too much output caused by a single piece of incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.