about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-16 21:00:21 +0000
committerbors <bors@rust-lang.org>2017-08-16 21:00:21 +0000
commit7ac979d8cbe97241fd39f4037e1d4069caaff4d2 (patch)
tree32d267345c20b109c744b01962c525961550ce54 /src/test/ui
parent3f94b7103bef77b22ff436b148792834b9e44065 (diff)
parent014333fbd422f56628a2b5b707d192cef838afc3 (diff)
downloadrust-7ac979d8cbe97241fd39f4037e1d4069caaff4d2.tar.gz
rust-7ac979d8cbe97241fd39f4037e1d4069caaff4d2.zip
Auto merge of #43838 - eddyb:stable-rvalue-promotion, r=arielb1
Stabilize rvalue promotion to 'static.

Closes #38865.

Documentation PR at rust-lang-nursery/reference#98.
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/lifetimes/borrowck-let-suggestion.rs2
-rw-r--r--src/test/ui/lifetimes/borrowck-let-suggestion.stderr7
-rw-r--r--src/test/ui/span/borrowck-let-suggestion-suffixes.rs8
-rw-r--r--src/test/ui/span/borrowck-let-suggestion-suffixes.stderr30
-rw-r--r--src/test/ui/span/issue-15480.rs4
-rw-r--r--src/test/ui/span/issue-15480.stderr10
-rw-r--r--src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs4
-rw-r--r--src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr12
-rw-r--r--src/test/ui/span/slice-borrow.rs2
-rw-r--r--src/test/ui/span/slice-borrow.stderr6
10 files changed, 47 insertions, 38 deletions
diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.rs b/src/test/ui/lifetimes/borrowck-let-suggestion.rs
index eeafaab44c6..1c904648f9e 100644
--- a/src/test/ui/lifetimes/borrowck-let-suggestion.rs
+++ b/src/test/ui/lifetimes/borrowck-let-suggestion.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn f() {
-    let x = [1].iter();
+    let x = vec![1].iter();
 }
 
 fn main() {
diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
index d1ba9246588..6316c066660 100644
--- a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
+++ b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
@@ -1,14 +1,15 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion.rs:12:23
+  --> $DIR/borrowck-let-suggestion.rs:12:27
    |
-12 |     let x = [1].iter();
-   |             ---       ^ temporary value dropped here while still borrowed
+12 |     let x = vec![1].iter();
+   |             -------       ^ temporary value dropped here while still borrowed
    |             |
    |             temporary value created here
 13 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
+   = note: this error originates in a macro outside of the current crate
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
index 1206d716672..9e316b989a4 100644
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
+++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+fn id<T>(x: T) -> T { x }
+
 fn f() {
     let old = ['o'];         // statement 0
     let mut v1 = Vec::new(); // statement 1
@@ -21,7 +23,7 @@ fn f() {
 
     let mut v3 = Vec::new(); // statement 5
 
-    v3.push(&'x');           // statement 6
+    v3.push(&id('x'));           // statement 6
     //~^ ERROR borrowed value does not live long enough
     //~| NOTE temporary value created here
     //~| NOTE temporary value only lives until here
@@ -31,7 +33,7 @@ fn f() {
 
         let mut v4 = Vec::new(); // (sub) statement 0
 
-        v4.push(&'y');
+        v4.push(&id('y'));
         //~^ ERROR borrowed value does not live long enough
         //~| NOTE temporary value created here
         //~| NOTE temporary value only lives until here
@@ -42,7 +44,7 @@ fn f() {
 
     let mut v5 = Vec::new(); // statement 8
 
-    v5.push(&'z');
+    v5.push(&id('z'));
     //~^ ERROR borrowed value does not live long enough
     //~| NOTE temporary value created here
     //~| NOTE temporary value only lives until here
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
index 6ed1b7c2622..86c6f28ef1c 100644
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
+++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
@@ -1,49 +1,49 @@
 error[E0597]: `young[..]` does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:52:1
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:54:1
    |
-19 |     v2.push(&young[0]);      // statement 4
+21 |     v2.push(&young[0]);      // statement 4
    |              -------- borrow occurs here
 ...
-52 | }
+54 | }
    | ^ `young[..]` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:24:18
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:26:22
    |
-24 |     v3.push(&'x');           // statement 6
-   |              --- ^ temporary value dropped here while still borrowed
+26 |     v3.push(&id('x'));           // statement 6
+   |              ------- ^ temporary value dropped here while still borrowed
    |              |
    |              temporary value created here
 ...
-52 | }
+54 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
 
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:34:22
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:36:26
    |
-34 |         v4.push(&'y');
-   |                  --- ^ temporary value dropped here while still borrowed
+36 |         v4.push(&id('y'));
+   |                  ------- ^ temporary value dropped here while still borrowed
    |                  |
    |                  temporary value created here
 ...
-40 |     }                       // (statement 7)
+42 |     }                       // (statement 7)
    |     - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
 
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:45:18
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:47:22
    |
-45 |     v5.push(&'z');
-   |              --- ^ temporary value dropped here while still borrowed
+47 |     v5.push(&id('z'));
+   |              ------- ^ temporary value dropped here while still borrowed
    |              |
    |              temporary value created here
 ...
-52 | }
+54 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
diff --git a/src/test/ui/span/issue-15480.rs b/src/test/ui/span/issue-15480.rs
index ea5f4d3fe60..871e0af50bf 100644
--- a/src/test/ui/span/issue-15480.rs
+++ b/src/test/ui/span/issue-15480.rs
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+fn id<T>(x: T) -> T { x }
+
 fn main() {
     let v = vec![
-        &3
+        &id(3)
     ];
 
     for &&x in &v {
diff --git a/src/test/ui/span/issue-15480.stderr b/src/test/ui/span/issue-15480.stderr
index ce1c6e81b96..7f4ca19241c 100644
--- a/src/test/ui/span/issue-15480.stderr
+++ b/src/test/ui/span/issue-15480.stderr
@@ -1,12 +1,12 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/issue-15480.rs:14:6
+  --> $DIR/issue-15480.rs:16:6
    |
-13 |         &3
-   |          - temporary value created here
-14 |     ];
+15 |         &id(3)
+   |          ----- temporary value created here
+16 |     ];
    |      ^ temporary value dropped here while still borrowed
 ...
-19 | }
+21 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
index a524562f2d9..99b0d6ed296 100644
--- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
+++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
@@ -10,6 +10,8 @@
 
 #![feature(box_syntax)]
 
+fn id<T>(x: T) -> T { x }
+
 trait Foo { }
 
 impl<'a> Foo for &'a isize { }
@@ -17,7 +19,7 @@ impl<'a> Foo for &'a isize { }
 fn main() {
     let blah;
     {
-        let ss: &isize = &1;
+        let ss: &isize = &id(1);
         blah = box ss as Box<Foo>;
     }
 }
diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
index e671f1daf61..6a3625441b4 100644
--- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
+++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
@@ -1,12 +1,12 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:5
+  --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:24:5
    |
-20 |         let ss: &isize = &1;
-   |                           - temporary value created here
-21 |         blah = box ss as Box<Foo>;
-22 |     }
+22 |         let ss: &isize = &id(1);
+   |                           ----- temporary value created here
+23 |         blah = box ss as Box<Foo>;
+24 |     }
    |     ^ temporary value dropped here while still borrowed
-23 | }
+25 | }
    | - temporary value needs to live until here
 
 error: aborting due to previous error
diff --git a/src/test/ui/span/slice-borrow.rs b/src/test/ui/span/slice-borrow.rs
index 4ca0ccaa731..1b022f23246 100644
--- a/src/test/ui/span/slice-borrow.rs
+++ b/src/test/ui/span/slice-borrow.rs
@@ -13,7 +13,7 @@
 fn main() {
     let y;
     {
-        let x: &[isize] = &[1, 2, 3, 4, 5];
+        let x: &[isize] = &vec![1, 2, 3, 4, 5];
         y = &x[1..];
     }
 }
diff --git a/src/test/ui/span/slice-borrow.stderr b/src/test/ui/span/slice-borrow.stderr
index b60ccd0fbf3..5e8edf80df6 100644
--- a/src/test/ui/span/slice-borrow.stderr
+++ b/src/test/ui/span/slice-borrow.stderr
@@ -1,13 +1,15 @@
 error[E0597]: borrowed value does not live long enough
   --> $DIR/slice-borrow.rs:18:5
    |
-16 |         let x: &[isize] = &[1, 2, 3, 4, 5];
-   |                            --------------- temporary value created here
+16 |         let x: &[isize] = &vec![1, 2, 3, 4, 5];
+   |                            ------------------- temporary value created here
 17 |         y = &x[1..];
 18 |     }
    |     ^ temporary value dropped here while still borrowed
 19 | }
    | - temporary value needs to live until here
+   |
+   = note: this error originates in a macro outside of the current crate
 
 error: aborting due to previous error