diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-06-12 18:01:48 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-06-19 19:38:37 +0200 |
| commit | 2d4df5b53e92513ddd250be545ff7c015135451b (patch) | |
| tree | 88f05e26284de6b1fdc66621d44916efbf95bec1 /src/test/ui/span | |
| parent | 7fd4b52b1b83195594ef88c193fdd409b68f19ef (diff) | |
| download | rust-2d4df5b53e92513ddd250be545ff7c015135451b.tar.gz rust-2d4df5b53e92513ddd250be545ff7c015135451b.zip | |
NLL: Updates to diagnostic output in `test/ui`.
Diffstat (limited to 'src/test/ui/span')
7 files changed, 59 insertions, 18 deletions
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr index 172828b9a40..3282fbba6c5 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr @@ -1,50 +1,66 @@ error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:63:24 | +LL | fn deref_mut_field1(x: Own<Point>) { + | - help: consider changing this to be mutable: `mut x` LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:75:10 | +LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize { + | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>` LL | &mut x.y //~ ERROR cannot borrow - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5 | +LL | fn assign_field1<'a>(x: Own<Point>) { + | - help: consider changing this to be mutable: `mut x` LL | x.y = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:102:5 | +LL | fn assign_field2<'a>(x: &'a Own<Point>) { + | -------------- help: consider changing this to be a mutable reference: `&mut Own<Point>` LL | x.y = 3; //~ ERROR cannot borrow - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5 | +LL | fn deref_mut_method1(x: Own<Point>) { + | - help: consider changing this to be mutable: `mut x` LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:131:5 | +LL | fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize { + | ----------- help: consider changing this to be a mutable reference: `&mut Own<Point>` LL | x.y_mut() //~ ERROR cannot borrow - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:139:6 | +LL | fn assign_method1<'a>(x: Own<Point>) { + | - help: consider changing this to be mutable: `mut x` LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:143:6 | +LL | fn assign_method2<'a>(x: &'a Own<Point>) { + | -------------- help: consider changing this to be a mutable reference: `&mut Own<Point>` LL | *x.y_mut() = 3; //~ ERROR cannot borrow - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 8 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr index 24abe85de76..0b1bfd8cee6 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr @@ -1,26 +1,34 @@ error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:39:25 | +LL | fn deref_mut1(x: Own<isize>) { + | - help: consider changing this to be mutable: `mut x` LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:51:11 | +LL | fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize { + | -------------- help: consider changing this to be a mutable reference: `&mut Own<isize>` LL | &mut **x //~ ERROR cannot borrow - | ^^ cannot borrow as mutable + | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `x` as mutable --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:59:6 | +LL | fn assign1<'a>(x: Own<isize>) { + | - help: consider changing this to be mutable: `mut x` LL | *x = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:63:6 | +LL | fn assign2<'a>(x: &'a Own<isize>) { + | -------------- help: consider changing this to be a mutable reference: `&mut Own<isize>` LL | **x = 3; //~ ERROR cannot borrow - | ^^ cannot borrow as mutable + | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 4 previous errors diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr index 26e9ea4dc0b..c4bdef21de4 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr @@ -15,16 +15,18 @@ LL | | })); error[E0596]: cannot borrow immutable item `*f` as mutable --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5 | +LL | fn test2<F>(f: &F) where F: FnMut() { + | -- help: consider changing this to be a mutable reference: `&mut F` LL | (*f)(); - | ^^^^ cannot borrow as mutable + | ^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `*f.f` as mutable --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5 | +LL | fn test4(f: &Test) { + | ----- help: consider changing this to be a mutable reference: `&mut Test<'_>` LL | f.f.call_mut(()) - | ^^^ cannot borrow as mutable - | - = note: the value which is causing this path not to be mutable is...: `*f` + | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13 diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr index 43934bf4aee..0bc614589e3 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr @@ -1,8 +1,11 @@ error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-call-method-from-mut-aliasable.rs:27:5 | +LL | fn b(x: &Foo) { + | ---- help: consider changing this to be a mutable reference: `&mut Foo` +LL | x.f(); LL | x.h(); //~ ERROR cannot borrow - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr b/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr index d3c6fd66599..1cb2c92833c 100644 --- a/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr +++ b/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr @@ -1,8 +1,10 @@ error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-fn-in-const-b.rs:17:9 | +LL | fn broken(x: &Vec<String>) { + | ------------ help: consider changing this to be a mutable reference: `&mut std::vec::Vec<std::string::String>` LL | x.push(format!("this is broken")); - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr index 9b5e084bd37..cf615eed556 100644 --- a/src/test/ui/span/borrowck-object-mutability.nll.stderr +++ b/src/test/ui/span/borrowck-object-mutability.nll.stderr @@ -1,16 +1,20 @@ error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-object-mutability.rs:19:5 | +LL | fn borrowed_receiver(x: &Foo) { + | ---- help: consider changing this to be a mutable reference: `&mut Foo` +LL | x.borrowed(); LL | x.borrowed_mut(); //~ ERROR cannot borrow - | ^ cannot borrow as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `*x` as mutable --> $DIR/borrowck-object-mutability.rs:29:5 | +LL | fn owned_receiver(x: Box<Foo>) { + | - help: consider changing this to be mutable: `mut x` +LL | x.borrowed(); LL | x.borrowed_mut(); //~ ERROR cannot borrow | ^ cannot borrow as mutable - | - = note: the value which is causing this path not to be mutable is...: `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/span/mut-arg-hint.nll.stderr b/src/test/ui/span/mut-arg-hint.nll.stderr index 8e1cb9720e2..cd19059fdae 100644 --- a/src/test/ui/span/mut-arg-hint.nll.stderr +++ b/src/test/ui/span/mut-arg-hint.nll.stderr @@ -1,20 +1,26 @@ error[E0596]: cannot borrow immutable item `*a` as mutable --> $DIR/mut-arg-hint.rs:13:9 | +LL | fn foo(mut a: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content - | ^ cannot borrow as mutable + | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `*a` as mutable --> $DIR/mut-arg-hint.rs:18:5 | +LL | pub fn foo<'a>(mut a: &'a String) { + | ---------- help: consider changing this to be a mutable reference: `&mut std::string::String` LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content - | ^ cannot borrow as mutable + | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow immutable item `*a` as mutable --> $DIR/mut-arg-hint.rs:25:9 | +LL | pub fn foo(mut a: &String) { + | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content - | ^ cannot borrow as mutable + | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors |
