-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Struct with an error magically becomes a function, causing misleading diagnostics (arc
is a function, perhaps you wish to call it)
#82323
Comments
I briefly looked into this issue. I guess there could be many ways of fixing this, but something strange I discovered as I debug this is this function returns There could be other ways of fixing this as well, however the function that generates this suggestion, |
If it autoderefs to something that I think the mistake here is using |
Hm, you're right. For example, this works: use std::sync::Arc;
fn f() {
println!("f called");
}
fn main() {
let f = Arc::new(f);
f();
} I agree that it shouldn't return true when in case of an ambiguity/unknown type. |
Confirmed that using Of course this doesn't fix the nonsensical error message, just removes the invalid suggestion. |
I encountered another variant of what seems to be this bad diagnostic recently, this time caused by a missing type parameter in an struct Struct<T>(T);
impl Struct<T>
where
T: Copy,
{
fn method(v: Vec<u8>) { v.len(); }
} Produces (as well as a helpful diagnostic) this diagnostic:
Playground here. I'm not sure whether it's worth filing a new issue for this, but if it is appropriate please do. |
…es-a-function, r=petrochenkov Do not suggest "is a function" for free variables Part of rust-lang#82323
…es-a-function, r=petrochenkov Do not suggest "is a function" for free variables Part of rust-lang#82323
…r, r=estebank Suppress errors due to TypeError not coercing with inference variables Fixes rust-lang#75331 Fixes rust-lang#68507 Fixes rust-lang#82323 cc `@estebank`
It correctly diagnoses that
oops
is undeclared. It should stop after this error, and not display any further errors related to the incompletearc
object.But it continues and displays a second error, which doesn't make any sense and has a nonsense suggestion:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: