-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Revert "Remove checked_add
in Layout::repeat
"
#69241
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
I don't know how to add a test that expects to segfault here. Generally some mentoring would be appreciated if necessary. Thanks! |
To fix the CI problem, run |
To add a test, you could add a file in the As @Mark-Simulacrum said, some builders on CI should be built without edit: or where @Centril pointed to :) |
(Instead of |
I am trying that, but I get an error:
|
This comment has been minimized.
This comment has been minimized.
Use this (possibly tweak the amount of indents at the start of the lines if need be) let padded_size = self
.size()
.checked_add(self.padding_needed_for(self.align()))
.ok_or(LayoutErr { private: () })?;
let alloc_size = padded_size.checked_mul(n).ok_or(LayoutErr { private: () })?; |
bca5ab4
to
ad1b7af
Compare
I pushed a new version but I made some kind of mistake with the ui test. It passes on master and on this PR for me locally... |
ad1b7af
to
1e1c093
Compare
Note the For the test, I think it's because the miscompilation only happens with the specific opt-level, try it with |
1e1c093
to
ef157f3
Compare
Unfortunately, that also didn't work for me locally. Hm. |
Does it fail because it's asking for a .stderr file ? If so, re-run your test with |
I am not seeing any error, whether I run the test on an unmodified master or on my branch. That's my problem - I think it must error on master with just the test applied, but somehow it doesn't |
To make sure I understand:
(those first 2 steps required me to have ( |
yes
yes
When running tests on master with only the test case from this PR added but no other changes, the test suite (./x.py test --stage 1 src/test/ui) passes. It also passes when running tests on this PR. |
In case a segfault is considered a valid |
ef157f3
to
bdb1192
Compare
Indeed it does fail now on master but passes with this branch! Very sincere thanks for all your help lqd and Centril! |
I am happy with this PR, and I think we want to get this into nightly fairly quickly, especially as we contemplate beta and stable backports (with a likely point release around the corner). @bors r+ p=1 But feel free to roll this up as well. |
📌 Commit bdb1192510f4c765c4f89a9dd382319a35472a80 has been approved by |
☀️ Test successful - checks-azure |
discussed in T-compiler meeting. accepted for beta-backport |
discussed in T-compiler meeting. accepted for stable backport |
[stable] 1.41.1 release This backports the following PRs: * Revert "Remove `checked_add` in `Layout::repeat`" #69241 * Do not ICE when encountering `yield` inside `async` block #69175 * Correct ICE caused by macros generating invalid spans. #68611 * Changelog: Demonstrate final build-override syntax #68603 * Resolve long compile times when evaluating always valid constants #67667 * Fix MIR typeck soundness holes #69145 This also includes a commit which rustfmt's files which the latter commits touched (and perhaps a bit more) to make rebasing the PRs go more smoothly (thankfully, this should be the last time we need to do so). I have removed stable-nominated tags from PRs successfully backported.
[stable] 1.41.1 release This backports the following PRs: * Revert "Remove `checked_add` in `Layout::repeat`" #69241 * Do not ICE when encountering `yield` inside `async` block #69175 * Correct ICE caused by macros generating invalid spans. #68611 * Changelog: Demonstrate final build-override syntax #68603 * Resolve long compile times when evaluating always valid constants #67667 * Fix MIR typeck soundness holes #69145 This also includes a commit which rustfmt's files which the latter commits touched (and perhaps a bit more) to make rebasing the PRs go more smoothly (thankfully, this should be the last time we need to do so). I have removed stable-nominated tags from PRs successfully backported.
[beta] beta backports This backports the following PRs: * Revert "Remove `checked_add` in `Layout::repeat`" #69241 * Do not ICE when encountering `yield` inside `async` block #69175 * Fix MIR typeck soundness holes #69145 * Fix extra subslice lowering #69128 * Correct ICE caused by macros generating invalid spans. #68611 * Make conflicting_repr_hints a deny-by-default c-future-compat lint #68586
Cherry-pick the LLVM fix for #69225 An additional reproducer was provided in #69225 -- the new testcase here -- which still crashes even after #69241 reverted #67174. Now this pull request updates LLVM with the cherry-picked reversion of its own. This is also going to stable in #69444. I have not tried to reapply #67174 yet -- cc @kraai @shahn
Given that we have #69450 as a proper fix, is someone taking care of reverting this revert? |
Yes, I'll do it |
Unrevert "Remove `checked_add` in `Layout::repeat`" This reapplies @kraai's original `libcore::alloc::Layout::repeat` change from rust-lang#67174 which was temporarily reverted in rust-lang#69241. Now that the proper LLVM fix has been cherry-picked, we can unrevert the revert. This change was originally reviewed by @hanna-kruppe on the initial PR. cc @RalfJung
This fixes a a segfault in safe code, a stable regression. Reported in #69225.
This reverts commit a983e05.