Test that borrows of projections are promoted everywhere
Previously, this worked in `fn`s but not `const`s or `static`s.
This commit is contained in:
parent
fab0caf172
commit
d6431f69ad
1 changed files with 12 additions and 0 deletions
12
src/test/ui/consts/promote_borrowed_field.rs
Normal file
12
src/test/ui/consts/promote_borrowed_field.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// run-pass
|
||||||
|
|
||||||
|
// From https://github.com/rust-lang/rust/issues/65727
|
||||||
|
|
||||||
|
const _: &i32 = {
|
||||||
|
let x = &(5, false).0;
|
||||||
|
x
|
||||||
|
};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let _: &'static i32 = &(5, false).0;
|
||||||
|
}
|
Loading…
Reference in a new issue