about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-10-30 05:18:10 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-11-02 10:34:25 -0400
commit53e4bd44dedc6bbff84a5bfe564867362c320f49 (patch)
tree4f6ce88ff40cefa1eb672d183754f8f2161ecf8c /src
parentb7728273506c750b275f95613159a3e5b6e923f9 (diff)
downloadrust-53e4bd44dedc6bbff84a5bfe564867362c320f49.tar.gz
rust-53e4bd44dedc6bbff84a5bfe564867362c320f49.zip
add `mir-opt/named-lifetimes-basic.rs`
This lets us inspect the regions we infer around named arguments.
Diffstat (limited to 'src')
-rw-r--r--src/test/mir-opt/nll/named-lifetimes-basic.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/mir-opt/nll/named-lifetimes-basic.rs b/src/test/mir-opt/nll/named-lifetimes-basic.rs
new file mode 100644
index 00000000000..c4f3a6fea53
--- /dev/null
+++ b/src/test/mir-opt/nll/named-lifetimes-basic.rs
@@ -0,0 +1,34 @@
+// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Basic test for named lifetime translation. Check that we
+// instantiate the types that appear in function arguments with
+// suitable variables and that we setup the outlives relationship
+// between R0 and R1 properly.
+
+// compile-flags:-Znll -Zverbose
+//                     ^^^^^^^^^ force compiler to dump more region information
+// ignore-tidy-linelength
+
+#![allow(warnings)]
+
+fn use_x<'a, 'b: 'a, 'c>(w: &'a mut i32, x: &'b u32, y: &'a u32, z: &'c u32) -> bool { true }
+
+fn main() {
+}
+
+// END RUST SOURCE
+// START rustc.node4.nll.0.mir
+// | '_#0r: {bb0[0], bb0[1], '_#0r}
+// | '_#1r: {bb0[0], bb0[1], '_#0r, '_#1r}
+// | '_#2r: {bb0[0], bb0[1], '_#2r}
+// ...
+// fn use_x(_1: &'_#0r mut i32, _2: &'_#1r u32, _3: &'_#0r u32, _4: &'_#2r u32) -> bool {
+// END rustc.node4.nll.0.mir