]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issues/issue-49955-2.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / issues / issue-49955-2.rs
1 // run-pass
2 // compile-flags: -Z borrowck=mir
3
4 use std::cell::Cell;
5
6 const FIVE: Cell<i32> = Cell::new(5);
7
8 #[inline(never)]
9 fn tuple_field() -> &'static u32 {
10 // This test is MIR-borrowck-only because the old borrowck
11 // doesn't agree that borrows of "frozen" (i.e., without any
12 // interior mutability) fields of non-frozen temporaries,
13 // should be promoted, while MIR promotion does promote them.
14 &(FIVE, 42).1
15 }
16
17 fn main() {
18 assert_eq!(tuple_field().to_string(), "42");
19 }