-
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
ICE after error in associated item resolution #28971
Comments
I tried to fix it like so, but it didn't work. It seems like both the error and the ICE originate from item body checking. Not sure where to make it abort. |
Another testcase from #29191 enum Binding {}
fn main() {
|binding: Binding| {
if let Binding::None = binding {};
};
} |
Full backtrace:
|
@eddyb any reason why this doesn't get sorted out during resolution itself? |
Oh, right, we can't handle that in all cases if Bar was actually an associated type. |
So I figured this out. Either we need to abort_if_errors when creating the closure EUV in typeck/check/upvar.rs, in analyze_closure(), OR we need to abort in check_path_enum in _match.rs. abort_if_errors means that it may not finish checking the whole crate, so the errors will get cut off. Is there a smarter way to handle this? Perhaps by propagating a TyError or something? |
@Manishearth only associated constants would make sense in patterns, you can't access enum variants as associated items of the enum type. If late (typeck) associated constant resolution doesn't happen in patterns, resolve should error early. Otherwise, typeck should always trigger that late resolution whenever a path pattern's full resolution is required. |
So I should find the place in _match.rs where variant pats get checked and error if they don't resolve? sgtm. |
@Manishearth I'm surprised there's no error triggered already. |
It does trigger an error, it just doesn't abort. |
@Manishearth oh, I see, that's unfortunate. In that case, later code should treat it as a type error ( |
I think in this case we should abort when the resolution fails. TyError doesn't fix the other issue; since ExprUseVisitor will still hit a resolution ICE at that point. |
@eddyb updated the pull req with something that seems to work. |
on
rustc 1.5.0-nightly (9d3e79ad3 2015-10-10)
gives an ICE:I'm working on a fix.
The text was updated successfully, but these errors were encountered: