-
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
Tweak E0599 and elaborate_predicates #106788
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
16e29db
to
ee8045f
Compare
if o.predicate.to_opt_poly_trait_pred().map(|p| p.def_id()) | ||
== self.tcx.lang_items().sized_trait() |
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.
if o.predicate.to_opt_poly_trait_pred().map(|p| p.def_id()) | |
== self.tcx.lang_items().sized_trait() | |
if let Some(trait_pred) = o.predicate.to_opt_poly_trait_pred() | |
&& self.tcx.lang_items().sized_trait() == Some(trait_pred.def_id()) |
This will never happen in practice, but it's better to deal with the None == None
case when lang-items are not defined.
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.
What is the None == None
case you envision? Because trait_pred
might have been None
(so we don't get into this logic) and sized_trait()
might be None
which might cause a build where the sized trait lang item isn't present to be too verbose (with extra labels), no other behavioral change.
@@ -3,7 +3,7 @@ | |||
use std::collections::HashSet; | |||
use std::hash::Hash; | |||
|
|||
fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool where T: Eq, T: Hash { | |||
fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool where T: Eq, T: Hash, T: PartialEq { |
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.
Hm, I don't consider this an improvement -- T: Eq
implies T: PartialEq
by elaboration.
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 agree, so I tested hiding the suggestions when a parent obligation was present, but that broke some existing tests with applicable suggestions. I'll see if we can inspect the obligation cause code instead to avoid these.
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.
Fixed
Ideally we'd distinguish elaborated predicates and "root" predicates so that we only pass the latter for suggestions, but I guess whatever 🤔 r=me |
When we have already suggested bounds that imply the about to be suggested bound, skip them.
ee8045f
to
22a0e4f
Compare
@bors r=compiler-errors |
…ompiler-errors Tweak E0599 and elaborate_predicates CC rust-lang#86377.
…ompiler-errors Tweak E0599 and elaborate_predicates CC rust-lang#86377.
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#106046 (Fix mir-opt tests for big-endian platforms) - rust-lang#106470 (tidy: Don't include wasm32 in compiler dependency check) - rust-lang#106566 (Emit a single error for contiguous sequences of unknown tokens) - rust-lang#106644 (Update the wasi-libc used for the wasm32-wasi target) - rust-lang#106665 (Add note when `FnPtr` vs. `FnDef` impl trait) - rust-lang#106752 (Emit a hint for bad call return types due to generic arguments) - rust-lang#106788 (Tweak E0599 and elaborate_predicates) - rust-lang#106831 (Use GitHub yaml templates for ICE, Docs and Diagnostics tickets) - rust-lang#106846 (Improve some comments and names in parser) - rust-lang#106848 (Fix wrong path in triage bot autolabel for wg-trait-solver-refactor) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
CC #86377.