-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
trait solver: Resolve region vars in max universe #157921
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| //@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally | ||
|
|
||
| // Regression test for an ICE in the `MaxUniverse` region visitor. When computing | ||
| // the max universe of a region constraint, a `ReVar` term could already have been | ||
| // unified with another region. `universe_of_lt` returns `None` for such a resolved | ||
| // variable, so the visitor used to `unwrap()` `None` and panic. It now resolves the | ||
| // variable before inspecting its universe. | ||
|
|
||
| #![feature(min_generic_const_args, inherent_associated_types, generic_const_items)] | ||
|
|
||
| struct Parent<'a> { | ||
| a: &'a str, | ||
| } | ||
|
|
||
| impl<'a> Parent<'a> { | ||
| type const CT<T: 'a>: usize = 0; | ||
| } | ||
|
|
||
| fn check/*<T>*/() | ||
| where | ||
| [(); Parent::CT::<T>]:, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does adding the generic parameter |
||
| //~^ ERROR cannot find type `T` in this scope | ||
| { | ||
| } | ||
|
|
||
| fn main() {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| error[E0425]: cannot find type `T` in this scope | ||
| --> $DIR/resolved-region-var-max-universe.rs:21:23 | ||
| | | ||
| LL | [(); Parent::CT::<T>]:, | ||
| | ^ not found in this scope | ||
| | | ||
| help: you might be missing a type parameter | ||
| | | ||
| LL | fn check<T>/*<T>*/() | ||
| | +++ | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0425`. |
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.
we use
MaxUniversewhen rewriting constraints to a lower universe which can happen on different terms than what we compute assumptions for (though there is significant overlap) 🤔 I would expect there to possibly be cases where we have unresolved type/const infer vars but im not sure.I would honestly probably just put a
resolve_vars_if_possiblecall in themax_universefunction just to be safe and then say we do that here, instead of trying to rely on some kind of global reasoning for why stuff must be resolved