forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#121893 - RalfJung:const-interior-mut-tests,…
… r=oli-obk Add tests (and a bit of cleanup) for interior mut handling in promotion and const-checking Basically these are the parts of rust-lang#121786 that can be salvaged. r? ``@oli-obk``
- Loading branch information
Showing
8 changed files
with
119 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//@build-pass | ||
// Some code that looks like it might be relying on promotion, but actually this is using the | ||
// enclosing-scope rule, meaning the reference is "extended" to outlive its block and live as long | ||
// as the surrounding block (which in this case is the entire program). There are multiple | ||
// allocations being interned at once. | ||
|
||
struct Gen<T>(T); | ||
impl<'a, T> Gen<&'a T> { | ||
// Can't be promoted because `T` might not be `'static`. | ||
const C: &'a [T] = &[]; | ||
} | ||
|
||
// Can't be promoted because of `Drop`. | ||
const V: &Vec<i32> = &Vec::new(); | ||
|
||
fn main() {} |
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