mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +00:00
Add new error codes and update tests
This commit is contained in:
parent
8be89f534a
commit
998b19740c
@ -165,18 +165,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
.. }) => {
|
||||
let tcx = self.tcx;
|
||||
|
||||
let mut err = self.type_error_struct(span,
|
||||
|actual| {
|
||||
format!("no {} named `{}` found for type `{}` in the current scope",
|
||||
if mode == Mode::MethodCall {
|
||||
"method"
|
||||
} else {
|
||||
"associated item"
|
||||
},
|
||||
item_name,
|
||||
actual)
|
||||
},
|
||||
rcvr_ty);
|
||||
let actual = self.resolve_type_vars_if_possible(&rcvr_ty);
|
||||
let mut err = if !actual.references_error() {
|
||||
struct_span_err!(tcx.sess, span, E0599,
|
||||
"no {} named `{}` found for type `{}` in the \
|
||||
current scope",
|
||||
if mode == Mode::MethodCall {
|
||||
"method"
|
||||
} else {
|
||||
"associated item"
|
||||
},
|
||||
item_name,
|
||||
self.ty_to_string(actual))
|
||||
} else {
|
||||
self.tcx.sess.diagnostic().struct_dummy()
|
||||
};
|
||||
|
||||
// If the method name is the name of a field with a function or closure type,
|
||||
// give a helping note that it has to be called as (x.f)(...).
|
||||
|
@ -4005,7 +4005,7 @@ details.
|
||||
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
|
||||
"##,
|
||||
|
||||
E0582: r##"
|
||||
E0582: r##"
|
||||
A lifetime appears only in an associated-type binding,
|
||||
and not in the input types to the trait.
|
||||
|
||||
@ -4042,6 +4042,16 @@ details.
|
||||
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
|
||||
"##,
|
||||
|
||||
E0599: r##"
|
||||
```compile_fail,E0599
|
||||
struct Mouth;
|
||||
|
||||
let x = Mouth;
|
||||
x.chocolate(); // error: no method named `chocolate` found for type `Mouth`
|
||||
// in the current scope
|
||||
```
|
||||
"##,
|
||||
|
||||
}
|
||||
|
||||
register_diagnostics! {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable local variable `x` as mutable
|
||||
error[E0596]: cannot borrow immutable local variable `x` as mutable
|
||||
--> $DIR/huge_multispan_highlight.rs:100:18
|
||||
|
|
||||
12 | let x = "foo";
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable argument `self` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `self` as mutable
|
||||
--> $DIR/issue-31424.rs:17:15
|
||||
|
|
||||
17 | (&mut self).bar();
|
||||
@ -7,7 +7,7 @@ error: cannot borrow immutable argument `self` as mutable
|
||||
| try removing `&mut` here
|
||||
| cannot reborrow mutably
|
||||
|
||||
error: cannot borrow immutable argument `self` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `self` as mutable
|
||||
--> $DIR/issue-31424.rs:23:15
|
||||
|
|
||||
22 | fn bar(self: &mut Self) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable argument `self` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `self` as mutable
|
||||
--> $DIR/issue-34126.rs:16:23
|
||||
|
|
||||
16 | self.run(&mut self);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable local variable `key` as mutable
|
||||
error[E0596]: cannot borrow immutable local variable `key` as mutable
|
||||
--> $DIR/issue-34337.rs:16:14
|
||||
|
|
||||
16 | get(&mut key);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable field `f.v` as mutable
|
||||
error[E0596]: cannot borrow immutable field `f.v` as mutable
|
||||
--> $DIR/issue-35937.rs:17:5
|
||||
|
|
||||
16 | let f = Foo { v: Vec::new() };
|
||||
@ -6,7 +6,7 @@ error: cannot borrow immutable field `f.v` as mutable
|
||||
17 | f.v.push("cat".to_string());
|
||||
| ^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot assign to immutable field `s.x`
|
||||
error[E0594]: cannot assign to immutable field `s.x`
|
||||
--> $DIR/issue-35937.rs:26:5
|
||||
|
|
||||
25 | let s = S { x: 42 };
|
||||
@ -14,7 +14,7 @@ error: cannot assign to immutable field `s.x`
|
||||
26 | s.x += 1;
|
||||
| ^^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot assign to immutable field `s.x`
|
||||
error[E0594]: cannot assign to immutable field `s.x`
|
||||
--> $DIR/issue-35937.rs:30:5
|
||||
|
|
||||
29 | fn bar(s: S) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable local variable `x` as mutable
|
||||
error[E0596]: cannot borrow immutable local variable `x` as mutable
|
||||
--> $DIR/issue-37139.rs:22:23
|
||||
|
|
||||
22 | test(&mut x);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*self.s` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*self.s` as mutable
|
||||
--> $DIR/issue-38147-2.rs:17:9
|
||||
|
|
||||
12 | s: &'a String
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*self.s` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*self.s` as mutable
|
||||
--> $DIR/issue-38147-3.rs:17:9
|
||||
|
|
||||
12 | s: &'a String
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable field `z.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `z.x` as mutable
|
||||
--> $DIR/issue-39544.rs:21:18
|
||||
|
|
||||
20 | let z = Z { x: X::Y };
|
||||
@ -6,7 +6,7 @@ error: cannot borrow immutable field `z.x` as mutable
|
||||
21 | let _ = &mut z.x;
|
||||
| ^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `self.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
||||
--> $DIR/issue-39544.rs:26:22
|
||||
|
|
||||
25 | fn foo<'z>(&'z self) {
|
||||
@ -14,7 +14,7 @@ error: cannot borrow immutable field `self.x` as mutable
|
||||
26 | let _ = &mut self.x;
|
||||
| ^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `self.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
||||
--> $DIR/issue-39544.rs:30:22
|
||||
|
|
||||
29 | fn foo1(&self, other: &Z) {
|
||||
@ -22,7 +22,7 @@ error: cannot borrow immutable field `self.x` as mutable
|
||||
30 | let _ = &mut self.x;
|
||||
| ^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `other.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
||||
--> $DIR/issue-39544.rs:31:22
|
||||
|
|
||||
29 | fn foo1(&self, other: &Z) {
|
||||
@ -31,7 +31,7 @@ error: cannot borrow immutable field `other.x` as mutable
|
||||
31 | let _ = &mut other.x;
|
||||
| ^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `self.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
||||
--> $DIR/issue-39544.rs:35:22
|
||||
|
|
||||
34 | fn foo2<'a>(&'a self, other: &Z) {
|
||||
@ -39,7 +39,7 @@ error: cannot borrow immutable field `self.x` as mutable
|
||||
35 | let _ = &mut self.x;
|
||||
| ^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `other.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
||||
--> $DIR/issue-39544.rs:36:22
|
||||
|
|
||||
34 | fn foo2<'a>(&'a self, other: &Z) {
|
||||
@ -48,7 +48,7 @@ error: cannot borrow immutable field `other.x` as mutable
|
||||
36 | let _ = &mut other.x;
|
||||
| ^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `self.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
||||
--> $DIR/issue-39544.rs:40:22
|
||||
|
|
||||
39 | fn foo3<'a>(self: &'a Self, other: &Z) {
|
||||
@ -56,7 +56,7 @@ error: cannot borrow immutable field `self.x` as mutable
|
||||
40 | let _ = &mut self.x;
|
||||
| ^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `other.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
||||
--> $DIR/issue-39544.rs:41:22
|
||||
|
|
||||
39 | fn foo3<'a>(self: &'a Self, other: &Z) {
|
||||
@ -65,7 +65,7 @@ error: cannot borrow immutable field `other.x` as mutable
|
||||
41 | let _ = &mut other.x;
|
||||
| ^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `other.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
||||
--> $DIR/issue-39544.rs:45:22
|
||||
|
|
||||
44 | fn foo4(other: &Z) {
|
||||
@ -73,7 +73,7 @@ error: cannot borrow immutable field `other.x` as mutable
|
||||
45 | let _ = &mut other.x;
|
||||
| ^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `z.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `z.x` as mutable
|
||||
--> $DIR/issue-39544.rs:51:18
|
||||
|
|
||||
50 | pub fn with_arg(z: Z, w: &Z) {
|
||||
@ -81,7 +81,7 @@ error: cannot borrow immutable field `z.x` as mutable
|
||||
51 | let _ = &mut z.x;
|
||||
| ^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot borrow immutable field `w.x` as mutable
|
||||
error[E0596]: cannot borrow immutable field `w.x` as mutable
|
||||
--> $DIR/issue-39544.rs:52:18
|
||||
|
|
||||
50 | pub fn with_arg(z: Z, w: &Z) {
|
||||
@ -90,7 +90,7 @@ error: cannot borrow immutable field `w.x` as mutable
|
||||
52 | let _ = &mut w.x;
|
||||
| ^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: cannot assign to immutable borrowed content `*x.0`
|
||||
error[E0594]: cannot assign to immutable borrowed content `*x.0`
|
||||
--> $DIR/issue-39544.rs:58:5
|
||||
|
|
||||
58 | *x.0 = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*buf` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable
|
||||
--> $DIR/issue-40823.rs:13:5
|
||||
|
|
||||
13 | buf.iter_mut();
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
||||
|
|
||||
39 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
|
||||
@ -9,7 +9,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
||||
|
|
||||
40 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
|
||||
@ -20,7 +20,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
||||
|
|
||||
47 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
|
||||
@ -31,7 +31,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
||||
|
|
||||
48 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
||||
|
|
||||
57 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
|
||||
@ -9,7 +9,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
||||
|
|
||||
58 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
|
||||
@ -20,7 +20,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
||||
|
|
||||
65 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
|
||||
@ -31,7 +31,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
||||
|
|
||||
66 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch.rs:96:1
|
||||
|
|
||||
80 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
|
||||
@ -9,7 +9,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch.rs:96:1
|
||||
|
|
||||
81 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
|
||||
@ -20,7 +20,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch.rs:96:1
|
||||
|
|
||||
88 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
|
||||
@ -31,7 +31,7 @@ error: `c` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/dropck-eyepatch.rs:96:1
|
||||
|
|
||||
89 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `f` found for type `{integer}` in the current scope
|
||||
error[E0599]: no method named `f` found for type `{integer}` in the current scope
|
||||
--> $DIR/issue_41652.rs:19:11
|
||||
|
|
||||
19 | 3.f()
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowck-let-suggestion.rs:12:23
|
||||
|
|
||||
12 | let x = [1].iter();
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `fake` found for type `{integer}` in the current scope
|
||||
error[E0599]: no method named `fake` found for type `{integer}` in the current scope
|
||||
--> $DIR/macro-backtrace-invalid-internals.rs:15:13
|
||||
|
|
||||
15 | 1.fake()
|
||||
@ -25,7 +25,7 @@ error: attempted tuple index `0` on type `{integer}`, but the type was not a tup
|
||||
52 | fake_anon_field_stmt!();
|
||||
| ------------------------ in this macro invocation
|
||||
|
||||
error: no method named `fake` found for type `{integer}` in the current scope
|
||||
error[E0599]: no method named `fake` found for type `{integer}` in the current scope
|
||||
--> $DIR/macro-backtrace-invalid-internals.rs:33:13
|
||||
|
|
||||
33 | 1.fake()
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope
|
||||
error[E0599]: no method named `count` found for type `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope
|
||||
--> $DIR/issue-36053-2.rs:17:55
|
||||
|
|
||||
17 | once::<&str>("str").fuse().filter(|a: &str| true).count();
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `unwrap` found for type `std::result::Result<(), Foo>` in the current scope
|
||||
error[E0599]: no method named `unwrap` found for type `std::result::Result<(), Foo>` in the current scope
|
||||
--> $DIR/method-help-unsatisfied-bound.rs:15:7
|
||||
|
|
||||
15 | a.unwrap();
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable argument `x` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:63:24
|
||||
|
|
||||
62 | fn deref_mut_field1(x: Own<Point>) {
|
||||
@ -6,7 +6,7 @@ error: cannot borrow immutable argument `x` as mutable
|
||||
63 | let __isize = &mut x.y; //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:75:10
|
||||
|
|
||||
74 | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
|
||||
@ -24,7 +24,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time
|
||||
89 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error: cannot borrow immutable argument `x` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5
|
||||
|
|
||||
97 | fn assign_field1<'a>(x: Own<Point>) {
|
||||
@ -32,7 +32,7 @@ error: cannot borrow immutable argument `x` as mutable
|
||||
98 | x.y = 3; //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:102:5
|
||||
|
|
||||
101 | fn assign_field2<'a>(x: &'a Own<Point>) {
|
||||
@ -50,7 +50,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time
|
||||
112 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error: cannot borrow immutable argument `x` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5
|
||||
|
|
||||
118 | fn deref_mut_method1(x: Own<Point>) {
|
||||
@ -58,7 +58,7 @@ error: cannot borrow immutable argument `x` as mutable
|
||||
119 | x.set(0, 0); //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:131:5
|
||||
|
|
||||
130 | fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize {
|
||||
@ -66,7 +66,7 @@ error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
131 | x.y_mut() //~ ERROR cannot borrow
|
||||
| ^ cannot borrow as mutable
|
||||
|
||||
error: cannot borrow immutable argument `x` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:139:6
|
||||
|
|
||||
138 | fn assign_method1<'a>(x: Own<Point>) {
|
||||
@ -74,7 +74,7 @@ error: cannot borrow immutable argument `x` as mutable
|
||||
139 | *x.y_mut() = 3; //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:143:6
|
||||
|
|
||||
142 | fn assign_method2<'a>(x: &'a Own<Point>) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable argument `x` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:39:25
|
||||
|
|
||||
38 | fn deref_mut1(x: Own<isize>) {
|
||||
@ -6,7 +6,7 @@ error: cannot borrow immutable argument `x` as mutable
|
||||
39 | let __isize = &mut *x; //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:51:11
|
||||
|
|
||||
50 | fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize {
|
||||
@ -14,7 +14,7 @@ error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
51 | &mut **x //~ ERROR cannot borrow
|
||||
| ^^ cannot borrow as mutable
|
||||
|
||||
error: cannot borrow immutable argument `x` as mutable
|
||||
error[E0596]: cannot borrow immutable argument `x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:59:6
|
||||
|
|
||||
58 | fn assign1<'a>(x: Own<isize>) {
|
||||
@ -22,7 +22,7 @@ error: cannot borrow immutable argument `x` as mutable
|
||||
59 | *x = 3; //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-borrow-overloaded-deref-mut.rs:63:6
|
||||
|
|
||||
62 | fn assign2<'a>(x: &'a Own<isize>) {
|
||||
|
@ -11,7 +11,7 @@ error[E0499]: cannot borrow `f` as mutable more than once at a time
|
||||
27 | }));
|
||||
| - first borrow ends here
|
||||
|
||||
error: cannot borrow immutable borrowed content `*f` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*f` as mutable
|
||||
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:39:5
|
||||
|
|
||||
37 | fn test2<F>(f: &F) where F: FnMut() {
|
||||
@ -20,7 +20,7 @@ error: cannot borrow immutable borrowed content `*f` as mutable
|
||||
39 | (*f)();
|
||||
| ^^^^ cannot borrow as mutable
|
||||
|
||||
error: cannot borrow immutable `Box` content `*f.f` as mutable
|
||||
error[E0596]: cannot borrow immutable `Box` content `*f.f` as mutable
|
||||
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:50:5
|
||||
|
|
||||
48 | fn test4(f: &Test) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-call-method-from-mut-aliasable.rs:27:5
|
||||
|
|
||||
25 | fn b(x: &Foo) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-fn-in-const-b.rs:17:9
|
||||
|
|
||||
16 | fn broken(x: &Vec<String>) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `young[..]` does not live long enough
|
||||
error[E0597]: `young[..]` does not live long enough
|
||||
--> $DIR/borrowck-let-suggestion-suffixes.rs:52:1
|
||||
|
|
||||
19 | v2.push(&young[0]); // statement 4
|
||||
@ -9,7 +9,7 @@ error: `young[..]` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowck-let-suggestion-suffixes.rs:24:18
|
||||
|
|
||||
24 | v3.push(&'x'); // statement 6
|
||||
@ -22,7 +22,7 @@ error: borrowed value does not live long enough
|
||||
|
|
||||
= note: consider using a `let` binding to increase its lifetime
|
||||
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowck-let-suggestion-suffixes.rs:34:22
|
||||
|
|
||||
34 | v4.push(&'y');
|
||||
@ -35,7 +35,7 @@ error: borrowed value does not live long enough
|
||||
|
|
||||
= note: consider using a `let` binding to increase its lifetime
|
||||
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowck-let-suggestion-suffixes.rs:45:18
|
||||
|
|
||||
45 | v5.push(&'z');
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
|
||||
--> $DIR/borrowck-object-mutability.rs:19:5
|
||||
|
|
||||
17 | fn borrowed_receiver(x: &Foo) {
|
||||
@ -7,7 +7,7 @@ error: cannot borrow immutable borrowed content `*x` as mutable
|
||||
19 | x.borrowed_mut(); //~ ERROR cannot borrow
|
||||
| ^ cannot borrow as mutable
|
||||
|
||||
error: cannot borrow immutable `Box` content `*x` as mutable
|
||||
error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
|
||||
--> $DIR/borrowck-object-mutability.rs:29:5
|
||||
|
|
||||
27 | fn owned_receiver(x: Box<Foo>) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowck-ref-into-rvalue.rs:18:5
|
||||
|
|
||||
14 | Some(ref m) => { //~ ERROR borrowed value does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `*a` does not live long enough
|
||||
error[E0597]: `*a` does not live long enough
|
||||
--> $DIR/destructor-restrictions.rs:19:5
|
||||
|
|
||||
18 | *a.borrow() + 1 //~ ERROR `*a` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `*m` does not live long enough
|
||||
error[E0597]: `*m` does not live long enough
|
||||
--> $DIR/dropck-object-cycle.rs:57:1
|
||||
|
|
||||
37 | assert_eq!(object_invoke1(&*m), (4,5));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `b2` does not live long enough
|
||||
error[E0597]: `b2` does not live long enough
|
||||
--> $DIR/dropck_arr_cycle_checked.rs:109:1
|
||||
|
|
||||
103 | b1.a[0].v.set(Some(&b2));
|
||||
@ -9,7 +9,7 @@ error: `b2` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `b3` does not live long enough
|
||||
error[E0597]: `b3` does not live long enough
|
||||
--> $DIR/dropck_arr_cycle_checked.rs:109:1
|
||||
|
|
||||
104 | b1.a[1].v.set(Some(&b3));
|
||||
@ -20,7 +20,7 @@ error: `b3` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `b2` does not live long enough
|
||||
error[E0597]: `b2` does not live long enough
|
||||
--> $DIR/dropck_arr_cycle_checked.rs:109:1
|
||||
|
|
||||
105 | b2.a[0].v.set(Some(&b2));
|
||||
@ -31,7 +31,7 @@ error: `b2` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `b3` does not live long enough
|
||||
error[E0597]: `b3` does not live long enough
|
||||
--> $DIR/dropck_arr_cycle_checked.rs:109:1
|
||||
|
|
||||
106 | b2.a[1].v.set(Some(&b3));
|
||||
@ -42,7 +42,7 @@ error: `b3` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `b1` does not live long enough
|
||||
error[E0597]: `b1` does not live long enough
|
||||
--> $DIR/dropck_arr_cycle_checked.rs:109:1
|
||||
|
|
||||
107 | b3.a[0].v.set(Some(&b1));
|
||||
@ -53,7 +53,7 @@ error: `b1` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `b2` does not live long enough
|
||||
error[E0597]: `b2` does not live long enough
|
||||
--> $DIR/dropck_arr_cycle_checked.rs:109:1
|
||||
|
|
||||
108 | b3.a[1].v.set(Some(&b2));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `d2` does not live long enough
|
||||
error[E0597]: `d2` does not live long enough
|
||||
--> $DIR/dropck_direct_cycle_with_drop.rs:48:1
|
||||
|
|
||||
46 | d1.p.set(Some(&d2));
|
||||
@ -9,7 +9,7 @@ error: `d2` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `d1` does not live long enough
|
||||
error[E0597]: `d1` does not live long enough
|
||||
--> $DIR/dropck_direct_cycle_with_drop.rs:48:1
|
||||
|
|
||||
47 | d2.p.set(Some(&d1));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `bomb` does not live long enough
|
||||
error[E0597]: `bomb` does not live long enough
|
||||
--> $DIR/dropck_misc_variants.rs:34:1
|
||||
|
|
||||
33 | _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
|
||||
@ -8,7 +8,7 @@ error: `bomb` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `v` does not live long enough
|
||||
error[E0597]: `v` does not live long enough
|
||||
--> $DIR/dropck_misc_variants.rs:44:1
|
||||
|
|
||||
41 | let u = NoisyDrop(&v);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `c2` does not live long enough
|
||||
error[E0597]: `c2` does not live long enough
|
||||
--> $DIR/dropck_vec_cycle_checked.rs:116:1
|
||||
|
|
||||
110 | c1.v[0].v.set(Some(&c2));
|
||||
@ -9,7 +9,7 @@ error: `c2` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c3` does not live long enough
|
||||
error[E0597]: `c3` does not live long enough
|
||||
--> $DIR/dropck_vec_cycle_checked.rs:116:1
|
||||
|
|
||||
111 | c1.v[1].v.set(Some(&c3));
|
||||
@ -20,7 +20,7 @@ error: `c3` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c2` does not live long enough
|
||||
error[E0597]: `c2` does not live long enough
|
||||
--> $DIR/dropck_vec_cycle_checked.rs:116:1
|
||||
|
|
||||
112 | c2.v[0].v.set(Some(&c2));
|
||||
@ -31,7 +31,7 @@ error: `c2` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c3` does not live long enough
|
||||
error[E0597]: `c3` does not live long enough
|
||||
--> $DIR/dropck_vec_cycle_checked.rs:116:1
|
||||
|
|
||||
113 | c2.v[1].v.set(Some(&c3));
|
||||
@ -42,7 +42,7 @@ error: `c3` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c1` does not live long enough
|
||||
error[E0597]: `c1` does not live long enough
|
||||
--> $DIR/dropck_vec_cycle_checked.rs:116:1
|
||||
|
|
||||
114 | c3.v[0].v.set(Some(&c1));
|
||||
@ -53,7 +53,7 @@ error: `c1` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c2` does not live long enough
|
||||
error[E0597]: `c2` does not live long enough
|
||||
--> $DIR/dropck_vec_cycle_checked.rs:116:1
|
||||
|
|
||||
115 | c3.v[1].v.set(Some(&c2));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/issue-11925.rs:18:36
|
||||
|
|
||||
18 | let f = to_fn_once(move|| &x);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/issue-15480.rs:14:6
|
||||
|
|
||||
13 | &3
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `y` does not live long enough
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:21:1
|
||||
|
|
||||
20 | y.borrow().clone()
|
||||
@ -8,7 +8,7 @@ error: `y` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `y` does not live long enough
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:28:5
|
||||
|
|
||||
27 | y.borrow().clone() //~ ERROR `y` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `d1` does not live long enough
|
||||
error[E0597]: `d1` does not live long enough
|
||||
--> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:42:1
|
||||
|
|
||||
38 | _d = D_Child(&d1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `d1` does not live long enough
|
||||
error[E0597]: `d1` does not live long enough
|
||||
--> $DIR/issue-24805-dropck-trait-has-items.rs:48:1
|
||||
|
|
||||
47 | _d = D_HasSelfMethod(&d1);
|
||||
@ -8,7 +8,7 @@ error: `d1` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `d1` does not live long enough
|
||||
error[E0597]: `d1` does not live long enough
|
||||
--> $DIR/issue-24805-dropck-trait-has-items.rs:54:1
|
||||
|
|
||||
53 | _d = D_HasMethodWithSelfArg(&d1);
|
||||
@ -18,7 +18,7 @@ error: `d1` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `d1` does not live long enough
|
||||
error[E0597]: `d1` does not live long enough
|
||||
--> $DIR/issue-24805-dropck-trait-has-items.rs:60:1
|
||||
|
|
||||
59 | _d = D_HasType(&d1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `d1` does not live long enough
|
||||
error[E0597]: `d1` does not live long enough
|
||||
--> $DIR/issue-24895-copy-clone-dropck.rs:38:1
|
||||
|
|
||||
37 | d2 = D(S(&d1, "inner"), "d2");
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `container` does not live long enough
|
||||
error[E0597]: `container` does not live long enough
|
||||
--> $DIR/issue-25199.rs:83:1
|
||||
|
|
||||
80 | let test = Test{test: &container};
|
||||
@ -9,7 +9,7 @@ error: `container` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `container` does not live long enough
|
||||
error[E0597]: `container` does not live long enough
|
||||
--> $DIR/issue-25199.rs:83:1
|
||||
|
|
||||
82 | container.store(test);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `ticking` does not live long enough
|
||||
error[E0597]: `ticking` does not live long enough
|
||||
--> $DIR/issue-26656.rs:51:1
|
||||
|
|
||||
50 | zook.button = B::BigRedButton(&ticking);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/issue-29106.rs:27:5
|
||||
|
|
||||
26 | y = Arc::new(Foo(&x));
|
||||
@ -8,7 +8,7 @@ error: `x` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/issue-29106.rs:33:5
|
||||
|
|
||||
32 | y = Rc::new(Foo(&x));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `a` does not live long enough
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/issue-36537.rs:15:1
|
||||
|
|
||||
14 | p = &a; //~ NOTE borrow occurs here
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `foo` does not live long enough
|
||||
error[E0597]: `foo` does not live long enough
|
||||
--> $DIR/issue-40157.rs:12:64
|
||||
|
|
||||
12 | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `f9` found for type `usize` in the current scope
|
||||
error[E0599]: no method named `f9` found for type `usize` in the current scope
|
||||
--> $DIR/issue-7575.rs:74:18
|
||||
|
|
||||
74 | u.f8(42) + u.f9(342) + m.fff(42)
|
||||
@ -28,7 +28,7 @@ note: candidate #3 is defined in the trait `UnusedTrait`
|
||||
= help: candidate #2: `OtherTrait`
|
||||
= help: candidate #3: `UnusedTrait`
|
||||
|
||||
error: no method named `fff` found for type `Myisize` in the current scope
|
||||
error[E0599]: no method named `fff` found for type `Myisize` in the current scope
|
||||
--> $DIR/issue-7575.rs:74:30
|
||||
|
|
||||
74 | u.f8(42) + u.f9(342) + m.fff(42)
|
||||
@ -43,7 +43,7 @@ note: candidate #1 is defined in an impl for the type `Myisize`
|
||||
53 | | }
|
||||
| |_____^
|
||||
|
||||
error: no method named `is_str` found for type `T` in the current scope
|
||||
error[E0599]: no method named `is_str` found for type `T` in the current scope
|
||||
--> $DIR/issue-7575.rs:85:7
|
||||
|
|
||||
85 | t.is_str()
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `foo.data` does not live long enough
|
||||
error[E0597]: `foo.data` does not live long enough
|
||||
--> $DIR/issue28498-reject-ex1.rs:46:1
|
||||
|
|
||||
44 | foo.data[0].1.set(Some(&foo.data[1]));
|
||||
@ -9,7 +9,7 @@ error: `foo.data` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `foo.data` does not live long enough
|
||||
error[E0597]: `foo.data` does not live long enough
|
||||
--> $DIR/issue28498-reject-ex1.rs:46:1
|
||||
|
|
||||
45 | foo.data[1].1.set(Some(&foo.data[0]));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `last_dropped` does not live long enough
|
||||
error[E0597]: `last_dropped` does not live long enough
|
||||
--> $DIR/issue28498-reject-lifetime-param.rs:46:1
|
||||
|
|
||||
42 | foo0 = Foo(0, &last_dropped);
|
||||
@ -9,7 +9,7 @@ error: `last_dropped` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `first_dropped` does not live long enough
|
||||
error[E0597]: `first_dropped` does not live long enough
|
||||
--> $DIR/issue28498-reject-lifetime-param.rs:46:1
|
||||
|
|
||||
43 | foo1 = Foo(1, &first_dropped);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `last_dropped` does not live long enough
|
||||
error[E0597]: `last_dropped` does not live long enough
|
||||
--> $DIR/issue28498-reject-passed-to-fn.rs:48:1
|
||||
|
|
||||
44 | foo0 = Foo(0, &last_dropped, Box::new(callback));
|
||||
@ -9,7 +9,7 @@ error: `last_dropped` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `first_dropped` does not live long enough
|
||||
error[E0597]: `first_dropped` does not live long enough
|
||||
--> $DIR/issue28498-reject-passed-to-fn.rs:48:1
|
||||
|
|
||||
45 | foo1 = Foo(1, &first_dropped, Box::new(callback));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `last_dropped` does not live long enough
|
||||
error[E0597]: `last_dropped` does not live long enough
|
||||
--> $DIR/issue28498-reject-trait-bound.rs:48:1
|
||||
|
|
||||
44 | foo0 = Foo(0, &last_dropped);
|
||||
@ -9,7 +9,7 @@ error: `last_dropped` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `first_dropped` does not live long enough
|
||||
error[E0597]: `first_dropped` does not live long enough
|
||||
--> $DIR/issue28498-reject-trait-bound.rs:48:1
|
||||
|
|
||||
45 | foo1 = Foo(1, &first_dropped);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `short` does not live long enough
|
||||
error[E0597]: `short` does not live long enough
|
||||
--> $DIR/loan-extend.rs:21:1
|
||||
|
|
||||
19 | long = borrow(&mut short);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: cannot borrow immutable borrowed content `*a` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
|
||||
--> $DIR/mut-arg-hint.rs:13:9
|
||||
|
|
||||
12 | fn foo(mut a: &String) {
|
||||
@ -6,7 +6,7 @@ error: cannot borrow immutable borrowed content `*a` as mutable
|
||||
13 | a.push_str("bar");
|
||||
| ^ cannot borrow as mutable
|
||||
|
||||
error: cannot borrow immutable borrowed content `*a` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
|
||||
--> $DIR/mut-arg-hint.rs:18:5
|
||||
|
|
||||
17 | pub fn foo<'a>(mut a: &'a String) {
|
||||
@ -14,7 +14,7 @@ error: cannot borrow immutable borrowed content `*a` as mutable
|
||||
18 | a.push_str("foo");
|
||||
| ^ cannot borrow as mutable
|
||||
|
||||
error: cannot borrow immutable borrowed content `*a` as mutable
|
||||
error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
|
||||
--> $DIR/mut-arg-hint.rs:25:9
|
||||
|
|
||||
24 | pub fn foo(mut a: &String) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `b` does not live long enough
|
||||
error[E0597]: `b` does not live long enough
|
||||
--> $DIR/mut-ptr-cant-outlive-ref.rs:19:5
|
||||
|
|
||||
18 | p = &*b; //~ ERROR `b` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `a` does not live long enough
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/range-2.rs:20:5
|
||||
|
|
||||
17 | &a..&b
|
||||
@ -9,7 +9,7 @@ error: `a` does not live long enough
|
||||
21 | }
|
||||
| - borrowed value needs to live until here
|
||||
|
||||
error: `b` does not live long enough
|
||||
error[E0597]: `b` does not live long enough
|
||||
--> $DIR/range-2.rs:20:5
|
||||
|
|
||||
17 | &a..&b
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `c` does not live long enough
|
||||
error[E0597]: `c` does not live long enough
|
||||
--> $DIR/regionck-unboxed-closure-lifetimes.rs:19:5
|
||||
|
|
||||
17 | let c_ref = &c; //~ ERROR `c` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:5
|
||||
|
|
||||
20 | let ss: &isize = &1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `tmp0` does not live long enough
|
||||
error[E0597]: `tmp0` does not live long enough
|
||||
--> $DIR/regions-close-over-type-parameter-2.rs:35:5
|
||||
|
|
||||
33 | let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/regions-escape-loop-via-variable.rs:22:5
|
||||
|
|
||||
21 | p = &x; //~ ERROR `x` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `z` does not live long enough
|
||||
error[E0597]: `z` does not live long enough
|
||||
--> $DIR/regions-escape-loop-via-vec.rs:26:5
|
||||
|
|
||||
22 | _y.push(&mut z); //~ ERROR `z` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `*x` does not live long enough
|
||||
error[E0597]: `*x` does not live long enough
|
||||
--> $DIR/regions-infer-borrow-scope-within-loop.rs:28:5
|
||||
|
|
||||
24 | y = borrow(&*x); //~ ERROR `*x` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/send-is-not-static-ensures-scoping.rs:32:5
|
||||
|
|
||||
26 | let y = &x; //~ ERROR `x` does not live long enough
|
||||
@ -10,7 +10,7 @@ error: `x` does not live long enough
|
||||
35 | }
|
||||
| - borrowed value needs to live until here
|
||||
|
||||
error: `y` does not live long enough
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/send-is-not-static-ensures-scoping.rs:29:22
|
||||
|
|
||||
28 | scoped(|| {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/send-is-not-static-std-sync-2.rs:22:5
|
||||
|
|
||||
21 | Mutex::new(&x) //~ ERROR does not live long enough
|
||||
@ -9,7 +9,7 @@ error: `x` does not live long enough
|
||||
25 | }
|
||||
| - borrowed value needs to live until here
|
||||
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/send-is-not-static-std-sync-2.rs:31:5
|
||||
|
|
||||
30 | RwLock::new(&x) //~ ERROR does not live long enough
|
||||
@ -20,7 +20,7 @@ error: `x` does not live long enough
|
||||
33 | }
|
||||
| - borrowed value needs to live until here
|
||||
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/send-is-not-static-std-sync-2.rs:41:5
|
||||
|
|
||||
39 | let _ = tx.send(&x); //~ ERROR does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `z` does not live long enough
|
||||
error[E0597]: `z` does not live long enough
|
||||
--> $DIR/send-is-not-static-std-sync.rs:27:5
|
||||
|
|
||||
26 | *lock.lock().unwrap() = &z; //~ ERROR does not live long enough
|
||||
@ -16,7 +16,7 @@ error[E0505]: cannot move out of `y` because it is borrowed
|
||||
23 | drop(y); //~ ERROR cannot move out
|
||||
| ^ move out of `y` occurs here
|
||||
|
||||
error: `z` does not live long enough
|
||||
error[E0597]: `z` does not live long enough
|
||||
--> $DIR/send-is-not-static-std-sync.rs:39:5
|
||||
|
|
||||
38 | *lock.write().unwrap() = &z; //~ ERROR does not live long enough
|
||||
@ -34,7 +34,7 @@ error[E0505]: cannot move out of `y` because it is borrowed
|
||||
35 | drop(y); //~ ERROR cannot move out
|
||||
| ^ move out of `y` occurs here
|
||||
|
||||
error: `z` does not live long enough
|
||||
error[E0597]: `z` does not live long enough
|
||||
--> $DIR/send-is-not-static-std-sync.rs:53:5
|
||||
|
|
||||
52 | tx.send(&z).unwrap(); //~ ERROR does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: borrowed value does not live long enough
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/slice-borrow.rs:18:5
|
||||
|
|
||||
16 | let x: &[isize] = &[1, 2, 3, 4, 5];
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `c2` does not live long enough
|
||||
error[E0597]: `c2` does not live long enough
|
||||
--> $DIR/vec-must-not-hide-type-from-dropck.rs:129:1
|
||||
|
|
||||
127 | c1.v[0].v.set(Some(&c2));
|
||||
@ -9,7 +9,7 @@ error: `c2` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `c1` does not live long enough
|
||||
error[E0597]: `c1` does not live long enough
|
||||
--> $DIR/vec-must-not-hide-type-from-dropck.rs:129:1
|
||||
|
|
||||
128 | c2.v[0].v.set(Some(&c1));
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `x` does not live long enough
|
||||
error[E0597]: `x` does not live long enough
|
||||
--> $DIR/vec_refs_data_with_early_death.rs:31:1
|
||||
|
|
||||
27 | v.push(&x);
|
||||
@ -9,7 +9,7 @@ error: `x` does not live long enough
|
||||
|
|
||||
= note: values in a scope are dropped in the opposite order they are created
|
||||
|
||||
error: `y` does not live long enough
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/vec_refs_data_with_early_death.rs:31:1
|
||||
|
|
||||
28 | v.push(&y);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: `pointer` does not live long enough
|
||||
error[E0597]: `pointer` does not live long enough
|
||||
--> $DIR/wf-method-late-bound-regions.rs:31:5
|
||||
|
|
||||
30 | f2.xmute(&pointer) //~ ERROR `pointer` does not live long enough
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:16:28: 16:33]>` in the current scope
|
||||
error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:16:28: 16:33]>` in the current scope
|
||||
--> $DIR/issue-18343.rs:17:7
|
||||
|
|
||||
17 | o.closure();
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope
|
||||
error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope
|
||||
--> $DIR/issue-2392.rs:50:15
|
||||
|
|
||||
50 | o_closure.closure(); //~ ERROR no method named `closure` found
|
||||
@ -6,7 +6,7 @@ error: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs
|
||||
|
|
||||
= help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field
|
||||
|
||||
error: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope
|
||||
error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope
|
||||
--> $DIR/issue-2392.rs:54:15
|
||||
|
|
||||
54 | o_closure.not_closure();
|
||||
@ -14,7 +14,7 @@ error: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-239
|
||||
|
|
||||
= help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`?
|
||||
|
||||
error: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
|
||||
error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
|
||||
--> $DIR/issue-2392.rs:60:12
|
||||
|
|
||||
60 | o_func.closure(); //~ ERROR no method named `closure` found
|
||||
@ -22,7 +22,7 @@ error: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the
|
||||
|
|
||||
= help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field
|
||||
|
||||
error: no method named `boxed_closure` found for type `BoxedObj` in the current scope
|
||||
error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
|
||||
--> $DIR/issue-2392.rs:65:14
|
||||
|
|
||||
65 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found
|
||||
@ -30,7 +30,7 @@ error: no method named `boxed_closure` found for type `BoxedObj` in the current
|
||||
|
|
||||
= help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
|
||||
|
||||
error: no method named `boxed_closure` found for type `BoxedObj` in the current scope
|
||||
error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
|
||||
--> $DIR/issue-2392.rs:70:19
|
||||
|
|
||||
70 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found
|
||||
@ -38,7 +38,7 @@ error: no method named `boxed_closure` found for type `BoxedObj` in the current
|
||||
|
|
||||
= help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
|
||||
|
||||
error: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
|
||||
error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
|
||||
--> $DIR/issue-2392.rs:77:12
|
||||
|
|
||||
77 | w.wrap.closure();//~ ERROR no method named `closure` found
|
||||
@ -46,7 +46,7 @@ error: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the
|
||||
|
|
||||
= help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field
|
||||
|
||||
error: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
|
||||
error[E0599]: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
|
||||
--> $DIR/issue-2392.rs:81:12
|
||||
|
|
||||
81 | w.wrap.not_closure();
|
||||
@ -54,7 +54,7 @@ error: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in
|
||||
|
|
||||
= help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`?
|
||||
|
||||
error: no method named `closure` found for type `Obj<std::boxed::Box<std::boxed::FnBox<(), Output=u32> + 'static>>` in the current scope
|
||||
error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<std::boxed::FnBox<(), Output=u32> + 'static>>` in the current scope
|
||||
--> $DIR/issue-2392.rs:86:24
|
||||
|
|
||||
86 | check_expression().closure();//~ ERROR no method named `closure` found
|
||||
@ -62,7 +62,7 @@ error: no method named `closure` found for type `Obj<std::boxed::Box<std::boxed:
|
||||
|
|
||||
= help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field
|
||||
|
||||
error: no method named `f1` found for type `FuncContainer` in the current scope
|
||||
error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope
|
||||
--> $DIR/issue-2392.rs:94:31
|
||||
|
|
||||
94 | (*self.container).f1(1); //~ ERROR no method named `f1` found
|
||||
@ -70,7 +70,7 @@ error: no method named `f1` found for type `FuncContainer` in the current scope
|
||||
|
|
||||
= help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field
|
||||
|
||||
error: no method named `f2` found for type `FuncContainer` in the current scope
|
||||
error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope
|
||||
--> $DIR/issue-2392.rs:97:31
|
||||
|
|
||||
97 | (*self.container).f2(1); //~ ERROR no method named `f2` found
|
||||
@ -78,7 +78,7 @@ error: no method named `f2` found for type `FuncContainer` in the current scope
|
||||
|
|
||||
= help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field
|
||||
|
||||
error: no method named `f3` found for type `FuncContainer` in the current scope
|
||||
error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope
|
||||
--> $DIR/issue-2392.rs:100:31
|
||||
|
|
||||
100 | (*self.container).f3(1); //~ ERROR no method named `f3` found
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `example` found for type `Example` in the current scope
|
||||
error[E0599]: no method named `example` found for type `Example` in the current scope
|
||||
--> $DIR/issue-32128.rs:22:10
|
||||
|
|
||||
22 | demo.example(1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope
|
||||
error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope
|
||||
--> $DIR/issue-33784.rs:37:7
|
||||
|
|
||||
37 | p.closure(); //~ ERROR no method named `closure` found
|
||||
@ -6,7 +6,7 @@ error: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.
|
||||
|
|
||||
= help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field
|
||||
|
||||
error: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope
|
||||
error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope
|
||||
--> $DIR/issue-33784.rs:41:7
|
||||
|
|
||||
41 | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found
|
||||
@ -14,7 +14,7 @@ error: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.
|
||||
|
|
||||
= help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field
|
||||
|
||||
error: no method named `c_fn_ptr` found for type `&D` in the current scope
|
||||
error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope
|
||||
--> $DIR/issue-33784.rs:46:7
|
||||
|
|
||||
46 | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: no method named `dog_age` found for type `animal::Dog` in the current scope
|
||||
error[E0599]: no method named `dog_age` found for type `animal::Dog` in the current scope
|
||||
--> $DIR/private-field.rs:26:23
|
||||
|
|
||||
26 | let dog_age = dog.dog_age();
|
||||
|
Loading…
Reference in New Issue
Block a user