You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustc confuses missing types with missing type parameters #139999
error[E0412]: cannot find type`ForgotToImport`in this scope
--> src/lib.rs:1:29
|
1 | pub fn do_stuff() -> Option<ForgotToImport> {
| ^^^^^^^^^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
1 | pub fn do_stuff<ForgotToImport>() -> Option<ForgotToImport> {
| ++++++++++++++++
Desired output
error[E0412]: cannot find type`ForgotToImport`in this scope
--> src/lib.rs:1:29
|
1 | pub fn do_stuff() -> Option<ForgotToImport> {
| ^^^^^^^^^^^^^^ not found in this scope
Rationale and extra context
Type parameters are rarely this long, so rustc's guess seems like a poor fit. Could rustc treat longer names as unlikely to be type parameters?
Another option would be to skip this suggestion if the type name is CamelCase.
changed the title [-]rustc confuses missing types with type parameters[/-][+]rustc confuses missing types with missing type parameters[/+]on Apr 18, 2025
Activity
[-]rustc confuses missing types with type parameters[/-][+]rustc confuses missing types with missing type parameters[/+]Kivooeo commentedon Apr 19, 2025
Hi, would love to take this one, almost finished writing implementation, and will add tests and so on tomorrow and publish it in PR
fix for rust-lang#139999
fix for rust-lang#139999
fix for rust-lang#139999
fix for rust-lang#139999