about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2018-04-11 00:38:35 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2018-04-11 00:38:35 +0200
commit746d63a203174f6c91396230b86f6b4fbda507c4 (patch)
treeb3c5dfb1680ac349556a35195d521ac84bbb4bbc /src/test/ui/error-codes
parent1c8d2bdda16854743069988fdb50a0185dfcb472 (diff)
downloadrust-746d63a203174f6c91396230b86f6b4fbda507c4.tar.gz
rust-746d63a203174f6c91396230b86f6b4fbda507c4.zip
Checkpoint the current status of NLL on `ui` tests via compare-mode=nll.
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0017.nll.stderr28
-rw-r--r--src/test/ui/error-codes/E0161.nll.stderr16
-rw-r--r--src/test/ui/error-codes/E0388.nll.stderr28
-rw-r--r--src/test/ui/error-codes/E0389.nll.stderr11
-rw-r--r--src/test/ui/error-codes/E0499.nll.stderr12
-rw-r--r--src/test/ui/error-codes/E0502.nll.stderr9
-rw-r--r--src/test/ui/error-codes/E0503.nll.stderr12
-rw-r--r--src/test/ui/error-codes/E0504.nll.stderr18
-rw-r--r--src/test/ui/error-codes/E0505.nll.stderr14
-rw-r--r--src/test/ui/error-codes/E0509.nll.stderr9
-rw-r--r--src/test/ui/error-codes/E0597.nll.stderr13
-rw-r--r--src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr14
12 files changed, 184 insertions, 0 deletions
diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr
new file mode 100644
index 00000000000..ec31f5d05d7
--- /dev/null
+++ b/src/test/ui/error-codes/E0017.nll.stderr
@@ -0,0 +1,28 @@
+error[E0017]: references in constants may only refer to immutable values
+  --> $DIR/E0017.rs:14:30
+   |
+LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                              ^^^^^^ constants require immutable values
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0017.rs:15:39
+   |
+LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                       ^^^^^^ statics require immutable values
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0017.rs:17:38
+   |
+LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                                      ^^^^^^ statics require immutable values
+
+error[E0596]: cannot borrow immutable item `X` as mutable
+  --> $DIR/E0017.rs:15:39
+   |
+LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                       ^^^^^^ cannot borrow as mutable
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0017, E0596.
+For more information about an error, try `rustc --explain E0017`.
diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr
new file mode 100644
index 00000000000..6aaff743383
--- /dev/null
+++ b/src/test/ui/error-codes/E0161.nll.stderr
@@ -0,0 +1,16 @@
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/E0161.rs:14:28
+   |
+LL |     let _x: Box<str> = box *"hello"; //~ ERROR E0161
+   |                            ^^^^^^^^ cannot move out of borrowed content
+
+error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
+  --> $DIR/E0161.rs:14:28
+   |
+LL |     let _x: Box<str> = box *"hello"; //~ ERROR E0161
+   |                            ^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0161, E0507.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr
new file mode 100644
index 00000000000..6a4bd6b31a1
--- /dev/null
+++ b/src/test/ui/error-codes/E0388.nll.stderr
@@ -0,0 +1,28 @@
+error[E0017]: references in constants may only refer to immutable values
+  --> $DIR/E0388.rs:14:30
+   |
+LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                              ^^^^^^ constants require immutable values
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0388.rs:15:39
+   |
+LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                       ^^^^^^ statics require immutable values
+
+error[E0017]: references in statics may only refer to immutable values
+  --> $DIR/E0388.rs:17:38
+   |
+LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
+   |                                      ^^^^^^ statics require immutable values
+
+error[E0596]: cannot borrow immutable item `X` as mutable
+  --> $DIR/E0388.rs:15:39
+   |
+LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
+   |                                       ^^^^^^ cannot borrow as mutable
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0017, E0596.
+For more information about an error, try `rustc --explain E0017`.
diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr
new file mode 100644
index 00000000000..13ba653a5ca
--- /dev/null
+++ b/src/test/ui/error-codes/E0389.nll.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to immutable item `fancy_ref.num`
+  --> $DIR/E0389.rs:18:5
+   |
+LL |     fancy_ref.num = 6; //~ ERROR E0389
+   |     ^^^^^^^^^^^^^^^^^ cannot mutate
+   |
+   = note: Value not mutable causing this error: `*fancy_ref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr
new file mode 100644
index 00000000000..27a71df147e
--- /dev/null
+++ b/src/test/ui/error-codes/E0499.nll.stderr
@@ -0,0 +1,12 @@
+error: compilation successful
+  --> $DIR/E0499.rs:11:1
+   |
+LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | |     let mut i = 0;
+LL | |     let mut x = &mut i;
+LL | |     let mut a = &mut i; //~ ERROR E0499
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr
new file mode 100644
index 00000000000..67a08661040
--- /dev/null
+++ b/src/test/ui/error-codes/E0502.nll.stderr
@@ -0,0 +1,9 @@
+error: compilation successful
+  --> $DIR/E0502.rs:17:1
+   |
+LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr
new file mode 100644
index 00000000000..6c5e99d8769
--- /dev/null
+++ b/src/test/ui/error-codes/E0503.nll.stderr
@@ -0,0 +1,12 @@
+error: compilation successful
+  --> $DIR/E0503.rs:11:1
+   |
+LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | |     let mut value = 3;
+LL | |     let _borrow = &mut value;
+LL | |     let _sum = value + 1; //~ ERROR E0503
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr
new file mode 100644
index 00000000000..ec30bb306fc
--- /dev/null
+++ b/src/test/ui/error-codes/E0504.nll.stderr
@@ -0,0 +1,18 @@
+error[E0505]: cannot move out of `fancy_num` because it is borrowed
+  --> $DIR/E0504.rs:19:13
+   |
+LL |       let fancy_ref = &fancy_num;
+   |                       ---------- borrow of `fancy_num` occurs here
+LL | 
+LL |       let x = move || {
+   |  _____________^
+LL | |         println!("child function: {}", fancy_num.num); //~ ERROR E0504
+LL | |     };
+   | |_____^ move out of `fancy_num` occurs here
+...
+LL |       println!("main function: {}", fancy_ref.num);
+   |                                     ------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr
new file mode 100644
index 00000000000..556e0c73d1a
--- /dev/null
+++ b/src/test/ui/error-codes/E0505.nll.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+  --> $DIR/E0505.rs:15:1
+   |
+LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | |     let x = Value{};
+LL | |     {
+LL | |         let _ref_to_val: &Value = &x;
+LL | |         eat(x); //~ ERROR E0505
+LL | |     }
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr
new file mode 100644
index 00000000000..56d970494a0
--- /dev/null
+++ b/src/test/ui/error-codes/E0509.nll.stderr
@@ -0,0 +1,9 @@
+error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait
+  --> $DIR/E0509.rs:26:23
+   |
+LL |     let fancy_field = drop_struct.fancy; //~ ERROR E0509
+   |                       ^^^^^^^^^^^^^^^^^ cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr
new file mode 100644
index 00000000000..56119e4226e
--- /dev/null
+++ b/src/test/ui/error-codes/E0597.nll.stderr
@@ -0,0 +1,13 @@
+error: compilation successful
+  --> $DIR/E0597.rs:15:1
+   |
+LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | |     let mut x = Foo { x: None };
+LL | |     let y = 0;
+LL | |     x.x = Some(&y);
+LL | |     //~^ `y` does not live long enough [E0597]
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
new file mode 100644
index 00000000000..e9f09795691
--- /dev/null
+++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
@@ -0,0 +1,14 @@
+warning: not reporting region error due to -Znll
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5
+   |
+LL |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |     ^^^^^^
+
+error: free region `` does not outlive free region `'_#2r`
+  --> $DIR/E0621-does-not-trigger-for-closures.rs:25:26
+   |
+LL |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
+   |                          ^^^^^
+
+error: aborting due to previous error
+