-
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
Reconstify Add
#120381
Reconstify Add
#120381
Conversation
This comment has been minimized.
This comment has been minimized.
the first item seems to be reverting a previous const_trait_impl change: 191d3b7#diff-bcbca6666787ee0e6f033b0ba775250deb6d0cfb58d2f2195e11635f2e00ad11 |
8284875
to
2e1e574
Compare
making as ready for review, see the latest commits |
.. forgot to rename the title |
@@ -11,16 +11,29 @@ LL | <i32 as Add<u32>>::add(1, 2); | |||
<&'a i32 as Add<i32>> | |||
<&i32 as Add<&i32>> | |||
|
|||
error[E0277]: cannot add `u32` to `i32` |
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.
It's fine that this error message is duplicated imo.
@@ -16,6 +16,10 @@ help: consider annotating `S<T>` with `#[derive(PartialEq)]` | |||
LL + #[derive(PartialEq)] | |||
LL | struct S<T>(T); | |||
| | |||
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | |||
| | |||
LL | pub fn foo<T>(s: S<T>, t: S<T>) where S<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.
Why is this being suggested now?
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.
It was removed in a const-traits PR: d464dd0#diff-a4f9511c26556adec6fac6f4073f446a12e9c9c883b0fd5ae672956caa5836c9 in #118661. This has been suggested before PartialEq
gained the effect param, and adding the effect param in that commit made PartialEq
not suggestable (which this PR makes it suggestable again)
r=me on the changes, though I am curious why that new suggestion is being suggested. Can we suppress it? |
I don't know why that suggestion exists, but I don't think it is related to const traits (per my latest comment). @rustbot ready |
cool @bors r+ |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…r=compiler-errors Reconstify `Add` r? project-const-traits I'm not happy with the ui test changes (or failures because I did not bless them and include the diffs in this PR). There is at least some bugs I need to look and try fix: 1. A third duplicated diagnostic when a consumer crate that does not have `effects` enabled has a trait selection error for an upstream const_trait trait. See tests/ui/ufcs/ufcs-qpath-self-mismatch.rs. 2. For some reason, making `Add` a const trait would stop us from suggesting `T: Add` when we try to add two `T`s without that bound. See tests/ui/suggestions/issue-97677.rs
@bors r- can this have some perf impact, I wonder if we should rollup iffy or never. |
it works when a non-const context that does not enable effects calls into a const effects-enabled trait. We'd simply suggest the non-const trait bound in this case consistent to its fallback.
these ui changes are closer to what was there before const_trait_impl changes.
2e1e574
to
74dbf3a
Compare
I have blessed the test. Don't think this could have a large perf impact, but it might because of adding a generic param though. @bors rollup=iffy |
Blessing is a minor change, don't think it needs to be reviewed again @bors r=compiler-errors |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6894f43): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 662.945s -> 663.461s (0.08%) |
r? project-const-traits
I'm not happy with the ui test changes (or failures because I did not bless them and include the diffs in this PR). There is at least some bugs I need to look and try fix:
effects
enabled has a trait selection error for an upstream const_trait trait. See tests/ui/ufcs/ufcs-qpath-self-mismatch.rs.Add
a const trait would stop us from suggestingT: Add
when we try to add twoT
s without that bound. See tests/ui/suggestions/issue-97677.rs