-
Notifications
You must be signed in to change notification settings - Fork 13k
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
handle global trait bounds defining assoc types #135766
Conversation
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@@ -1198,34 +1197,42 @@ where | |||
// We prefer trivial builtin candidates, i.e. builtin impls without any | |||
// nested requirements, over all others. This is a fix for #53123 and | |||
// prevents where-bounds from accidentally extending the lifetime of a | |||
// variable. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
// for an example where this is necessary. | ||
for p in goal.param_env.caller_bounds().iter() { | ||
if let ty::ClauseKind::Projection(proj) = p.kind().skip_binder() { | ||
if proj.projection_term.trait_ref(self.cx()) == trait_pred.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.
structural equality seems sketchy here 🤔
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.
Like, this seems like it will not interact well with HRTBs due to anonymization.
Also the commit history is weird -- commit named "add where clause" which definitely does not add where clause lol |
66a3afb
to
09b784f
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@bors r+ |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#135073 (Implement `ByteStr` and `ByteString` types) - rust-lang#135492 (Add missing check for async body when suggesting await on futures.) - rust-lang#135766 (handle global trait bounds defining assoc types) - rust-lang#135880 (Get rid of RunCompiler) - rust-lang#135908 (rustc_codegen_llvm: remove outdated asm-to-obj codegen note) - rust-lang#135911 (Allow `arena_cache` queries to return `Option<&'tcx T>`) - rust-lang#135920 (simplify parse_format::Parser::ws by using next_if) r? `@ghost` `@rustbot` modify labels: rollup
This also fixes the compare-mode for
I first considered the alternative to always prefer where-bounds during normalization, regardless of how the trait goal has been proven by changing
fn merge_candidates
instead.rust/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
Line 785 in ecda83b
This approach is more restrictive than behavior of the old solver to avoid mismatches between trait and normalization goals. This may be breaking in case the where-bound adds unnecessary region constraints and we currently don't ever try to normalize an associated type. I would like to detect these cases and change the approach to exactly match the old solver if required. I want to minimize cases where attempting to normalize in more places causes code to break.
r? @compiler-errors