Uh oh!
There was an error while loading. Please reload this page.
Promoteds can contain raw pointers, but these must still only point to immutable allocations - #67603
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bors
commented
Dec 26, 2019
☔ The latest upstream changes (presumably #67327) made this pull request unmergeable. Please resolve the merge conflicts. |
Uh oh!
There was an error while loading. Please reload this page.
SimonSapin
commented
Jan 3, 2020
Friendly ping: what’s next for this PR? Can I help? |
oli-obk
commented
Jan 3, 2020
I just haven't gotten to it. Probably Tuesday or some other day next week |
cc9326c to
1af201cCompareoli-obk
commented
Jan 8, 2020
I addressed all review comments and marked the issue as a stable to nightly regression |
There was a problem hiding this comment.
Right, I was thinking about this branch here when asking about nested allocations in constants. Isn't this unreachable then?
There was a problem hiding this comment.
It is reachable, but I'm entirely unclean on why it is reachable
constRAW_TRAIT_OBJ_CONTENT_INVALID:*constdynTrait = &unsafe{BoolTransmute{val:3}.bl}as*const_;hits the InternKind::Constant arm.
See the MIR on https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3bc6c8b165b614bbe6cf5566d30752de there's no StorageDead for the allocation containing the bool with bit pattern 3.
I'm not really sure what's going on there. Technically, since we're inside a constant, shouldn't this trigger promotion and promote the transmuted value?
There was a problem hiding this comment.
Under unleash it's also reached in
constMUTABLE_BEHIND_RAW:*muti32 = &UnsafeCell::new(42)as*const_as*mut_;but that triggers the delay_span_bug as expected.
Also under unleash, but without an ICE (just triggering the dynamic checks in interp):
constMUTABLE_BEHIND_RAW:*muti32 = &UnsafeCell::new(42)as*const_as*mut_;//~^ WARN: skipping const checksconstMUTATING_BEHIND_RAW:() = {// Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.unsafe{*MUTABLE_BEHIND_RAW = 99//~ ERROR any use of this value will cause an error}};There was a problem hiding this comment.
I'm not really sure what's going on there. Technically, since we're inside a constant, shouldn't this trigger promotion and promote the transmuted value?
Ah, this must be the "not-promotion" also described in this document (Ctrl-F "looks like"). That makes sense.
There was a problem hiding this comment.
What I don't understand though is why RAW_TRAIT_OBJ_CONTENT_INVALID doesn't trigger the ICE. Why is the allocation already immutable?
There was a problem hiding this comment.
(The PR doesn't change anything here so this doesn't block landing, but I'd really like to understand this and then see it documented.)
There was a problem hiding this comment.
I would find documentation here immensely helpful.
There was a problem hiding this comment.
If you have a holistic view of what happens, it would really help to write that down.
I don't, which is why my answers are so confusing. They are just a brain dump of me discovering what is going on, not me understanding it entirely
There was a problem hiding this comment.
These issues are preexisting, so after this PR is merged I'll open a new one to write docs and actually figure out what is going on
There was a problem hiding this comment.
I don't, which is why my answers are so confusing. They are just a brain dump of me discovering what is going on, not me understanding it entirely
Fair enough. :)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bors
commented
Jan 10, 2020
☔ The latest upstream changes (presumably #68078) made this pull request unmergeable. Please resolve the merge conflicts. |
1af201c to
5053f1bCompareUh oh!
There was an error while loading. Please reload this page.
bors
commented
Jan 11, 2020
☔ The latest upstream changes (presumably #67000) made this pull request unmergeable. Please resolve the merge conflicts. |
RalfJung
commented
Jan 13, 2020
r=me with the |
Uh oh!
There was an error while loading. Please reload this page.
…o immutable allocations
Co-Authored-By: Ralf Jung <post@ralfj.de>
e1479dd to
69ffe7bCompareoli-obk
commented
Jan 15, 2020
@bors r=RalfJung |
bors
commented
Jan 15, 2020
📌 Commit 69ffe7b has been approved by |
RalfJung
commented
Jan 15, 2020
@bors p=1 (regression fix, and this has been sitting for a while) |
bors
commented
Jan 15, 2020
Promoteds can contain raw pointers, but these must still only point to immutable allocations fixes#67601 r? @RalfJung cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future
bors
commented
Jan 15, 2020
☀️ Test successful - checks-azure |
rust-highfive
commented
Jan 15, 2020
Tested on commit rust-lang/rust@faf45c5. Direct link to PR: <rust-lang/rust#67603> 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
SimonSapin
commented
Jan 15, 2020
Confirmed that this fixes #67601 for Servo. Thanks! |
Upgrade to rustc 1.42.0-nightly (3291ae339 2020-01-15) This was unblocked by rust-lang/rust#67603 fixing rust-lang/rust#67601.
Upgrade to rustc 1.42.0-nightly (3291ae339 2020-01-15) This was unblocked by rust-lang/rust#67603 fixing rust-lang/rust#67601.
Upgrade to rustc 1.42.0-nightly (3291ae339 2020-01-15) This was unblocked by rust-lang/rust#67603 fixing rust-lang/rust#67601.
Upgrade to rustc 1.42.0-nightly (3291ae339 2020-01-15) This was unblocked by rust-lang/rust#67603 fixing rust-lang/rust#67601.
Upgrade to rustc 1.42.0-nightly (3291ae339 2020-01-15) This was unblocked by rust-lang/rust#67603 fixing rust-lang/rust#67601.
fixes#67601
r? @RalfJung
cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future