forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#80418 - oli-obk:this_could_have_been_so_simpl…
…e, r=RalfJung Allow references to interior mutable data behind a feature gate supercedes rust-lang#80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant tracking issue: rust-lang#80384 r? `@RalfJung`
- Loading branch information
Showing
24 changed files
with
230 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead | ||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability | ||
--> $DIR/const-address-of-interior-mut.rs:5:39 | ||
| | ||
LL | const A: () = { let x = Cell::new(2); &raw const x; }; | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information | ||
= help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable | ||
|
||
error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead | ||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability | ||
--> $DIR/const-address-of-interior-mut.rs:7:40 | ||
| | ||
LL | static B: () = { let x = Cell::new(2); &raw const x; }; | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information | ||
= help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable | ||
|
||
error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead | ||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability | ||
--> $DIR/const-address-of-interior-mut.rs:9:44 | ||
| | ||
LL | static mut C: () = { let x = Cell::new(2); &raw const x; }; | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information | ||
= help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable | ||
|
||
error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead | ||
error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability | ||
--> $DIR/const-address-of-interior-mut.rs:13:13 | ||
| | ||
LL | let y = &raw const x; | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: see issue #80384 <https://github.com/rust-lang/rust/issues/80384> for more information | ||
= help: add `#![feature(const_refs_to_cell)]` to the crate attributes to enable | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0492`. | ||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.