about summary refs log tree commit diff
path: root/src/test/ui/static
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-04-22 08:40:08 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2019-04-22 08:40:08 +0100
commit8eef102270647af94f38274efb9a2fd5ef8a92ec (patch)
tree95d7674ad687c45b730906915e79a0993138306b /src/test/ui/static
parentaa6fb6caf9d8456c70144ccba1e969c85926e229 (diff)
downloadrust-8eef102270647af94f38274efb9a2fd5ef8a92ec.tar.gz
rust-8eef102270647af94f38274efb9a2fd5ef8a92ec.zip
update tests for migrate mode by default
Diffstat (limited to 'src/test/ui/static')
-rw-r--r--src/test/ui/static/static-drop-scope.nll.stderr71
-rw-r--r--src/test/ui/static/static-drop-scope.rs4
-rw-r--r--src/test/ui/static/static-drop-scope.stderr26
-rw-r--r--src/test/ui/static/static-lifetime-bound.nll.stderr22
-rw-r--r--src/test/ui/static/static-lifetime-bound.stderr11
-rw-r--r--src/test/ui/static/static-reference-to-fn-2.nll.stderr47
-rw-r--r--src/test/ui/static/static-reference-to-fn-2.rs8
-rw-r--r--src/test/ui/static/static-reference-to-fn-2.stderr86
-rw-r--r--src/test/ui/static/static-region-bound.nll.stderr13
-rw-r--r--src/test/ui/static/static-region-bound.rs2
-rw-r--r--src/test/ui/static/static-region-bound.stderr11
11 files changed, 62 insertions, 239 deletions
diff --git a/src/test/ui/static/static-drop-scope.nll.stderr b/src/test/ui/static/static-drop-scope.nll.stderr
deleted file mode 100644
index 8a23dad1ba3..00000000000
--- a/src/test/ui/static/static-drop-scope.nll.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:9:60
-   |
-LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
-   |                                                            ^^^^^^^^ statics cannot evaluate destructors
-
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/static-drop-scope.rs:9:60
-   |
-LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
-   |                                                      ------^^^^^^^^-
-   |                                                      |     |       |
-   |                                                      |     |       temporary value is freed at the end of this statement
-   |                                                      |     creates a temporary which is freed while still in use
-   |                                                      using this value as a static requires that borrow lasts for `'static`
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:13:59
-   |
-LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
-   |                                                           ^^^^^^^^ constants cannot evaluate destructors
-
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/static-drop-scope.rs:13:59
-   |
-LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
-   |                                                     ------^^^^^^^^-
-   |                                                     |     |       |
-   |                                                     |     |       temporary value is freed at the end of this statement
-   |                                                     |     creates a temporary which is freed while still in use
-   |                                                     using this value as a constant requires that borrow lasts for `'static`
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:17:28
-   |
-LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1;
-   |                            ^^^^^^^^^^^^^ statics cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:20:27
-   |
-LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1;
-   |                           ^^^^^^^^^^^^^ constants cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:23:24
-   |
-LL | const fn const_drop<T>(_: T) {}
-   |                        ^ constant functions cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:27:5
-   |
-LL |     (x, ()).1
-   |     ^^^^^^^ constant functions cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:31:34
-   |
-LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
-   |                                  ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
-
-error[E0493]: destructors cannot be evaluated at compile-time
-  --> $DIR/static-drop-scope.rs:36:43
-   |
-LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
-   |                                           ^^^^^^^^^^^ constants cannot evaluate destructors
-
-error: aborting due to 10 previous errors
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/static/static-drop-scope.rs b/src/test/ui/static/static-drop-scope.rs
index e5a9f2a4056..0de28d5469b 100644
--- a/src/test/ui/static/static-drop-scope.rs
+++ b/src/test/ui/static/static-drop-scope.rs
@@ -8,11 +8,11 @@ impl Drop for WithDtor {
 
 static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
 //~^ ERROR destructors cannot be evaluated at compile-time
-//~| ERROR borrowed value does not live long enoug
+//~| ERROR temporary value dropped while borrowed
 
 const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
 //~^ ERROR destructors cannot be evaluated at compile-time
-//~| ERROR borrowed value does not live long enoug
+//~| ERROR temporary value dropped while borrowed
 
 static EARLY_DROP_S: i32 = (WithDtor, 0).1;
 //~^ ERROR destructors cannot be evaluated at compile-time
diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr
index 9793a1db57f..8a23dad1ba3 100644
--- a/src/test/ui/static/static-drop-scope.stderr
+++ b/src/test/ui/static/static-drop-scope.stderr
@@ -4,15 +4,15 @@ error[E0493]: destructors cannot be evaluated at compile-time
 LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
    |                                                            ^^^^^^^^ statics cannot evaluate destructors
 
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/static-drop-scope.rs:9:60
    |
 LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
-   |                                                            ^^^^^^^^- temporary value only lives until here
-   |                                                            |
-   |                                                            temporary value does not live long enough
-   |
-   = note: borrowed value must be valid for the static lifetime...
+   |                                                      ------^^^^^^^^-
+   |                                                      |     |       |
+   |                                                      |     |       temporary value is freed at the end of this statement
+   |                                                      |     creates a temporary which is freed while still in use
+   |                                                      using this value as a static requires that borrow lasts for `'static`
 
 error[E0493]: destructors cannot be evaluated at compile-time
   --> $DIR/static-drop-scope.rs:13:59
@@ -20,15 +20,15 @@ error[E0493]: destructors cannot be evaluated at compile-time
 LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
    |                                                           ^^^^^^^^ constants cannot evaluate destructors
 
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/static-drop-scope.rs:13:59
    |
 LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
-   |                                                           ^^^^^^^^- temporary value only lives until here
-   |                                                           |
-   |                                                           temporary value does not live long enough
-   |
-   = note: borrowed value must be valid for the static lifetime...
+   |                                                     ------^^^^^^^^-
+   |                                                     |     |       |
+   |                                                     |     |       temporary value is freed at the end of this statement
+   |                                                     |     creates a temporary which is freed while still in use
+   |                                                     using this value as a constant requires that borrow lasts for `'static`
 
 error[E0493]: destructors cannot be evaluated at compile-time
   --> $DIR/static-drop-scope.rs:17:28
@@ -68,4 +68,4 @@ LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
 
 error: aborting due to 10 previous errors
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr
deleted file mode 100644
index 90d728204e7..00000000000
--- a/src/test/ui/static/static-lifetime-bound.nll.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning: unnecessary lifetime parameter `'a`
-  --> $DIR/static-lifetime-bound.rs:1:6
-   |
-LL | fn f<'a: 'static>(_: &'a i32) {}
-   |      ^^^^^^^^^^^
-   |
-   = help: you can use the `'static` lifetime directly, in place of `'a`
-
-error[E0597]: `x` does not live long enough
-  --> $DIR/static-lifetime-bound.rs:5:7
-   |
-LL |     f(&x);
-   |     --^^-
-   |     | |
-   |     | borrowed value does not live long enough
-   |     argument requires that `x` is borrowed for `'static`
-LL | }
-   | - `x` dropped here while still borrowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr
index b9aa4d8722b..90d728204e7 100644
--- a/src/test/ui/static/static-lifetime-bound.stderr
+++ b/src/test/ui/static/static-lifetime-bound.stderr
@@ -7,14 +7,15 @@ LL | fn f<'a: 'static>(_: &'a i32) {}
    = help: you can use the `'static` lifetime directly, in place of `'a`
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/static-lifetime-bound.rs:5:8
+  --> $DIR/static-lifetime-bound.rs:5:7
    |
 LL |     f(&x);
-   |        ^ borrowed value does not live long enough
+   |     --^^-
+   |     | |
+   |     | borrowed value does not live long enough
+   |     argument requires that `x` is borrowed for `'static`
 LL | }
-   | - borrowed value only lives until here
-   |
-   = note: borrowed value must be valid for the static lifetime...
+   | - `x` dropped here while still borrowed
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr
deleted file mode 100644
index 26f214b9781..00000000000
--- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr
+++ /dev/null
@@ -1,47 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/static-reference-to-fn-2.rs:18:22
-   |
-LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
-   |           ----- has type `&mut StateMachineIter<'1>`
-LL |     self_.statefn = &id(state2 as StateMachineFunc);
-   |     -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
-   |     |                |
-   |     |                creates a temporary which is freed while still in use
-   |     assignment requires that borrow lasts for `'1`
-
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/static-reference-to-fn-2.rs:24:22
-   |
-LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
-   |           ----- has type `&mut StateMachineIter<'1>`
-LL |     self_.statefn = &id(state3 as StateMachineFunc);
-   |     -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
-   |     |                |
-   |     |                creates a temporary which is freed while still in use
-   |     assignment requires that borrow lasts for `'1`
-
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/static-reference-to-fn-2.rs:30:22
-   |
-LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
-   |           ----- has type `&mut StateMachineIter<'1>`
-LL |     self_.statefn = &id(finished as StateMachineFunc);
-   |     -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
-   |     |                |
-   |     |                creates a temporary which is freed while still in use
-   |     assignment requires that borrow lasts for `'1`
-
-error[E0515]: cannot return value referencing temporary value
-  --> $DIR/static-reference-to-fn-2.rs:40:5
-   |
-LL | /     StateMachineIter {
-LL | |         statefn: &id(state1 as StateMachineFunc)
-   | |                   ------------------------------ temporary value created here
-LL | |
-LL | |     }
-   | |_____^ returns a value referencing data owned by the current function
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0515, E0716.
-For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/static/static-reference-to-fn-2.rs b/src/test/ui/static/static-reference-to-fn-2.rs
index 8e66532cad9..6693667c091 100644
--- a/src/test/ui/static/static-reference-to-fn-2.rs
+++ b/src/test/ui/static/static-reference-to-fn-2.rs
@@ -16,19 +16,19 @@ impl<'a> Iterator for StateMachineIter<'a> {
 
 fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
     self_.statefn = &id(state2 as StateMachineFunc);
-    //~^ ERROR borrowed value does not live long enough
+    //~^ ERROR temporary value dropped while borrowed
     return Some("state1");
 }
 
 fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
     self_.statefn = &id(state3 as StateMachineFunc);
-    //~^ ERROR borrowed value does not live long enough
+    //~^ ERROR temporary value dropped while borrowed
     return Some("state2");
 }
 
 fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
     self_.statefn = &id(finished as StateMachineFunc);
-    //~^ ERROR borrowed value does not live long enough
+    //~^ ERROR temporary value dropped while borrowed
     return Some("state3");
 }
 
@@ -38,8 +38,8 @@ fn finished(_: &mut StateMachineIter) -> Option<(&'static str)> {
 
 fn state_iter() -> StateMachineIter<'static> {
     StateMachineIter {
+    //~^ ERROR cannot return value referencing temporary value
         statefn: &id(state1 as StateMachineFunc)
-        //~^ ERROR borrowed value does not live long enough
     }
 }
 
diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr
index 17d4a361257..028e11a60ce 100644
--- a/src/test/ui/static/static-reference-to-fn-2.stderr
+++ b/src/test/ui/static/static-reference-to-fn-2.stderr
@@ -1,71 +1,47 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/static-reference-to-fn-2.rs:18:22
    |
+LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
+   |           ----- has type `&mut StateMachineIter<'1>`
 LL |     self_.statefn = &id(state2 as StateMachineFunc);
-   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
-   |                      |
-   |                      temporary value does not live long enough
-   |
-note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 17:1...
-  --> $DIR/static-reference-to-fn-2.rs:17:1
-   |
-LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
-LL | |     self_.statefn = &id(state2 as StateMachineFunc);
-LL | |
-LL | |     return Some("state1");
-LL | | }
-   | |_^
-   = note: consider using a `let` binding to increase its lifetime
+   |     -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+   |     |                |
+   |     |                creates a temporary which is freed while still in use
+   |     assignment requires that borrow lasts for `'1`
 
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/static-reference-to-fn-2.rs:24:22
    |
+LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+   |           ----- has type `&mut StateMachineIter<'1>`
 LL |     self_.statefn = &id(state3 as StateMachineFunc);
-   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
-   |                      |
-   |                      temporary value does not live long enough
-   |
-note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 23:1...
-  --> $DIR/static-reference-to-fn-2.rs:23:1
-   |
-LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
-LL | |     self_.statefn = &id(state3 as StateMachineFunc);
-LL | |
-LL | |     return Some("state2");
-LL | | }
-   | |_^
-   = note: consider using a `let` binding to increase its lifetime
+   |     -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+   |     |                |
+   |     |                creates a temporary which is freed while still in use
+   |     assignment requires that borrow lasts for `'1`
 
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/static-reference-to-fn-2.rs:30:22
    |
+LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+   |           ----- has type `&mut StateMachineIter<'1>`
 LL |     self_.statefn = &id(finished as StateMachineFunc);
-   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
-   |                      |
-   |                      temporary value does not live long enough
-   |
-note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 29:1...
-  --> $DIR/static-reference-to-fn-2.rs:29:1
-   |
-LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
-LL | |     self_.statefn = &id(finished as StateMachineFunc);
-LL | |
-LL | |     return Some("state3");
-LL | | }
-   | |_^
-   = note: consider using a `let` binding to increase its lifetime
+   |     -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
+   |     |                |
+   |     |                creates a temporary which is freed while still in use
+   |     assignment requires that borrow lasts for `'1`
 
-error[E0597]: borrowed value does not live long enough
-  --> $DIR/static-reference-to-fn-2.rs:41:19
+error[E0515]: cannot return value referencing temporary value
+  --> $DIR/static-reference-to-fn-2.rs:40:5
    |
-LL |         statefn: &id(state1 as StateMachineFunc)
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
-...
-LL | }
-   | - temporary value only lives until here
-   |
-   = note: borrowed value must be valid for the static lifetime...
+LL | /     StateMachineIter {
+LL | |
+LL | |         statefn: &id(state1 as StateMachineFunc)
+   | |                   ------------------------------ temporary value created here
+LL | |     }
+   | |_____^ returns a value referencing data owned by the current function
 
 error: aborting due to 4 previous errors
 
-For more information about this error, try `rustc --explain E0597`.
+Some errors have detailed explanations: E0515, E0716.
+For more information about an error, try `rustc --explain E0515`.
diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr
deleted file mode 100644
index 15261259ed4..00000000000
--- a/src/test/ui/static/static-region-bound.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0716]: temporary value dropped while borrowed
-  --> $DIR/static-region-bound.rs:10:14
-   |
-LL |     let x = &id(3);
-   |              ^^^^^ creates a temporary which is freed while still in use
-LL |     f(x);
-   |     ---- argument requires that borrow lasts for `'static`
-LL | }
-   | - temporary value is freed at the end of this statement
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/static/static-region-bound.rs b/src/test/ui/static/static-region-bound.rs
index ee411370d15..f133133b336 100644
--- a/src/test/ui/static/static-region-bound.rs
+++ b/src/test/ui/static/static-region-bound.rs
@@ -7,6 +7,6 @@ fn f<T:'static>(_: T) {}
 fn main() {
     let x: Box<_> = box 3;
     f(x);
-    let x = &id(3); //~ ERROR borrowed value does not live long enough
+    let x = &id(3); //~ ERROR temporary value dropped while borrowed
     f(x);
 }
diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr
index f6bbfcecf6f..15261259ed4 100644
--- a/src/test/ui/static/static-region-bound.stderr
+++ b/src/test/ui/static/static-region-bound.stderr
@@ -1,14 +1,13 @@
-error[E0597]: borrowed value does not live long enough
+error[E0716]: temporary value dropped while borrowed
   --> $DIR/static-region-bound.rs:10:14
    |
 LL |     let x = &id(3);
-   |              ^^^^^ temporary value does not live long enough
+   |              ^^^^^ creates a temporary which is freed while still in use
 LL |     f(x);
+   |     ---- argument requires that borrow lasts for `'static`
 LL | }
-   | - temporary value only lives until here
-   |
-   = note: borrowed value must be valid for the static lifetime...
+   | - temporary value is freed at the end of this statement
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0716`.