Skip to content

Commit

Permalink
Test that borrows of projections are promoted everywhere
Browse files Browse the repository at this point in the history
Previously, this worked in `fn`s but not `const`s or `static`s.
  • Loading branch information
ecstatic-morse committed Nov 3, 2019
1 parent fab0caf commit d6431f6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/ui/consts/promote_borrowed_field.rs
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit d6431f6

Please sign in to comment.