-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Allow T op= &T for built-in numeric types T v2 #44287
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The
|
I'm not seeing how to fix the test. It is a very fragile situation in which this test passes. I.E. this |
The test was introduced in #42634 (comment) (cc @nikomatsakis). Maybe you could just disable the test (add a comment |
Thanks for suggestion. Let's see what ci thinks. |
@rust-lang/infra cargobomb requested! |
@bors try |
☀️ Test successful - status-travis |
Started preparing cargobomb run. |
x >>= &2i16; | ||
assert_eq!(x, 0b10u64); | ||
} | ||
} |
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.
Missing trailing newline
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.
Should I fix now or wait for cargobomb?
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.
@Eh2406 Cargobomb uses the compiler already built from @bors try
. You could fix it any time you like.
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.
Done, thanks!
Cargobomb run complete: http://cargobomb-reports.s3.amazonaws.com/pr-44287/index.html. |
Thanks for running this! I am new to cargobomb, what is the best way to proceed? How can I find the original code, so I can start on Pr's? Any iday how this Pr can lead to a |
Usually regressed is the only section you need to pay attention to. Since this change affects type inference, the "test-fail" results likely means the crate's tests are flaky, and can be safely ignored. The list of crates with flaky tests can be found in https://github.com/rust-lang-nursery/cargobomb/blob/master/blacklist.md, rust-lang/crater#126 and rust-lang/crater#127. For instance Sometimes even "build-fail" tests are spurious, e.g. However, the error in There are 12 root regressions, much more than the previous try.
|
I'd also like to note that rust-lang/rfcs#2147 may make this PR unnecessary. |
@kennytm: Thanks a lot for the nice summary of the regressions. Does cargobomb test more crates than crater did? Because I find it surprising that there would be more people writing this kind of pattern in the last 3 months than in the 2 years before that. But to answer your remark that "rust-lang/rfcs#2147 may make this PR unnecessary": I don't think that's true. Let me explain: In non-generic code, the problems that this PR solves are indeed also solved by rust-lang/rfcs#2147. This PR helps you if you have an So it looks like that RFC is just a far superior version of this PR. But that's in non-generic code, where this PR only solves some very minor inconveniences. The main use of this PR is in generic code, for the use case where you want to write a generic function that has to work both with built-in numeric types ( So tl;dr: yes rust-lang/rfcs#2147 supersedes this PR for non-generic code, but not in generic code. (I reworked this post a bit because it was inaccurate) |
@migi Thank you for the detailed analysis! And yes, cargobomb tests more than crater did. Crater just tried to build all the crates, Cargobomb tries to run all the tests. So the the regressions in test code, like treeflection_derive, would not have been caught by Crater. @kennytm Thank you for the explanation and for doing the triage. I will work on making PR's to fix them later today/as soon as I have time. How can I get rustup to use the try artifact, so I can double check my fixes? |
@Eh2406 Not sure how to setup rustup for this, but you could download the binaries from |
https://github.com/Mark-Simulacrum/bisect-rust will download and unarchive a try build, you just need to run |
☀️ Test successful - status-appveyor, status-travis |
👀 Test was successful, but fast-forwarding failed: 422 Update is not a fast forward |
@bors r- |
@bors r=aturon rollup |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 2adeba6 has been approved by |
Allow T op= &T for built-in numeric types T v2 Manually rebase of @migi rust-lang#41336
☔ The latest upstream changes (presumably #44936) made this pull request unmergeable. Please resolve the merge conflicts. |
Merged in #44936. |
This broke Servo: error[E0283]: type annotations required: cannot resolve `usize: core::ops::AddAssign<_>`
--> /home/travis/build/servo/servo-with-rust-nightly/servo/components/script/textinput.rs:239:31
|
239 | |len, slice| *len += slice.chars().map(char::len_utf16).sum())
| ^^
error: aborting due to previous error (Using |
|
The regression is filed as rust-lang/rust#45480. It seems this broke because of rust-lang/rust#44287.
The regression is filed as rust-lang/rust#45480. It seems this broke because of rust-lang/rust#44287.
Given #45480, should this be tagged as (I skimmed the comments and commits and did not see that string anywhere, thus my question. Having it in the description can be useful for release notes...) |
I would be in favor of tagging this as However, it should be noted that type inference is specifically excluded from the backwards compatibility guarantees of Rust. See for example in the official FAQ, under "How does Rust language versioning work?":
That FAQ further says "For additional details, read the Rust blog post “Stability as a Deliverable.”, which also says the same, under "What are the stability caveats?":
So essentially, code relying on type inference is occasionally going to need some additional annotations. The reason is that type inference tries to do as much as it can, relying both on what impls exist and also on what impls don't exist. This is very useful, but has the downside that adding an impl may occasionally break working code, which is what happened here. |
Another important aspect of inference breakage is that it is (always?) possible to write code with more type annotations that works both in compiler with and without the change. |
Manually rebase of @migi #41336