Skip to content

Commit 53e4bd4

Browse files
committed
add mir-opt/named-lifetimes-basic.rs
This lets us inspect the regions we infer around named arguments.
1 parent b772827 commit 53e4bd4

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Basic test for named lifetime translation. Check that we
12+
// instantiate the types that appear in function arguments with
13+
// suitable variables and that we setup the outlives relationship
14+
// between R0 and R1 properly.
15+
16+
// compile-flags:-Znll -Zverbose
17+
// ^^^^^^^^^ force compiler to dump more region information
18+
// ignore-tidy-linelength
19+
20+
#![allow(warnings)]
21+
22+
fn use_x<'a, 'b: 'a, 'c>(w: &'a mut i32, x: &'b u32, y: &'a u32, z: &'c u32) -> bool { true }
23+
24+
fn main() {
25+
}
26+
27+
// END RUST SOURCE
28+
// START rustc.node4.nll.0.mir
29+
// | '_#0r: {bb0[0], bb0[1], '_#0r}
30+
// | '_#1r: {bb0[0], bb0[1], '_#0r, '_#1r}
31+
// | '_#2r: {bb0[0], bb0[1], '_#2r}
32+
// ...
33+
// fn use_x(_1: &'_#0r mut i32, _2: &'_#1r u32, _3: &'_#0r u32, _4: &'_#2r u32) -> bool {
34+
// END rustc.node4.nll.0.mir

0 commit comments

Comments
 (0)