-
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
Do not ICE on trait aliases with missing obligations #66392
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_typeck/astconv.rs
Outdated
self.tcx().sess.delay_span_bug(DUMMY_SP, &format!( | ||
"trait_ref_to_existential called on {:?} with non-dummy Self", | ||
trait_ref, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the correct fix - the caller shouldn't pass in a bad TraitRef
in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eddyb Isn't this a reasonable as a way to paper over the issue while the underlying cause is being researched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I thought this code was in librustc
.
Looking closer at the code, I don't think trait_ref_to_existential
should exist as a method.
It should be a closure defined just before its two callsites, and it could refer to the dummy_self
variable in scope directly.
Also, this definitely needs a FIXME. The overall bug appears to be a missing filter on top of expand_trait_aliases
, which picks up non-supertraits
where clauses - but also, the object safety completely ignores trait aliases, which could be object safety hazards.
So trait aliases aren't fully implemented yet, I'm guessing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @alexreg
If you want to paper over something, please file a new issue for that FIXME and label it with F-trait_alias
so we won't miss it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #66420 and added FIXME
to the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems like a reasonable temporary fix, but ideally we want something proper in the medium term.
The feature requires nightly so I don't know why it was beta/stable-nominated. |
@Centril the feature requires nightly, but you can trigger the ice even if the feature is disabled. |
Ah! I see; my bad :) |
The fix seems reasonable as a temporary crutch. I'm not sure we need to backport it, but it's also not harmful to do so. |
3f25273
to
b3aa427
Compare
This comment has been minimized.
This comment has been minimized.
review comment
b3aa427
to
0ff7353
Compare
@bors r+ |
📌 Commit 0ff7353 has been approved by |
@bors retry |
Do not ICE on trait aliases with missing obligations Fix #65673.
☀️ Test successful - checks-azure |
beta-accepted (last week, sorry for delay!) |
[beta] backports This pull request backports the following pull requests, which have all been beta-accepted by the compiler team. * Handle non_exhaustive in borrow checking #66722 * Do not ICE on trait aliases with missing obligations #66392 * Do not ICE in `if` without `else` in `async fn` #66391 * Fix ICE when trying to suggest `Type<>` instead of `Type()` #66390 * Do not ICE on recovery from unmet associated type bound obligation #66388 * find_deprecation: deprecation attr may be ill-formed meta. #66381 * parser: don't use `unreachable!()` in `fn unexpected`. #66361 * Undo an assert causing an ICE until we fix the underlying problem #66250 * Do not ICE with a precision flag in formatting str and no format arguments #66093 * Fix two OOM issues related to `ConstProp` #66394
[beta] backports This pull request backports the following pull requests, which have all been beta-accepted by the compiler team. * Handle non_exhaustive in borrow checking #66722 * Do not ICE on trait aliases with missing obligations #66392 * Do not ICE in `if` without `else` in `async fn` #66391 * Fix ICE when trying to suggest `Type<>` instead of `Type()` #66390 * Do not ICE on recovery from unmet associated type bound obligation #66388 * find_deprecation: deprecation attr may be ill-formed meta. #66381 * parser: don't use `unreachable!()` in `fn unexpected`. #66361 * Undo an assert causing an ICE until we fix the underlying problem #66250 * Do not ICE with a precision flag in formatting str and no format arguments #66093 * Fix two OOM issues related to `ConstProp` #66394
Fix #65673.