-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Resolve failures cause too many typechecking failures #31997
Comments
The type error is correct in your "minified" example - |
Guh right, sorry! |
I think this is a roughly minimized example: trait TheTrait { }
fn closure<F, T>(x: F) -> Result<T, ()>
where F: FnMut() -> T, T: TheTrait,
{
unimplemented!()
}
fn foo() {
try!(closure(|| bar(0 as *mut _))) // bar intentionally undefined
}
fn main() { } For me it gets:
|
Note in particular that this includes:
which is pretty wacky, since |
(Making some progress on this.) |
Another small example yields the errors:
The first error:
is the only real error, everything else is just spurious after that |
My PR in #32258 doesn't really help those cases; I think I could get rid of those "type of this value must be known" errors easily enough, at least. |
@alexcrichton pushed a commit that changes the output for that test too:
|
Thanks @nikomatsakis! I think that's basically where we were at in ancient times, I've seen that double error for things like |
@alexcrichton Fixed, see #32789. |
Awesome, thanks @jseyfried! |
Suppress fallback and ambiguity errors If the infcx has observed other errors, then suppress both default type parameter fallback (which can be unreliable, as the full constraint set is not available) and errors related to unresovled variables (annoyingly, integer type variables cannot currently be unified with error, so that has to be a separate mechanism). Also add a flag to `infcx` to allow us to independently indicate when we have observed an error and hence should trigger this suppression mode. Fixes #31997 cc @alexcrichton r? @arielb1
Suppress fallback and ambiguity errors If the infcx has observed other errors, then suppress both default type parameter fallback (which can be unreliable, as the full constraint set is not available) and errors related to unresovled variables (annoyingly, integer type variables cannot currently be unified with error, so that has to be a separate mechanism). Also add a flag to `infcx` to allow us to independently indicate when we have observed an error and hence should trigger this suppression mode. Fixes rust-lang#31997 cc @alexcrichton r? @arielb1
Suppress fallback and ambiguity errors If the infcx has observed other errors, then suppress both default type parameter fallback (which can be unreliable, as the full constraint set is not available) and errors related to unresovled variables (annoyingly, integer type variables cannot currently be unified with error, so that has to be a separate mechanism). Also add a flag to `infcx` to allow us to independently indicate when we have observed an error and hence should trigger this suppression mode. Fixes #31997 cc @alexcrichton r? @arielb1
I noticed that on #31618 there was a resolve failure from this line, specifically:
The only real error here is that
libc::select
doesn't exist. All other errors are spawned off of this. This unfortunately makes it pretty hard to hunt through errors and figure out which ones need to get fixed, and at this point I'm just training myself to only look at the first error as all others are likely not too useful.I attempted to minimize this as well:
But this yielded a different error message:
Note that on stable this yields a message which is actionable and concise:
The text was updated successfully, but these errors were encountered: