]> git.lizzy.rs Git - rust.git/commitdiff
fixed multi-span test
authorAndre Bogus <bogusandre@gmail.com>
Sun, 12 Feb 2017 14:10:25 +0000 (15:10 +0100)
committerAndre Bogus <bogusandre@gmail.com>
Sun, 12 Feb 2017 14:10:25 +0000 (15:10 +0100)
tests/ui/mut_from_ref.rs
tests/ui/mut_from_ref.stderr

index 1bb6bea66f614eeb55a36dc0d1c9f16e50c8cae4..35bff9371d9e2fdb697184260ce0baee3f3abcbe 100644 (file)
@@ -29,7 +29,7 @@ fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 {
     unimplemented!()
 }
 
-fn fail_double<'a>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
+fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
     unimplemented!()
 }
 
index 5f9cee2af0d4680627d8ee7ce61633ee3383cb5a..5098d7d0ab562c573d11cf071cf6c09ed17c06c2 100644 (file)
@@ -1,8 +1,67 @@
-error[E0261]: use of undeclared lifetime name `'b`
-  --> $DIR/mut_from_ref.rs:32:48
+error: mutable borrow from immutable input(s)
+ --> $DIR/mut_from_ref.rs:9:39
+  |
+9 |     fn this_wont_hurt_a_bit(&self) -> &mut Foo {
+  |                                       ^^^^^^^^
+  |
+note: lint level defined here
+ --> $DIR/mut_from_ref.rs:4:9
+  |
+4 | #![deny(mut_from_ref)]
+  |         ^^^^^^^^^^^^
+note: immutable borrow here
+ --> $DIR/mut_from_ref.rs:9:29
+  |
+9 |     fn this_wont_hurt_a_bit(&self) -> &mut Foo {
+  |                             ^^^^^
+
+error: mutable borrow from immutable input(s)
+  --> $DIR/mut_from_ref.rs:15:25
+   |
+15 |     fn ouch(x: &Foo) -> &mut Foo;
+   |                         ^^^^^^^^
+   |
+note: immutable borrow here
+  --> $DIR/mut_from_ref.rs:15:16
+   |
+15 |     fn ouch(x: &Foo) -> &mut Foo;
+   |                ^^^^
+
+error: mutable borrow from immutable input(s)
+  --> $DIR/mut_from_ref.rs:24:21
+   |
+24 | fn fail(x: &u32) -> &mut u16 {
+   |                     ^^^^^^^^
+   |
+note: immutable borrow here
+  --> $DIR/mut_from_ref.rs:24:12
+   |
+24 | fn fail(x: &u32) -> &mut u16 {
+   |            ^^^^
+
+error: mutable borrow from immutable input(s)
+  --> $DIR/mut_from_ref.rs:28:50
+   |
+28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 {
+   |                                                  ^^^^^^^^^^^
+   |
+note: immutable borrow here
+  --> $DIR/mut_from_ref.rs:28:25
+   |
+28 | fn fail_lifetime<'a>(x: &'a u32, y: &mut u32) -> &'a mut u32 {
+   |                         ^^^^^^^
+
+error: mutable borrow from immutable input(s)
+  --> $DIR/mut_from_ref.rs:32:67
+   |
+32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
+   |                                                                   ^^^^^^^^^^^
+   |
+note: immutable borrow here
+  --> $DIR/mut_from_ref.rs:32:27
    |
-32 | fn fail_double<'a>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
-   |                                                ^^ undeclared lifetime
+32 | fn fail_double<'a, 'b>(x: &'a u32, y: &'a u32, z: &'b mut u32) -> &'a mut u32 {
+   |                           ^^^^^^^     ^^^^^^^
 
-error: aborting due to previous error
+error: aborting due to 5 previous errors