diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:26:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:26:03 +0000 |
commit | 9918693037dce8aa4bb6f08741b6812923486c18 (patch) | |
tree | 21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /tests/ui/borrowck | |
parent | Releasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff) | |
download | rustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/borrowck')
189 files changed, 440 insertions, 210 deletions
diff --git a/tests/ui/borrowck/access-mode-in-closures.stderr b/tests/ui/borrowck/access-mode-in-closures.stderr index abee72ba8..b9a45edb3 100644 --- a/tests/ui/borrowck/access-mode-in-closures.stderr +++ b/tests/ui/borrowck/access-mode-in-closures.stderr @@ -13,6 +13,6 @@ LL - match *s { S(v) => v } LL + match s { S(v) => v } | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/accidentally-cloning-ref-borrow-error.rs b/tests/ui/borrowck/accidentally-cloning-ref-borrow-error.rs new file mode 100644 index 000000000..2b25a5b23 --- /dev/null +++ b/tests/ui/borrowck/accidentally-cloning-ref-borrow-error.rs @@ -0,0 +1,38 @@ +#[derive(Debug)] +struct X<T>(T); + +impl<T: Clone> Clone for X<T> { + fn clone(&self) -> X<T> { + X(self.0.clone()) + } +} + +#[derive(Debug)] +struct Y; + +#[derive(Debug)] +struct Str { + x: Option<i32>, +} + +fn foo(s: &mut Option<i32>) { + if s.is_none() { + *s = Some(0); + } + println!("{:?}", s); +} + +fn bar<T: std::fmt::Debug>(s: &mut X<T>) { + println!("{:?}", s); +} +fn main() { + let s = Str { x: None }; + let sr = &s; + let mut sm = sr.clone(); + foo(&mut sm.x); //~ ERROR cannot borrow `sm.x` as mutable, as it is behind a `&` reference + + let x = X(Y); + let xr = &x; + let mut xm = xr.clone(); + bar(&mut xm); //~ ERROR cannot borrow data in a `&` reference as mutable +} diff --git a/tests/ui/borrowck/accidentally-cloning-ref-borrow-error.stderr b/tests/ui/borrowck/accidentally-cloning-ref-borrow-error.stderr new file mode 100644 index 000000000..7e51a4819 --- /dev/null +++ b/tests/ui/borrowck/accidentally-cloning-ref-borrow-error.stderr @@ -0,0 +1,30 @@ +error[E0596]: cannot borrow `sm.x` as mutable, as it is behind a `&` reference + --> $DIR/accidentally-cloning-ref-borrow-error.rs:32:9 + | +LL | foo(&mut sm.x); + | ^^^^^^^^^ `sm` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: `Str` doesn't implement `Clone`, so this call clones the reference `&Str` + --> $DIR/accidentally-cloning-ref-borrow-error.rs:31:21 + | +LL | let mut sm = sr.clone(); + | ^^^^^^^ +help: consider annotating `Str` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct Str { + | +help: consider specifying this binding's type + | +LL | let mut sm: &mut Str = sr.clone(); + | ++++++++++ + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/accidentally-cloning-ref-borrow-error.rs:37:9 + | +LL | bar(&mut xm); + | ^^^^^^^ cannot borrow as mutable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr index 7fd0cb9bb..0cd6dfe77 100644 --- a/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr +++ b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr @@ -14,6 +14,6 @@ LL ~ let binding = String::new(); LL ~ let func = get_func::<T>(&binding); | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr index 58a42d8af..b5c2b662f 100644 --- a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr +++ b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr @@ -11,6 +11,6 @@ LL | } | = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr index e1fbbc14f..73de58649 100644 --- a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr +++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr @@ -8,6 +8,6 @@ LL | fn foo<'a>(s: &'a str) -> impl Trait + 'static { LL | bar(s) | ^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0700`. diff --git a/tests/ui/borrowck/anonymous-region-in-apit.stderr b/tests/ui/borrowck/anonymous-region-in-apit.stderr index 9e100f8ac..72dfbb797 100644 --- a/tests/ui/borrowck/anonymous-region-in-apit.stderr +++ b/tests/ui/borrowck/anonymous-region-in-apit.stderr @@ -11,6 +11,6 @@ LL | |baz: &str| foo.bar(baz); | | let's call the lifetime of this reference `'1` | `baz` is a reference that is only valid in the closure body -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.stderr b/tests/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.stderr index 6235e0db0..2b16206cd 100644 --- a/tests/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.stderr +++ b/tests/ui/borrowck/borrow-immutable-upvar-mutation-impl-trait.stderr @@ -9,6 +9,6 @@ LL | move || { LL | x += 1; | ^^^^^^ cannot assign -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/borrowck/borrowck-and-init.stderr b/tests/ui/borrowck/borrowck-and-init.stderr index 5abf07a31..37386f1c4 100644 --- a/tests/ui/borrowck/borrowck-and-init.stderr +++ b/tests/ui/borrowck/borrowck-and-init.stderr @@ -11,6 +11,6 @@ LL | println!("{}", i); | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-anon-fields-struct.stderr b/tests/ui/borrowck/borrowck-anon-fields-struct.stderr index 7a959fb6e..37e98732f 100644 --- a/tests/ui/borrowck/borrowck-anon-fields-struct.stderr +++ b/tests/ui/borrowck/borrowck-anon-fields-struct.stderr @@ -10,6 +10,6 @@ LL | Y(ref mut b, _) => b LL | *a += 1; | ------- first borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/borrowck-anon-fields-tuple.stderr b/tests/ui/borrowck/borrowck-anon-fields-tuple.stderr index 88a8867f5..b749779b9 100644 --- a/tests/ui/borrowck/borrowck-anon-fields-tuple.stderr +++ b/tests/ui/borrowck/borrowck-anon-fields-tuple.stderr @@ -10,6 +10,6 @@ LL | (ref mut b, _) => b LL | *a += 1; | ------- first borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/borrowck-assign-to-constants.stderr b/tests/ui/borrowck/borrowck-assign-to-constants.stderr index 864d933da..82972b573 100644 --- a/tests/ui/borrowck/borrowck-assign-to-constants.stderr +++ b/tests/ui/borrowck/borrowck-assign-to-constants.stderr @@ -4,6 +4,6 @@ error[E0594]: cannot assign to immutable static item `foo` LL | foo = 6; | ^^^^^^^ cannot assign -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr index 25d642c30..d14fbd761 100644 --- a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr +++ b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr @@ -9,6 +9,6 @@ help: consider changing this to be mutable LL | let mut x = Foo { x: 3 }; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/borrowck-autoref-3261.stderr b/tests/ui/borrowck/borrowck-autoref-3261.stderr index c2dfb687e..0e462256c 100644 --- a/tests/ui/borrowck/borrowck-autoref-3261.stderr +++ b/tests/ui/borrowck/borrowck-autoref-3261.stderr @@ -11,6 +11,6 @@ LL | |opt| { LL | x = X(Either::Left((0, 0))); | - second borrow occurs due to use of `x` in closure -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/borrowck-block-uninit.stderr b/tests/ui/borrowck/borrowck-block-uninit.stderr index 1a5969586..07c09f1f4 100644 --- a/tests/ui/borrowck/borrowck-block-uninit.stderr +++ b/tests/ui/borrowck/borrowck-block-uninit.stderr @@ -13,6 +13,6 @@ help: consider assigning a value LL | let x: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-borrow-from-temporary.stderr b/tests/ui/borrowck/borrowck-borrow-from-temporary.stderr index 71bf052c9..dabb5e21f 100644 --- a/tests/ui/borrowck/borrowck-borrow-from-temporary.stderr +++ b/tests/ui/borrowck/borrowck-borrow-from-temporary.stderr @@ -6,6 +6,6 @@ LL | let &Foo(ref x) = &id(Foo(3)); LL | x | ^ returns a value referencing data owned by the current function -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr index a61fdbf6c..199f7c120 100644 --- a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr +++ b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr @@ -9,6 +9,6 @@ help: consider changing this to be mutable LL | let mut a: Box<_> = Box::new(A); | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr index fa0ae318e..0bcf63d6a 100644 --- a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr +++ b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr @@ -8,6 +8,6 @@ LL | x.f2(); LL | y.use_ref(); | - first borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr index 6e112e270..7f0ecf7b3 100644 --- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr +++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr @@ -15,6 +15,6 @@ LL ~ let binding = vec!["Goodbye", "world!"]; LL ~ let x = defer(&binding); | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr index 7ee840b34..5d6fc8fa7 100644 --- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr +++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr @@ -15,6 +15,6 @@ LL ~ let binding = Box::new(1); LL ~ buggy_map.insert(42, &*binding); | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/borrowck-break-uninit-2.stderr b/tests/ui/borrowck/borrowck-break-uninit-2.stderr index ea93a8f40..7c0cda31c 100644 --- a/tests/ui/borrowck/borrowck-break-uninit-2.stderr +++ b/tests/ui/borrowck/borrowck-break-uninit-2.stderr @@ -13,6 +13,6 @@ help: consider assigning a value LL | let x: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-break-uninit.stderr b/tests/ui/borrowck/borrowck-break-uninit.stderr index a7a8fc2ff..0d879c6fb 100644 --- a/tests/ui/borrowck/borrowck-break-uninit.stderr +++ b/tests/ui/borrowck/borrowck-break-uninit.stderr @@ -13,6 +13,6 @@ help: consider assigning a value LL | let x: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-closures-mut-of-mut.stderr b/tests/ui/borrowck/borrowck-closures-mut-of-mut.stderr index e5ee5a401..105a0b051 100644 --- a/tests/ui/borrowck/borrowck-closures-mut-of-mut.stderr +++ b/tests/ui/borrowck/borrowck-closures-mut-of-mut.stderr @@ -13,6 +13,6 @@ LL | LL | c2(); c1(); | -- first borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0524`. diff --git a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr index b8bbb31a3..669dd614f 100644 --- a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr +++ b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr @@ -8,6 +8,6 @@ LL | &mut this.x; LL | p.use_ref(); | - immutable borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-closures-use-after-free.stderr b/tests/ui/borrowck/borrowck-closures-use-after-free.stderr index 30900a3b6..bc840577e 100644 --- a/tests/ui/borrowck/borrowck-closures-use-after-free.stderr +++ b/tests/ui/borrowck/borrowck-closures-use-after-free.stderr @@ -11,6 +11,6 @@ LL | test(&*ptr); | | | mutable borrow later used by call -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-consume-unsize-vec.stderr b/tests/ui/borrowck/borrowck-consume-unsize-vec.stderr index d2e9497d0..abd7f19fc 100644 --- a/tests/ui/borrowck/borrowck-consume-unsize-vec.stderr +++ b/tests/ui/borrowck/borrowck-consume-unsize-vec.stderr @@ -20,6 +20,6 @@ help: consider cloning the value if the performance cost is acceptable LL | consume(b.clone()); | ++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-consume-upcast-box.stderr b/tests/ui/borrowck/borrowck-consume-upcast-box.stderr index ed7e883ca..4c3861cfe 100644 --- a/tests/ui/borrowck/borrowck-consume-upcast-box.stderr +++ b/tests/ui/borrowck/borrowck-consume-upcast-box.stderr @@ -16,6 +16,6 @@ LL | fn consume(_: Box<dyn Foo>) { | | | in this function -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-escaping-closure-error-1.stderr b/tests/ui/borrowck/borrowck-escaping-closure-error-1.stderr index acf6b37b7..6dcd45173 100644 --- a/tests/ui/borrowck/borrowck-escaping-closure-error-1.stderr +++ b/tests/ui/borrowck/borrowck-escaping-closure-error-1.stderr @@ -16,6 +16,6 @@ help: to force the closure to take ownership of `books` (and any other reference LL | spawn(move || books.push(4)); | ++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0373`. diff --git a/tests/ui/borrowck/borrowck-escaping-closure-error-2.stderr b/tests/ui/borrowck/borrowck-escaping-closure-error-2.stderr index 814042539..7a1c1510b 100644 --- a/tests/ui/borrowck/borrowck-escaping-closure-error-2.stderr +++ b/tests/ui/borrowck/borrowck-escaping-closure-error-2.stderr @@ -16,6 +16,6 @@ help: to force the closure to take ownership of `books` (and any other reference LL | Box::new(move || books.push(4)) | ++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0373`. diff --git a/tests/ui/borrowck/borrowck-fn-in-const-a.stderr b/tests/ui/borrowck/borrowck-fn-in-const-a.stderr index e7491afda..e05696864 100644 --- a/tests/ui/borrowck/borrowck-fn-in-const-a.stderr +++ b/tests/ui/borrowck/borrowck-fn-in-const-a.stderr @@ -4,6 +4,6 @@ error[E0507]: cannot move out of `*x` which is behind a shared reference LL | return *x | ^^ move occurs because `*x` has type `String`, which does not implement the `Copy` trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-fn-in-const-c.stderr b/tests/ui/borrowck/borrowck-fn-in-const-c.stderr index d48866dce..ee1bb2a48 100644 --- a/tests/ui/borrowck/borrowck-fn-in-const-c.stderr +++ b/tests/ui/borrowck/borrowck-fn-in-const-c.stderr @@ -6,6 +6,6 @@ LL | return &local.inner; LL | } | - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0713`. diff --git a/tests/ui/borrowck/borrowck-for-loop-uninitialized-binding.stderr b/tests/ui/borrowck/borrowck-for-loop-uninitialized-binding.stderr index fc1a44c3c..79519e885 100644 --- a/tests/ui/borrowck/borrowck-for-loop-uninitialized-binding.stderr +++ b/tests/ui/borrowck/borrowck-for-loop-uninitialized-binding.stderr @@ -8,6 +8,6 @@ LL | for _ in 0..0 { x = 10; } LL | return x; | ^ `x` used here but it is possibly-uninitialized -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-if-no-else.stderr b/tests/ui/borrowck/borrowck-if-no-else.stderr index 9eafc2c2a..f1fad2d36 100644 --- a/tests/ui/borrowck/borrowck-if-no-else.stderr +++ b/tests/ui/borrowck/borrowck-if-no-else.stderr @@ -9,6 +9,6 @@ LL | let x: isize; if 1 > 2 { x = 10; } LL | foo(x); | ^ `x` used here but it is possibly-uninitialized -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-if-with-else.stderr b/tests/ui/borrowck/borrowck-if-with-else.stderr index 3f0fe291c..c246e4148 100644 --- a/tests/ui/borrowck/borrowck-if-with-else.stderr +++ b/tests/ui/borrowck/borrowck-if-with-else.stderr @@ -9,6 +9,6 @@ LL | if 1 > 2 { LL | foo(x); | ^ `x` used here but it is possibly-uninitialized -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr b/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr index 1a20ec85f..3f052f8fe 100644 --- a/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr +++ b/tests/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.stderr @@ -10,6 +10,6 @@ LL | _a = 4; LL | drop(b); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/borrowck-in-static.stderr b/tests/ui/borrowck/borrowck-in-static.stderr index 2033e4a57..8171e6950 100644 --- a/tests/ui/borrowck/borrowck-in-static.stderr +++ b/tests/ui/borrowck/borrowck-in-static.stderr @@ -8,6 +8,6 @@ LL | Box::new(|| x) | | | captured by this `Fn` closure -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/tests/ui/borrowck/borrowck-init-in-called-fn-expr.stderr index 1a22b5f09..a27b6956b 100644 --- a/tests/ui/borrowck/borrowck-init-in-called-fn-expr.stderr +++ b/tests/ui/borrowck/borrowck-init-in-called-fn-expr.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let i: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-init-in-fn-expr.stderr b/tests/ui/borrowck/borrowck-init-in-fn-expr.stderr index f1b9b9aa7..16f4c40f5 100644 --- a/tests/ui/borrowck/borrowck-init-in-fn-expr.stderr +++ b/tests/ui/borrowck/borrowck-init-in-fn-expr.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let i: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-init-in-fru.stderr b/tests/ui/borrowck/borrowck-init-in-fru.stderr index 39b28811a..f27993e10 100644 --- a/tests/ui/borrowck/borrowck-init-in-fru.stderr +++ b/tests/ui/borrowck/borrowck-init-in-fru.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let mut origin: Point = todo!(); | +++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-init-op-equal.stderr b/tests/ui/borrowck/borrowck-init-op-equal.stderr index ef0fa6df4..241d24341 100644 --- a/tests/ui/borrowck/borrowck-init-op-equal.stderr +++ b/tests/ui/borrowck/borrowck-init-op-equal.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let v: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-init-plus-equal.stderr b/tests/ui/borrowck/borrowck-init-plus-equal.stderr index cec053318..65de6e8bf 100644 --- a/tests/ui/borrowck/borrowck-init-plus-equal.stderr +++ b/tests/ui/borrowck/borrowck-init-plus-equal.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let mut v: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-issue-2657-1.stderr b/tests/ui/borrowck/borrowck-issue-2657-1.stderr index 4ea4eb8f0..194403fc1 100644 --- a/tests/ui/borrowck/borrowck-issue-2657-1.stderr +++ b/tests/ui/borrowck/borrowck-issue-2657-1.stderr @@ -8,6 +8,6 @@ LL | let _a = x; LL | _y.use_ref(); | -- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-issue-2657-2.stderr b/tests/ui/borrowck/borrowck-issue-2657-2.stderr index 850bb9ae3..6fab19000 100644 --- a/tests/ui/borrowck/borrowck-issue-2657-2.stderr +++ b/tests/ui/borrowck/borrowck-issue-2657-2.stderr @@ -10,6 +10,6 @@ LL - let _b = *y; LL + let _b = y; | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-lend-flow-if.stderr b/tests/ui/borrowck/borrowck-lend-flow-if.stderr index 68a82bdb5..abcd14f9a 100644 --- a/tests/ui/borrowck/borrowck-lend-flow-if.stderr +++ b/tests/ui/borrowck/borrowck-lend-flow-if.stderr @@ -9,6 +9,6 @@ LL | borrow_mut(&mut *v); LL | _w.use_ref(); | -- immutable borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-lend-flow-match.stderr b/tests/ui/borrowck/borrowck-lend-flow-match.stderr index 6cdce7bee..3e9124bdc 100644 --- a/tests/ui/borrowck/borrowck-lend-flow-match.stderr +++ b/tests/ui/borrowck/borrowck-lend-flow-match.stderr @@ -8,6 +8,6 @@ LL | x = Some(1); LL | drop(r); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/borrowck-lend-flow.stderr b/tests/ui/borrowck/borrowck-lend-flow.stderr index 07b11b3e7..0c60b0948 100644 --- a/tests/ui/borrowck/borrowck-lend-flow.stderr +++ b/tests/ui/borrowck/borrowck-lend-flow.stderr @@ -8,6 +8,6 @@ LL | borrow_mut(&mut *v); LL | _w.use_ref(); | -- immutable borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr index de8da490c..d1fbc5b47 100644 --- a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr +++ b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr @@ -10,6 +10,6 @@ LL | take(v); LL | w.use_ref(); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/tests/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr index fa5308c29..3285c7f0c 100644 --- a/tests/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr +++ b/tests/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr @@ -10,6 +10,6 @@ LL | |w| { LL | v = Box::new(4); | - second borrow occurs due to use of `v` in closure -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr index 93622a0c5..5f1e3994a 100644 --- a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr +++ b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr @@ -13,6 +13,6 @@ help: consider cloning the value if the performance cost is acceptable LL | let _y = {x.clone()} + x.clone(); // the `{x}` forces a move to occur | ++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr index 311369a26..838568fd3 100644 --- a/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr +++ b/tests/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr @@ -9,6 +9,6 @@ LL | let alias: &'static mut String = s; LL | *s = String::new(); | ^^ `*s` is assigned to here but it was already borrowed -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/borrowck-loan-vec-content.stderr b/tests/ui/borrowck/borrowck-loan-vec-content.stderr index 6691a2396..eb11dfa38 100644 --- a/tests/ui/borrowck/borrowck-loan-vec-content.stderr +++ b/tests/ui/borrowck/borrowck-loan-vec-content.stderr @@ -10,6 +10,6 @@ LL | || { LL | v[1] = 4; | - second borrow occurs due to use of `v` in closure -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr b/tests/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr index 9d19de211..9c26bc353 100644 --- a/tests/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr +++ b/tests/ui/borrowck/borrowck-local-borrow-outlives-fn.stderr @@ -4,6 +4,6 @@ error[E0515]: cannot return reference to function parameter `x` LL | &x | ^^ returns a reference to data owned by the current function -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr b/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr index 0fdb1dabb..bac9c2790 100644 --- a/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr +++ b/tests/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.stderr @@ -12,6 +12,6 @@ LL | *x = Some(&mut z.1); LL | } | - `z.1` dropped here while still borrowed -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/borrowck/borrowck-move-by-capture.stderr b/tests/ui/borrowck/borrowck-move-by-capture.stderr index 6eaa1fa31..016470112 100644 --- a/tests/ui/borrowck/borrowck-move-by-capture.stderr +++ b/tests/ui/borrowck/borrowck-move-by-capture.stderr @@ -12,6 +12,6 @@ LL | let _h = to_fn_once(move || -> isize { *bar }); | | move occurs because `bar` has type `Box<isize>`, which does not implement the `Copy` trait | `bar` is moved here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index 4f0202f38..a41c4af98 100644 --- a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -11,6 +11,6 @@ LL | let z = *a; LL | b.use_ref(); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/tests/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr index 43fc102bd..7213f85ad 100644 --- a/tests/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr +++ b/tests/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr @@ -10,6 +10,6 @@ LL - let y = *x; LL + let y = x; | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-move-moved-value-into-closure.stderr b/tests/ui/borrowck/borrowck-move-moved-value-into-closure.stderr index 9509ebb7c..6a77d86f2 100644 --- a/tests/ui/borrowck/borrowck-move-moved-value-into-closure.stderr +++ b/tests/ui/borrowck/borrowck-move-moved-value-into-closure.stderr @@ -13,6 +13,6 @@ LL | call_f(move|| { *t + 1 }); | | | value used here after move -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr index e1e3c7f8a..88eb6c8ce 100644 --- a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr +++ b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr @@ -11,6 +11,6 @@ LL | *t1 = 22; LL | p.use_ref(); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.fixed b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.fixed new file mode 100644 index 000000000..0b7551b97 --- /dev/null +++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.fixed @@ -0,0 +1,7 @@ +// run-rustfix +use std::rc::Rc; + +pub fn main() { + let _x = <Vec<i32> as Clone>::clone(&Rc::new(vec![1, 2])).into_iter(); + //~^ ERROR [E0507] +} diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs index 0b9e7102c..5cb8ceaca 100644 --- a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs +++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs @@ -1,3 +1,4 @@ +// run-rustfix use std::rc::Rc; pub fn main() { diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr index 934dd8df1..076f0ce34 100644 --- a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr +++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of an `Rc` - --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14 + --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:5:14 | LL | let _x = Rc::new(vec![1, 2]).into_iter(); | ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call @@ -10,9 +10,9 @@ note: `into_iter` takes ownership of the receiver `self`, which moves value --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: you can `clone` the value and consume it, but this might not be your desired behavior | -LL | let _x = Rc::new(vec![1, 2]).clone().into_iter(); - | ++++++++ +LL | let _x = <Vec<i32> as Clone>::clone(&Rc::new(vec![1, 2])).into_iter(); + | ++++++++++++++++++++++++++++ + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr b/tests/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr index 599fa1e88..dce1f4d07 100644 --- a/tests/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr +++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr @@ -10,6 +10,6 @@ LL - let _x = *Rc::new("hi".to_string()); LL + let _x = Rc::new("hi".to_string()); | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-move-out-of-static-item.stderr b/tests/ui/borrowck/borrowck-move-out-of-static-item.stderr index edf8c954f..07dcaf875 100644 --- a/tests/ui/borrowck/borrowck-move-out-of-static-item.stderr +++ b/tests/ui/borrowck/borrowck-move-out-of-static-item.stderr @@ -4,6 +4,6 @@ error[E0507]: cannot move out of static item `BAR` LL | test(BAR); | ^^^ move occurs because `BAR` has type `Foo`, which does not implement the `Copy` trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/tests/ui/borrowck/borrowck-move-out-of-vec-tail.stderr index 9ff20a1f4..4fa23f16b 100644 --- a/tests/ui/borrowck/borrowck-move-out-of-vec-tail.stderr +++ b/tests/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -16,6 +16,6 @@ LL - &[Foo { string: a }, LL + [Foo { string: a }, | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0508`. diff --git a/tests/ui/borrowck/borrowck-move-subcomponent.stderr b/tests/ui/borrowck/borrowck-move-subcomponent.stderr index 341146bd1..8408d9915 100644 --- a/tests/ui/borrowck/borrowck-move-subcomponent.stderr +++ b/tests/ui/borrowck/borrowck-move-subcomponent.stderr @@ -10,6 +10,6 @@ LL | let S { x: ax } = a; LL | f(pb); | -- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr b/tests/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr index 20528e3f0..84f35dc22 100644 --- a/tests/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr +++ b/tests/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr @@ -9,6 +9,6 @@ help: consider changing this to be mutable LL | let mut x: isize = 3; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr b/tests/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr index 8ab472e64..823f470ce 100644 --- a/tests/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr +++ b/tests/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr @@ -9,6 +9,6 @@ help: consider changing this to be mutable LL | let mut v = vec![1, 2, 3]; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr b/tests/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr index 3462b7610..bde43a908 100644 --- a/tests/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr +++ b/tests/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr @@ -8,6 +8,6 @@ LL | y.a = x; | | | borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-or-init.stderr b/tests/ui/borrowck/borrowck-or-init.stderr index 16d66bf40..7b43f2aee 100644 --- a/tests/ui/borrowck/borrowck-or-init.stderr +++ b/tests/ui/borrowck/borrowck-or-init.stderr @@ -11,6 +11,6 @@ LL | println!("{}", i); | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr b/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr index 7f42becd2..7b2cac987 100644 --- a/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr +++ b/tests/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.stderr @@ -9,6 +9,6 @@ LL | LL | read(*i); | -- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr b/tests/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr index f5f4817e9..b4106702c 100644 --- a/tests/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr +++ b/tests/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr @@ -9,6 +9,6 @@ help: consider borrowing here LL | let bad = &v[0]; | + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/borrowck-partial-reinit-2.stderr b/tests/ui/borrowck/borrowck-partial-reinit-2.stderr index 36a871fbb..e25ca082b 100644 --- a/tests/ui/borrowck/borrowck-partial-reinit-2.stderr +++ b/tests/ui/borrowck/borrowck-partial-reinit-2.stderr @@ -8,6 +8,6 @@ LL | let mut u = Test { a: 2, b: Some(Box::new(t))}; LL | t.b = Some(Box::new(u)); | ^^^ value assigned here after move -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-partial-reinit-3.stderr b/tests/ui/borrowck/borrowck-partial-reinit-3.stderr index 05f5411ee..291737952 100644 --- a/tests/ui/borrowck/borrowck-partial-reinit-3.stderr +++ b/tests/ui/borrowck/borrowck-partial-reinit-3.stderr @@ -8,6 +8,6 @@ LL | x.0.f = 3; | = note: move occurs because `x.0` has type `Test`, which does not implement the `Copy` trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-partial-reinit-4.stderr b/tests/ui/borrowck/borrowck-partial-reinit-4.stderr index d12a482cb..4833e689c 100644 --- a/tests/ui/borrowck/borrowck-partial-reinit-4.stderr +++ b/tests/ui/borrowck/borrowck-partial-reinit-4.stderr @@ -8,6 +8,6 @@ LL | (x.0).0 = Some(Test); | = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr b/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr index b86a86938..387c681fd 100644 --- a/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr +++ b/tests/ui/borrowck/borrowck-pat-reassign-binding.stderr @@ -9,6 +9,6 @@ LL | x = Some(*i+1); LL | drop(i); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr b/tests/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr index f28c42ce2..65748d844 100644 --- a/tests/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr +++ b/tests/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr @@ -10,5 +10,5 @@ LL | S { pointer: &mut *p.pointer } | = help: consider adding the following bound: `'a: 'b` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/borrowck-ref-mut-of-imm.stderr b/tests/ui/borrowck/borrowck-ref-mut-of-imm.stderr index 5cfd81bd0..5f319112b 100644 --- a/tests/ui/borrowck/borrowck-ref-mut-of-imm.stderr +++ b/tests/ui/borrowck/borrowck-ref-mut-of-imm.stderr @@ -9,6 +9,6 @@ help: consider changing this to be mutable LL | fn destructure(mut x: Option<isize>) -> isize { | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/borrowck-reinit.stderr b/tests/ui/borrowck/borrowck-reinit.stderr index f785900d5..16047efa3 100644 --- a/tests/ui/borrowck/borrowck-reinit.stderr +++ b/tests/ui/borrowck/borrowck-reinit.stderr @@ -14,6 +14,6 @@ help: consider cloning the value if the performance cost is acceptable LL | drop(x.clone()); | ++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr b/tests/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr index d54449ac4..eade7d1ea 100644 --- a/tests/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr +++ b/tests/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr @@ -7,6 +7,6 @@ LL | (&x).clone() | returns a value referencing data owned by the current function | `x` is borrowed here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/borrowck-return.stderr b/tests/ui/borrowck/borrowck-return.stderr index 9799357c9..a1bc3008e 100644 --- a/tests/ui/borrowck/borrowck-return.stderr +++ b/tests/ui/borrowck/borrowck-return.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let x: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-storage-dead.stderr b/tests/ui/borrowck/borrowck-storage-dead.stderr index 3a413153a..a08e2a7b5 100644 --- a/tests/ui/borrowck/borrowck-storage-dead.stderr +++ b/tests/ui/borrowck/borrowck-storage-dead.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let x: i32 = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr index 1c55953c9..225a983ba 100644 --- a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr +++ b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr @@ -9,6 +9,6 @@ LL | *t1 = 22; LL | p.use_ref(); | - immutable borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr b/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr index 2f397f6b5..11ee8f7bb 100644 --- a/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr +++ b/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr @@ -6,6 +6,6 @@ LL | assert_static(&FOO); LL | } | - end of enclosing function is here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0712`. diff --git a/tests/ui/borrowck/borrowck-unary-move.stderr b/tests/ui/borrowck/borrowck-unary-move.stderr index f3b962059..e6c3869f6 100644 --- a/tests/ui/borrowck/borrowck-unary-move.stderr +++ b/tests/ui/borrowck/borrowck-unary-move.stderr @@ -10,6 +10,6 @@ LL | free(x); LL | *y | -- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/borrowck-uninit-after-item.stderr b/tests/ui/borrowck/borrowck-uninit-after-item.stderr index 071598b42..06bb419aa 100644 --- a/tests/ui/borrowck/borrowck-uninit-after-item.stderr +++ b/tests/ui/borrowck/borrowck-uninit-after-item.stderr @@ -12,6 +12,6 @@ help: consider assigning a value LL | let bar = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-uninit.stderr b/tests/ui/borrowck/borrowck-uninit.stderr index eeafc4ce1..213b541b8 100644 --- a/tests/ui/borrowck/borrowck-uninit.stderr +++ b/tests/ui/borrowck/borrowck-uninit.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let x: isize = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr index f2e549cd8..68a950dfd 100644 --- a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr +++ b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr @@ -8,6 +8,6 @@ LL | let b = u.c; LL | ra.use_mut(); | -- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0503`. diff --git a/tests/ui/borrowck/borrowck-union-move-assign.stderr b/tests/ui/borrowck/borrowck-union-move-assign.stderr index af6f6fac4..8c0239a3a 100644 --- a/tests/ui/borrowck/borrowck-union-move-assign.stderr +++ b/tests/ui/borrowck/borrowck-union-move-assign.stderr @@ -8,6 +8,6 @@ LL | let a = u.a; LL | let a = u.a; | ^^^ value used here after move -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr b/tests/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr index 55f3ff553..dcbaa7533 100644 --- a/tests/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr +++ b/tests/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let x: &i32 = todo!(); | +++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr b/tests/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr index ea3d0d3ef..7ccf6a4c3 100644 --- a/tests/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr +++ b/tests/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let x: &i32 = todo!(); | +++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr index 5141fcc1b..d5964d28b 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr @@ -9,6 +9,6 @@ LL | v.push(tail[0] + tail[1]); | | | second mutable borrow occurs here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr index 494d8c351..03a7efacb 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-move-tail.stderr @@ -9,6 +9,6 @@ LL | a[2] = 0; LL | println!("t[0]: {}", t[0]); | ---- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/tests/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr index 7e21c55f2..2187437a1 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr @@ -7,6 +7,6 @@ LL | let vec: &[isize] = &vec; LL | tail | ^^^^ returns a value referencing data owned by the current function -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/borrowck-while-break.stderr b/tests/ui/borrowck/borrowck-while-break.stderr index 13143d436..e91af728b 100644 --- a/tests/ui/borrowck/borrowck-while-break.stderr +++ b/tests/ui/borrowck/borrowck-while-break.stderr @@ -11,6 +11,6 @@ LL | println!("{}", v); | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-while-cond.stderr b/tests/ui/borrowck/borrowck-while-cond.stderr index 5d0194989..2d92b45e0 100644 --- a/tests/ui/borrowck/borrowck-while-cond.stderr +++ b/tests/ui/borrowck/borrowck-while-cond.stderr @@ -11,6 +11,6 @@ help: consider assigning a value LL | let x: bool = false; | +++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/borrowck-while.stderr b/tests/ui/borrowck/borrowck-while.stderr index c45235990..d560b9c02 100644 --- a/tests/ui/borrowck/borrowck-while.stderr +++ b/tests/ui/borrowck/borrowck-while.stderr @@ -8,6 +8,6 @@ LL | while 1 == 1 { x = 10; } LL | return x; | ^ `x` used here but it is possibly-uninitialized -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/clone-span-on-try-operator.fixed b/tests/ui/borrowck/clone-span-on-try-operator.fixed index 52f66e43a..4fad75b9a 100644 --- a/tests/ui/borrowck/clone-span-on-try-operator.fixed +++ b/tests/ui/borrowck/clone-span-on-try-operator.fixed @@ -7,5 +7,5 @@ impl Foo { } fn main() { let foo = &Foo; - (*foo).clone().foo(); //~ ERROR cannot move out + <Foo as Clone>::clone(&(*foo)).foo(); //~ ERROR cannot move out } diff --git a/tests/ui/borrowck/clone-span-on-try-operator.stderr b/tests/ui/borrowck/clone-span-on-try-operator.stderr index 85785e670..adf84e49a 100644 --- a/tests/ui/borrowck/clone-span-on-try-operator.stderr +++ b/tests/ui/borrowck/clone-span-on-try-operator.stderr @@ -13,9 +13,9 @@ LL | fn foo(self) {} | ^^^^ help: you can `clone` the value and consume it, but this might not be your desired behavior | -LL | (*foo).clone().foo(); - | ++++++++ +LL | <Foo as Clone>::clone(&(*foo)).foo(); + | +++++++++++++++++++++++ + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.stderr b/tests/ui/borrowck/copy-suggestion-region-vid.stderr index b344aa664..3a801a22e 100644 --- a/tests/ui/borrowck/copy-suggestion-region-vid.stderr +++ b/tests/ui/borrowck/copy-suggestion-region-vid.stderr @@ -14,6 +14,6 @@ help: consider cloning the value if the performance cost is acceptable LL | HelperStruct { helpers: helpers.clone(), is_empty: helpers[0].is_empty() } | +++++++++++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr b/tests/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr index 78ca090fe..879ff8be0 100644 --- a/tests/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr +++ b/tests/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr @@ -14,5 +14,5 @@ LL | move || { iter.next() } = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/drop-in-loop.stderr b/tests/ui/borrowck/drop-in-loop.stderr index d5734e7ec..98dae19a7 100644 --- a/tests/ui/borrowck/drop-in-loop.stderr +++ b/tests/ui/borrowck/drop-in-loop.stderr @@ -9,6 +9,6 @@ LL | base = false; LL | wrapper = WrapperWithDrop(&mut base); | ------- borrow might be used here, when `wrapper` is dropped and runs the `Drop` code for type `WrapperWithDrop` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/generic_const_early_param.rs b/tests/ui/borrowck/generic_const_early_param.rs new file mode 100644 index 000000000..f601e45d2 --- /dev/null +++ b/tests/ui/borrowck/generic_const_early_param.rs @@ -0,0 +1,16 @@ +#![feature(generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete + +struct DataWrapper<'static> { + //~^ ERROR invalid lifetime parameter name: `'static` + data: &'a [u8; Self::SIZE], + //~^ ERROR use of undeclared lifetime name `'a` + //~^^ ERROR lifetime may not live long enough +} + +impl DataWrapper<'a> { + //~^ ERROR undeclared lifetime + const SIZE: usize = 14; +} + +fn main(){} diff --git a/tests/ui/borrowck/generic_const_early_param.stderr b/tests/ui/borrowck/generic_const_early_param.stderr new file mode 100644 index 000000000..a71ab0939 --- /dev/null +++ b/tests/ui/borrowck/generic_const_early_param.stderr @@ -0,0 +1,42 @@ +error[E0262]: invalid lifetime parameter name: `'static` + --> $DIR/generic_const_early_param.rs:4:20 + | +LL | struct DataWrapper<'static> { + | ^^^^^^^ 'static is a reserved lifetime name + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/generic_const_early_param.rs:6:12 + | +LL | struct DataWrapper<'static> { + | - help: consider introducing lifetime `'a` here: `'a,` +LL | +LL | data: &'a [u8; Self::SIZE], + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/generic_const_early_param.rs:11:18 + | +LL | impl DataWrapper<'a> { + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `<'a>` + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/generic_const_early_param.rs:1:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: lifetime may not live long enough + --> $DIR/generic_const_early_param.rs:6:20 + | +LL | data: &'a [u8; Self::SIZE], + | ^^^^^^^^^^ requires that `'_` must outlive `'static` + +error: aborting due to 4 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0261, E0262. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/borrowck/immutable-arg.stderr b/tests/ui/borrowck/immutable-arg.stderr index bddb0633a..84a480f64 100644 --- a/tests/ui/borrowck/immutable-arg.stderr +++ b/tests/ui/borrowck/immutable-arg.stderr @@ -6,6 +6,6 @@ LL | fn foo(_x: u32) { LL | _x = 4; | ^^^^^^ cannot assign to immutable argument -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0384`. diff --git a/tests/ui/borrowck/index-mut-help-with-impl.stderr b/tests/ui/borrowck/index-mut-help-with-impl.stderr index 89391f409..a97f2bdd4 100644 --- a/tests/ui/borrowck/index-mut-help-with-impl.stderr +++ b/tests/ui/borrowck/index-mut-help-with-impl.stderr @@ -4,6 +4,6 @@ error[E0596]: cannot borrow data in a `&` reference as mutable LL | Index::index(&v, 1..2).make_ascii_uppercase(); | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-101119.stderr b/tests/ui/borrowck/issue-101119.stderr index a22afdc67..1f32ece3d 100644 --- a/tests/ui/borrowck/issue-101119.stderr +++ b/tests/ui/borrowck/issue-101119.stderr @@ -10,6 +10,6 @@ LL | LL | fill_segment(state); | ----- use occurs due to use in closure -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/issue-103250.stderr b/tests/ui/borrowck/issue-103250.stderr index 4a2378352..b7ece5d97 100644 --- a/tests/ui/borrowck/issue-103250.stderr +++ b/tests/ui/borrowck/issue-103250.stderr @@ -12,6 +12,6 @@ help: consider assigning a value LL | let mut last_error: Box<dyn std::error::Error> = todo!(); | +++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr index 8221505b1..3ee89d973 100644 --- a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr +++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr @@ -9,7 +9,7 @@ LL | let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3); LL | bar(x); | - borrow later used here | - = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used + = note: the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html> = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -24,7 +24,7 @@ LL | LL | bar(foo); | --- borrow later used here | - = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used + = note: the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html> = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/borrowck/issue-11493.stderr b/tests/ui/borrowck/issue-11493.stderr index 2720b09b0..211d4cb3e 100644 --- a/tests/ui/borrowck/issue-11493.stderr +++ b/tests/ui/borrowck/issue-11493.stderr @@ -14,6 +14,6 @@ LL ~ let binding = id(5); LL ~ let y = x.as_ref().unwrap_or(&binding); | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 7e0fc2cf2..40ab2e61d 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -11,6 +11,6 @@ help: you may want to use `iter_mut` here LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) | ~~~~~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-17545.stderr b/tests/ui/borrowck/issue-17545.stderr index 3ae7e64d2..45e977e39 100644 --- a/tests/ui/borrowck/issue-17545.stderr +++ b/tests/ui/borrowck/issue-17545.stderr @@ -11,6 +11,6 @@ LL | | )); | |______| | argument requires that borrow lasts for `'a` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/issue-17718-static-move.stderr b/tests/ui/borrowck/issue-17718-static-move.stderr index 65aea5b18..5ca0a7fb8 100644 --- a/tests/ui/borrowck/issue-17718-static-move.stderr +++ b/tests/ui/borrowck/issue-17718-static-move.stderr @@ -9,6 +9,6 @@ help: consider borrowing here LL | let _a = &FOO; | + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/issue-25793.stderr b/tests/ui/borrowck/issue-25793.stderr index 27dab53e4..e2efc405f 100644 --- a/tests/ui/borrowck/issue-25793.stderr +++ b/tests/ui/borrowck/issue-25793.stderr @@ -13,6 +13,6 @@ LL | r.get_size(width!(self)) | = note: this error originates in the macro `width` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0503`. diff --git a/tests/ui/borrowck/issue-33819.stderr b/tests/ui/borrowck/issue-33819.stderr index f77fdbf2b..41c9d6aac 100644 --- a/tests/ui/borrowck/issue-33819.stderr +++ b/tests/ui/borrowck/issue-33819.stderr @@ -7,6 +7,6 @@ LL | Some(ref v) => { let a = &mut v; }, | cannot borrow as mutable | help: try removing `&mut` here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-36082.stderr b/tests/ui/borrowck/issue-36082.stderr index a6357f818..47c78d686 100644 --- a/tests/ui/borrowck/issue-36082.stderr +++ b/tests/ui/borrowck/issue-36082.stderr @@ -15,6 +15,6 @@ LL ~ let binding = x.borrow(); LL ~ let val: &_ = binding.0; | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/borrowck/issue-41962.stderr b/tests/ui/borrowck/issue-41962.stderr index 716cc9d0c..8585376b9 100644 --- a/tests/ui/borrowck/issue-41962.stderr +++ b/tests/ui/borrowck/issue-41962.stderr @@ -10,6 +10,6 @@ help: borrow this binding in the pattern to avoid moving the value LL | if let Some(ref thing) = maybe { | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/issue-42344.stderr b/tests/ui/borrowck/issue-42344.stderr index 5cffa1b51..bf82d462b 100644 --- a/tests/ui/borrowck/issue-42344.stderr +++ b/tests/ui/borrowck/issue-42344.stderr @@ -4,6 +4,6 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable stati LL | TAB[0].iter_mut(); | ^^^^^^ cannot borrow as mutable -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-45983.stderr b/tests/ui/borrowck/issue-45983.stderr index feb098c59..19a4a98bb 100644 --- a/tests/ui/borrowck/issue-45983.stderr +++ b/tests/ui/borrowck/issue-45983.stderr @@ -8,6 +8,6 @@ LL | give_any(|y| x = Some(y)); | | | `y` is a reference that is only valid in the closure body -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/borrowck/issue-46471.stderr b/tests/ui/borrowck/issue-46471.stderr index 935414c1f..17e4b5e8d 100644 --- a/tests/ui/borrowck/issue-46471.stderr +++ b/tests/ui/borrowck/issue-46471.stderr @@ -4,6 +4,6 @@ error[E0515]: cannot return reference to local variable `x` LL | &x | ^^ returns a reference to data owned by the current function -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/issue-47215-ice-from-drop-elab.stderr b/tests/ui/borrowck/issue-47215-ice-from-drop-elab.stderr index 8d4918867..d6aeb410e 100644 --- a/tests/ui/borrowck/issue-47215-ice-from-drop-elab.stderr +++ b/tests/ui/borrowck/issue-47215-ice-from-drop-elab.stderr @@ -9,6 +9,6 @@ help: consider borrowing here LL | let mut x = &X; | + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/issue-47646.stderr b/tests/ui/borrowck/issue-47646.stderr index d82e1f908..85adfc03d 100644 --- a/tests/ui/borrowck/issue-47646.stderr +++ b/tests/ui/borrowck/issue-47646.stderr @@ -15,6 +15,6 @@ LL | }; | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/issue-51117.stderr b/tests/ui/borrowck/issue-51117.stderr index f8a9608ad..d19fa18df 100644 --- a/tests/ui/borrowck/issue-51117.stderr +++ b/tests/ui/borrowck/issue-51117.stderr @@ -8,6 +8,6 @@ LL | bar.take(); LL | drop(baz); | --- first borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/issue-51301.stderr b/tests/ui/borrowck/issue-51301.stderr index 6ec920cb8..c0b064370 100644 --- a/tests/ui/borrowck/issue-51301.stderr +++ b/tests/ui/borrowck/issue-51301.stderr @@ -12,6 +12,6 @@ help: consider borrowing the pattern binding LL | .find(|(&ref event_type, _)| event == event_type) | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/issue-51415.stderr b/tests/ui/borrowck/issue-51415.stderr index 0d486b455..e51e0b33e 100644 --- a/tests/ui/borrowck/issue-51415.stderr +++ b/tests/ui/borrowck/issue-51415.stderr @@ -12,6 +12,6 @@ help: consider borrowing the pattern binding LL | let opt = a.iter().enumerate().find(|(_, &ref s)| { | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/issue-52713-bug.stderr b/tests/ui/borrowck/issue-52713-bug.stderr index 3f7715645..ac4936bac 100644 --- a/tests/ui/borrowck/issue-52713-bug.stderr +++ b/tests/ui/borrowck/issue-52713-bug.stderr @@ -9,6 +9,6 @@ LL | x += 1; LL | println!("{}", y); | - borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr index 3debfb62c..588775280 100644 --- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr +++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr @@ -15,5 +15,5 @@ help: consider adding 'move' keyword before the nested closure LL | move || f() // The `nested` closure | ++++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index 99c63e4db..121c2e870 100644 --- a/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -10,6 +10,6 @@ LL - *array LL + array | -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr b/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr index 967451c68..630d07d65 100644 --- a/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr +++ b/tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr @@ -12,6 +12,6 @@ LL | greeting = "DEALLOCATED".to_string(); LL | println!("thread result: {:?}", res); | --- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr b/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr index 8fe8fa710..e19f37538 100644 --- a/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr +++ b/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr @@ -12,6 +12,6 @@ help: consider assigning a value LL | let e: i32 = 0; | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 19f194100..466f19eb0 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -11,6 +11,6 @@ help: you may want to use `iter_mut` here LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>(); | ~~~~~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-69789-iterator-mut-suggestion.stderr b/tests/ui/borrowck/issue-69789-iterator-mut-suggestion.stderr index 369a8c61d..87b8e0591 100644 --- a/tests/ui/borrowck/issue-69789-iterator-mut-suggestion.stderr +++ b/tests/ui/borrowck/issue-69789-iterator-mut-suggestion.stderr @@ -7,6 +7,6 @@ LL | LL | *item = (); | ^^^^^^^^^^ `item` is a `&` reference, so the data it refers to cannot be written -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/borrowck/issue-7573.stderr b/tests/ui/borrowck/issue-7573.stderr index 9d86286b8..07a67474c 100644 --- a/tests/ui/borrowck/issue-7573.stderr +++ b/tests/ui/borrowck/issue-7573.stderr @@ -10,6 +10,6 @@ LL | LL | lines_to_use.push(installed_id); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/borrowck/issue-81365-1.stderr b/tests/ui/borrowck/issue-81365-1.stderr index 0d803b042..94566ae19 100644 --- a/tests/ui/borrowck/issue-81365-1.stderr +++ b/tests/ui/borrowck/issue-81365-1.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = DerefTarget; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-10.stderr b/tests/ui/borrowck/issue-81365-10.stderr index 2bbde82fa..7681ee68c 100644 --- a/tests/ui/borrowck/issue-81365-10.stderr +++ b/tests/ui/borrowck/issue-81365-10.stderr @@ -8,6 +8,6 @@ LL | self.container_field = true; LL | first; | ----- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-11.stderr b/tests/ui/borrowck/issue-81365-11.stderr index 5f7e86f11..f1f28dcce 100644 --- a/tests/ui/borrowck/issue-81365-11.stderr +++ b/tests/ui/borrowck/issue-81365-11.stderr @@ -8,6 +8,6 @@ LL | self.container_field = true; LL | first; | ----- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-2.stderr b/tests/ui/borrowck/issue-81365-2.stderr index d9aeaf15f..f55da67a8 100644 --- a/tests/ui/borrowck/issue-81365-2.stderr +++ b/tests/ui/borrowck/issue-81365-2.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = DerefTarget; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-3.stderr b/tests/ui/borrowck/issue-81365-3.stderr index 0c0d1994b..f1c24640c 100644 --- a/tests/ui/borrowck/issue-81365-3.stderr +++ b/tests/ui/borrowck/issue-81365-3.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = Container; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-4.stderr b/tests/ui/borrowck/issue-81365-4.stderr index 98093daa9..c0dae0de3 100644 --- a/tests/ui/borrowck/issue-81365-4.stderr +++ b/tests/ui/borrowck/issue-81365-4.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = Container; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-5.stderr b/tests/ui/borrowck/issue-81365-5.stderr index 094cec021..06c2ea5ab 100644 --- a/tests/ui/borrowck/issue-81365-5.stderr +++ b/tests/ui/borrowck/issue-81365-5.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = DerefTarget; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-6.stderr b/tests/ui/borrowck/issue-81365-6.stderr index e61dc95ec..e52ebf938 100644 --- a/tests/ui/borrowck/issue-81365-6.stderr +++ b/tests/ui/borrowck/issue-81365-6.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = [()]; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-7.stderr b/tests/ui/borrowck/issue-81365-7.stderr index 0565127e3..1933f5bd8 100644 --- a/tests/ui/borrowck/issue-81365-7.stderr +++ b/tests/ui/borrowck/issue-81365-7.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = DerefTarget; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-8.stderr b/tests/ui/borrowck/issue-81365-8.stderr index 0ca732ff2..ab9f71cc0 100644 --- a/tests/ui/borrowck/issue-81365-8.stderr +++ b/tests/ui/borrowck/issue-81365-8.stderr @@ -15,6 +15,6 @@ note: deref defined here LL | type Target = DerefTarget; | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81365-9.stderr b/tests/ui/borrowck/issue-81365-9.stderr index 4d305268a..f0aefd7ba 100644 --- a/tests/ui/borrowck/issue-81365-9.stderr +++ b/tests/ui/borrowck/issue-81365-9.stderr @@ -8,6 +8,6 @@ LL | self.container_field = true; LL | first; | ----- borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0506`. diff --git a/tests/ui/borrowck/issue-81899.stderr b/tests/ui/borrowck/issue-81899.stderr index 5ff33933c..1da573ea9 100644 --- a/tests/ui/borrowck/issue-81899.stderr +++ b/tests/ui/borrowck/issue-81899.stderr @@ -22,6 +22,6 @@ note: erroneous constant encountered LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/borrowck/issue-82032.stderr b/tests/ui/borrowck/issue-82032.stderr index f272477a9..2ac785cd1 100644 --- a/tests/ui/borrowck/issue-82032.stderr +++ b/tests/ui/borrowck/issue-82032.stderr @@ -9,6 +9,6 @@ LL | for v in self.0.values() { LL | v.flush(); | ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-82462.stderr b/tests/ui/borrowck/issue-82462.stderr index a2c291f77..8cb4583eb 100644 --- a/tests/ui/borrowck/issue-82462.stderr +++ b/tests/ui/borrowck/issue-82462.stderr @@ -17,6 +17,6 @@ help: consider adding semicolon after the expression so its temporaries are drop LL | }; | + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/issue-83309-ice-immut-in-for-loop.stderr b/tests/ui/borrowck/issue-83309-ice-immut-in-for-loop.stderr index 26ce007dd..4e7a9b695 100644 --- a/tests/ui/borrowck/issue-83309-ice-immut-in-for-loop.stderr +++ b/tests/ui/borrowck/issue-83309-ice-immut-in-for-loop.stderr @@ -7,6 +7,6 @@ LL | LL | *v -= 1; | ^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be written -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/borrowck/issue-83760.fixed b/tests/ui/borrowck/issue-83760.fixed new file mode 100644 index 000000000..4544eeb6e --- /dev/null +++ b/tests/ui/borrowck/issue-83760.fixed @@ -0,0 +1,47 @@ +// run-rustfix +#![allow(unused_variables, dead_code)] +#[derive(Clone)] +struct Struct; +#[derive(Clone)] +struct Struct2; +// We use a second one here because otherwise when applying suggestions we'd end up with two +// `#[derive(Clone)]` annotations. + +fn test1() { + let mut val = Some(Struct); + while let Some(ref foo) = val { //~ ERROR use of moved value + if true { + val = None; + } else { + + } + } +} + +fn test2() { + let mut foo = Some(Struct); + let _x = foo.clone().unwrap(); + if true { + foo = Some(Struct); + } else { + } + let _y = foo; //~ ERROR use of moved value: `foo` +} + +fn test3() { + let mut foo = Some(Struct2); + let _x = foo.clone().unwrap(); + if true { + foo = Some(Struct2); + } else if true { + foo = Some(Struct2); + } else if true { + foo = Some(Struct2); + } else if true { + foo = Some(Struct2); + } else { + } + let _y = foo; //~ ERROR use of moved value: `foo` +} + +fn main() {} diff --git a/tests/ui/borrowck/issue-83760.rs b/tests/ui/borrowck/issue-83760.rs index e25b4f727..81bfdf0fc 100644 --- a/tests/ui/borrowck/issue-83760.rs +++ b/tests/ui/borrowck/issue-83760.rs @@ -1,4 +1,9 @@ +// run-rustfix +#![allow(unused_variables, dead_code)] struct Struct; +struct Struct2; +// We use a second one here because otherwise when applying suggestions we'd end up with two +// `#[derive(Clone)]` annotations. fn test1() { let mut val = Some(Struct); @@ -22,16 +27,16 @@ fn test2() { } fn test3() { - let mut foo = Some(Struct); + let mut foo = Some(Struct2); let _x = foo.unwrap(); if true { - foo = Some(Struct); + foo = Some(Struct2); } else if true { - foo = Some(Struct); + foo = Some(Struct2); } else if true { - foo = Some(Struct); + foo = Some(Struct2); } else if true { - foo = Some(Struct); + foo = Some(Struct2); } else { } let _y = foo; //~ ERROR use of moved value: `foo` diff --git a/tests/ui/borrowck/issue-83760.stderr b/tests/ui/borrowck/issue-83760.stderr index a585bff0c..d120adbc0 100644 --- a/tests/ui/borrowck/issue-83760.stderr +++ b/tests/ui/borrowck/issue-83760.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value - --> $DIR/issue-83760.rs:5:20 + --> $DIR/issue-83760.rs:10:20 | LL | while let Some(foo) = val { | ^^^ value moved here, in previous iteration of loop @@ -14,7 +14,7 @@ LL | while let Some(ref foo) = val { | +++ error[E0382]: use of moved value: `foo` - --> $DIR/issue-83760.rs:21:14 + --> $DIR/issue-83760.rs:26:14 | LL | let mut foo = Some(Struct); | ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait @@ -29,12 +29,21 @@ LL | let _y = foo; | note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL +help: you could `clone` the value and consume it, if the `Struct: Clone` trait bound could be satisfied + | +LL | let _x = foo.clone().unwrap(); + | ++++++++ +help: consider annotating `Struct` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct Struct; + | error[E0382]: use of moved value: `foo` - --> $DIR/issue-83760.rs:37:14 + --> $DIR/issue-83760.rs:42:14 | -LL | let mut foo = Some(Struct); - | ------- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait +LL | let mut foo = Some(Struct2); + | ------- move occurs because `foo` has type `Option<Struct2>`, which does not implement the `Copy` trait LL | let _x = foo.unwrap(); | -------- `foo` moved due to this method call ... @@ -42,18 +51,27 @@ LL | let _y = foo; | ^^^ value used here after move | note: these 3 reinitializations and 1 other might get skipped - --> $DIR/issue-83760.rs:30:9 + --> $DIR/issue-83760.rs:35:9 | -LL | foo = Some(Struct); - | ^^^^^^^^^^^^^^^^^^ +LL | foo = Some(Struct2); + | ^^^^^^^^^^^^^^^^^^^ LL | } else if true { -LL | foo = Some(Struct); - | ^^^^^^^^^^^^^^^^^^ +LL | foo = Some(Struct2); + | ^^^^^^^^^^^^^^^^^^^ LL | } else if true { -LL | foo = Some(Struct); - | ^^^^^^^^^^^^^^^^^^ +LL | foo = Some(Struct2); + | ^^^^^^^^^^^^^^^^^^^ note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL +help: you could `clone` the value and consume it, if the `Struct2: Clone` trait bound could be satisfied + | +LL | let _x = foo.clone().unwrap(); + | ++++++++ +help: consider annotating `Struct2` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct Struct2; + | error: aborting due to 3 previous errors diff --git a/tests/ui/borrowck/issue-83924.stderr b/tests/ui/borrowck/issue-83924.stderr index 572414df2..c37de178f 100644 --- a/tests/ui/borrowck/issue-83924.stderr +++ b/tests/ui/borrowck/issue-83924.stderr @@ -17,6 +17,6 @@ help: consider creating a fresh reborrow of `v` here LL | for n in &mut *v { | ++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/issue-85581.stderr b/tests/ui/borrowck/issue-85581.stderr index 29c0429f2..80f1f4cb5 100644 --- a/tests/ui/borrowck/issue-85581.stderr +++ b/tests/ui/borrowck/issue-85581.stderr @@ -12,6 +12,6 @@ LL | Some(_) => { heap.pop(); }, LL | } | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/issue-85765-closure.rs b/tests/ui/borrowck/issue-85765-closure.rs index f2d1dd0fb..edc9eeaff 100644 --- a/tests/ui/borrowck/issue-85765-closure.rs +++ b/tests/ui/borrowck/issue-85765-closure.rs @@ -3,6 +3,7 @@ fn main() { let mut test = Vec::new(); let rofl: &Vec<Vec<i32>> = &mut test; //~^ HELP consider changing this binding's type + //~| HELP you can `clone` the `Vec<Vec<i32>>` value and consume it, but this might not be your desired behavior rofl.push(Vec::new()); //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable diff --git a/tests/ui/borrowck/issue-85765-closure.stderr b/tests/ui/borrowck/issue-85765-closure.stderr index 936ddd67b..4a6a0e94b 100644 --- a/tests/ui/borrowck/issue-85765-closure.stderr +++ b/tests/ui/borrowck/issue-85765-closure.stderr @@ -1,16 +1,21 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference - --> $DIR/issue-85765-closure.rs:6:9 + --> $DIR/issue-85765-closure.rs:7:9 | LL | rofl.push(Vec::new()); | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable | +help: you can `clone` the `Vec<Vec<i32>>` value and consume it, but this might not be your desired behavior + --> $DIR/issue-85765-closure.rs:4:36 + | +LL | let rofl: &Vec<Vec<i32>> = &mut test; + | ^^^^^^^^^ help: consider changing this binding's type | LL | let rofl: &mut Vec<Vec<i32>> = &mut test; | ~~~~~~~~~~~~~~~~~~ error[E0594]: cannot assign to `*r`, which is behind a `&` reference - --> $DIR/issue-85765-closure.rs:13:9 + --> $DIR/issue-85765-closure.rs:14:9 | LL | *r = 0; | ^^^^^^ `r` is a `&` reference, so the data it refers to cannot be written @@ -21,7 +26,7 @@ LL | let r = &mut mutvar; | +++ error[E0594]: cannot assign to `*x`, which is behind a `&` reference - --> $DIR/issue-85765-closure.rs:20:9 + --> $DIR/issue-85765-closure.rs:21:9 | LL | *x = 1; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written @@ -32,7 +37,7 @@ LL | let x: &mut usize = &mut{0}; | ~~~~~~~~~~ error[E0594]: cannot assign to `*y`, which is behind a `&` reference - --> $DIR/issue-85765-closure.rs:27:9 + --> $DIR/issue-85765-closure.rs:28:9 | LL | *y = 1; | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written diff --git a/tests/ui/borrowck/issue-85765.rs b/tests/ui/borrowck/issue-85765.rs index 76e0b5173..ce5740bc0 100644 --- a/tests/ui/borrowck/issue-85765.rs +++ b/tests/ui/borrowck/issue-85765.rs @@ -2,6 +2,7 @@ fn main() { let mut test = Vec::new(); let rofl: &Vec<Vec<i32>> = &mut test; //~^ HELP consider changing this binding's type + //~| HELP you can `clone` the `Vec<Vec<i32>>` value and consume it, but this might not be your desired behavior rofl.push(Vec::new()); //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr index 57900bfb6..4889f774a 100644 --- a/tests/ui/borrowck/issue-85765.stderr +++ b/tests/ui/borrowck/issue-85765.stderr @@ -1,16 +1,21 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference - --> $DIR/issue-85765.rs:5:5 + --> $DIR/issue-85765.rs:6:5 | LL | rofl.push(Vec::new()); | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable | +help: you can `clone` the `Vec<Vec<i32>>` value and consume it, but this might not be your desired behavior + --> $DIR/issue-85765.rs:3:32 + | +LL | let rofl: &Vec<Vec<i32>> = &mut test; + | ^^^^^^^^^ help: consider changing this binding's type | LL | let rofl: &mut Vec<Vec<i32>> = &mut test; | ~~~~~~~~~~~~~~~~~~ error[E0594]: cannot assign to `*r`, which is behind a `&` reference - --> $DIR/issue-85765.rs:12:5 + --> $DIR/issue-85765.rs:13:5 | LL | *r = 0; | ^^^^^^ `r` is a `&` reference, so the data it refers to cannot be written @@ -21,7 +26,7 @@ LL | let r = &mut mutvar; | +++ error[E0594]: cannot assign to `*x`, which is behind a `&` reference - --> $DIR/issue-85765.rs:19:5 + --> $DIR/issue-85765.rs:20:5 | LL | *x = 1; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written @@ -32,7 +37,7 @@ LL | let x: &mut usize = &mut{0}; | ~~~~~~~~~~ error[E0594]: cannot assign to `*y`, which is behind a `&` reference - --> $DIR/issue-85765.rs:26:5 + --> $DIR/issue-85765.rs:27:5 | LL | *y = 1; | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written diff --git a/tests/ui/borrowck/issue-87456-point-to-closure.stderr b/tests/ui/borrowck/issue-87456-point-to-closure.stderr index afd141125..a15909df0 100644 --- a/tests/ui/borrowck/issue-87456-point-to-closure.stderr +++ b/tests/ui/borrowck/issue-87456-point-to-closure.stderr @@ -15,6 +15,6 @@ help: consider borrowing here LL | let _foo: String = &val; | + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/issue-88434-minimal-example.stderr b/tests/ui/borrowck/issue-88434-minimal-example.stderr index 7b785b25b..b32331ce4 100644 --- a/tests/ui/borrowck/issue-88434-minimal-example.stderr +++ b/tests/ui/borrowck/issue-88434-minimal-example.stderr @@ -22,6 +22,6 @@ note: erroneous constant encountered LL | const _CONST: &() = &f(&|_| {}); | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index 9732b8cfa..e3c881dd4 100644 --- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -22,6 +22,6 @@ note: erroneous constant encountered LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/borrowck/issue-91206.rs b/tests/ui/borrowck/issue-91206.rs index e062a2537..c60ac62fa 100644 --- a/tests/ui/borrowck/issue-91206.rs +++ b/tests/ui/borrowck/issue-91206.rs @@ -10,6 +10,7 @@ fn main() { let client = TestClient; let inner = client.get_inner_ref(); //~^ HELP consider specifying this binding's type + //~| HELP you can `clone` the `Vec<usize>` value and consume it, but this might not be your desired behavior inner.clear(); //~^ ERROR cannot borrow `*inner` as mutable, as it is behind a `&` reference [E0596] //~| NOTE `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable diff --git a/tests/ui/borrowck/issue-91206.stderr b/tests/ui/borrowck/issue-91206.stderr index 30f836565..e3dd65b64 100644 --- a/tests/ui/borrowck/issue-91206.stderr +++ b/tests/ui/borrowck/issue-91206.stderr @@ -1,14 +1,19 @@ error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference - --> $DIR/issue-91206.rs:13:5 + --> $DIR/issue-91206.rs:14:5 | LL | inner.clear(); | ^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable | +help: you can `clone` the `Vec<usize>` value and consume it, but this might not be your desired behavior + --> $DIR/issue-91206.rs:11:17 + | +LL | let inner = client.get_inner_ref(); + | ^^^^^^^^^^^^^^^^^^^^^^ help: consider specifying this binding's type | LL | let inner: &mut Vec<usize> = client.get_inner_ref(); | +++++++++++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-92015.stderr b/tests/ui/borrowck/issue-92015.stderr index ea4f9abb8..167a5cf58 100644 --- a/tests/ui/borrowck/issue-92015.stderr +++ b/tests/ui/borrowck/issue-92015.stderr @@ -9,6 +9,6 @@ help: consider specifying this binding's type LL | let foo: &mut i32 = Some(&0).unwrap(); | ++++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/borrowck/issue-92157.stderr b/tests/ui/borrowck/issue-92157.stderr index a46b12889..0ffedccd6 100644 --- a/tests/ui/borrowck/issue-92157.stderr +++ b/tests/ui/borrowck/issue-92157.stderr @@ -7,6 +7,6 @@ LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isi = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _` found signature `fn(fn() -> T, isize, *const *const u8) -> _` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/borrowck/issue-93078.stderr b/tests/ui/borrowck/issue-93078.stderr index bcbcbe724..446b4582b 100644 --- a/tests/ui/borrowck/issue-93078.stderr +++ b/tests/ui/borrowck/issue-93078.stderr @@ -7,6 +7,6 @@ LL | self.modify(); = note: as `Self` may be unsized, this call attempts to take `&mut &mut self` = note: however, `&mut self` expands to `self: &mut Self`, therefore `self` cannot be borrowed mutably -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/issue-93093.stderr b/tests/ui/borrowck/issue-93093.stderr index afa76594f..b6a2768b6 100644 --- a/tests/ui/borrowck/issue-93093.stderr +++ b/tests/ui/borrowck/issue-93093.stderr @@ -9,6 +9,6 @@ help: consider changing this to be a mutable reference LL | async fn bar(&mut self) { | ~~~~~~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/borrowck/many-mutable-borrows.stderr b/tests/ui/borrowck/many-mutable-borrows.stderr index 0f808ac92..bc2ba987c 100644 --- a/tests/ui/borrowck/many-mutable-borrows.stderr +++ b/tests/ui/borrowck/many-mutable-borrows.stderr @@ -28,6 +28,6 @@ help: consider changing this to be mutable LL | let mut v = Vec::new(); | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/move-error-in-promoted-2.stderr b/tests/ui/borrowck/move-error-in-promoted-2.stderr index 38dba94bd..0d5edadcb 100644 --- a/tests/ui/borrowck/move-error-in-promoted-2.stderr +++ b/tests/ui/borrowck/move-error-in-promoted-2.stderr @@ -7,6 +7,6 @@ LL | &([S][0],); | cannot move out of here | move occurs because value has type `S`, which does not implement the `Copy` trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0508`. diff --git a/tests/ui/borrowck/move-error-in-promoted.stderr b/tests/ui/borrowck/move-error-in-promoted.stderr index a4432e38d..03c0297c5 100644 --- a/tests/ui/borrowck/move-error-in-promoted.stderr +++ b/tests/ui/borrowck/move-error-in-promoted.stderr @@ -7,6 +7,6 @@ LL | let _ = S1(C[0]).clone(); | cannot move out of here | move occurs because value has type `S2`, which does not implement the `Copy` trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0508`. diff --git a/tests/ui/borrowck/move-error-snippets.stderr b/tests/ui/borrowck/move-error-snippets.stderr index 8ac711e9e..83f9e19aa 100644 --- a/tests/ui/borrowck/move-error-snippets.stderr +++ b/tests/ui/borrowck/move-error-snippets.stderr @@ -15,6 +15,6 @@ help: consider borrowing here LL | let a = &$c; | + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/move-in-pattern-mut-in-loop.stderr b/tests/ui/borrowck/move-in-pattern-mut-in-loop.stderr index 55948afca..bfbae5be0 100644 --- a/tests/ui/borrowck/move-in-pattern-mut-in-loop.stderr +++ b/tests/ui/borrowck/move-in-pattern-mut-in-loop.stderr @@ -10,6 +10,6 @@ help: borrow this binding in the pattern to avoid moving the value LL | if let Some(ref mut _x) = opt {} | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/mut-borrow-in-loop-2.stderr b/tests/ui/borrowck/mut-borrow-in-loop-2.stderr index 74e7067c9..7b9a946f3 100644 --- a/tests/ui/borrowck/mut-borrow-in-loop-2.stderr +++ b/tests/ui/borrowck/mut-borrow-in-loop-2.stderr @@ -20,6 +20,6 @@ help: consider creating a fresh reborrow of `value` here LL | Other::handle(&mut *value); | ++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/reborrow-sugg-move-then-borrow.stderr b/tests/ui/borrowck/reborrow-sugg-move-then-borrow.stderr index ecd916a59..8590dd9ca 100644 --- a/tests/ui/borrowck/reborrow-sugg-move-then-borrow.stderr +++ b/tests/ui/borrowck/reborrow-sugg-move-then-borrow.stderr @@ -16,6 +16,6 @@ help: consider creating a fresh reborrow of `state` here LL | for _ in &mut *state {} | ++++++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index 7ebea3c03..54d8f26f4 100644 --- a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -22,8 +22,8 @@ error[E0308]: method not compatible with trait LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected signature `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` - found signature `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` + = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)` + found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)` note: the lifetime `'c` as defined here... --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | @@ -41,8 +41,8 @@ error[E0308]: method not compatible with trait LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected signature `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` - found signature `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` + = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)` + found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)` note: the lifetime `'c` as defined here... --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | diff --git a/tests/ui/borrowck/regions-escape-bound-fn-2.stderr b/tests/ui/borrowck/regions-escape-bound-fn-2.stderr index 14393bc8e..9c070de44 100644 --- a/tests/ui/borrowck/regions-escape-bound-fn-2.stderr +++ b/tests/ui/borrowck/regions-escape-bound-fn-2.stderr @@ -8,6 +8,6 @@ LL | with_int(|y| x = Some(y)); | | | `y` is a reference that is only valid in the closure body -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/borrowck/regions-escape-bound-fn.stderr b/tests/ui/borrowck/regions-escape-bound-fn.stderr index a23fdacde..868ba9c89 100644 --- a/tests/ui/borrowck/regions-escape-bound-fn.stderr +++ b/tests/ui/borrowck/regions-escape-bound-fn.stderr @@ -8,6 +8,6 @@ LL | with_int(|y| x = Some(y)); | | | `y` is a reference that is only valid in the closure body -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/borrowck/regions-escape-unboxed-closure.stderr b/tests/ui/borrowck/regions-escape-unboxed-closure.stderr index 153f77c89..c861f772b 100644 --- a/tests/ui/borrowck/regions-escape-unboxed-closure.stderr +++ b/tests/ui/borrowck/regions-escape-unboxed-closure.stderr @@ -8,6 +8,6 @@ LL | with_int(&mut |y| x = Some(y)); | | | `y` is a reference that is only valid in the closure body -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/borrowck/return-local-binding-from-desugaring.stderr b/tests/ui/borrowck/return-local-binding-from-desugaring.stderr index 9f952542e..1f4a548a4 100644 --- a/tests/ui/borrowck/return-local-binding-from-desugaring.stderr +++ b/tests/ui/borrowck/return-local-binding-from-desugaring.stderr @@ -7,6 +7,6 @@ LL | for ref x in xs { LL | result | ^^^^^^ returns a value referencing data owned by the current function -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr index bada08368..1e98006a9 100644 --- a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr +++ b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr @@ -9,6 +9,10 @@ LL | cb.map(|cb| cb()); | note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `*cb` --> $SRC_DIR/core/src/option.rs:LL:COL +help: you could `clone` the value and consume it, if the `&mut dyn FnMut(): Clone` trait bound could be satisfied + | +LL | <Option<&mut dyn FnMut()> as Clone>::clone(&cb).map(|cb| cb()); + | ++++++++++++++++++++++++++++++++++++++++++++ + error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference --> $DIR/suggest-as-ref-on-mut-closure.rs:12:26 diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr index c8d00f7b2..d88e8b096 100644 --- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr +++ b/tests/ui/borrowck/suggest-local-var-for-vector.stderr @@ -19,6 +19,6 @@ help: ...and then using that local here LL | vec[vec.len() - 1] = 123; | ^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/suggest-mut-iterator.stderr b/tests/ui/borrowck/suggest-mut-iterator.stderr index 77f991a9a..b396bb7b5 100644 --- a/tests/ui/borrowck/suggest-mut-iterator.stderr +++ b/tests/ui/borrowck/suggest-mut-iterator.stderr @@ -11,6 +11,6 @@ help: use a mutable iterator instead LL | for test in &mut tests { | +++ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr index 368d72810..a69a025cb 100644 --- a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr +++ b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr @@ -19,6 +19,6 @@ help: ...and then using that local here LL | vec[vec.len() - 1] = 123; | ^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/tainted-promoteds.stderr b/tests/ui/borrowck/tainted-promoteds.stderr index b276ea9ac..a5c448fdc 100644 --- a/tests/ui/borrowck/tainted-promoteds.stderr +++ b/tests/ui/borrowck/tainted-promoteds.stderr @@ -9,6 +9,6 @@ LL | let a = 0; LL | a = &0 * &1 * &2 * &3; | ^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0384`. diff --git a/tests/ui/borrowck/two-phase-across-loop.stderr b/tests/ui/borrowck/two-phase-across-loop.stderr index d7c0210cc..bd63fc961 100644 --- a/tests/ui/borrowck/two-phase-across-loop.stderr +++ b/tests/ui/borrowck/two-phase-across-loop.stderr @@ -6,6 +6,6 @@ LL | strings.push(foo.get_string()); | | | first borrow used here, in later iteration of loop -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr index 2c3f1c18a..6a3e0db4b 100644 --- a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr +++ b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr @@ -9,6 +9,6 @@ LL | LL | vec.push(2); | ^^^^^^^^^^^ mutable borrow occurs here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr b/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr index e3e4057d6..b1e439298 100644 --- a/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr +++ b/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr @@ -10,6 +10,6 @@ LL | delay = &mut vec; LL | shared[0]; | ------ immutable borrow later used here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/borrowck/two-phase-sneaky.stderr b/tests/ui/borrowck/two-phase-sneaky.stderr index 4db970c1d..4f1712ccc 100644 --- a/tests/ui/borrowck/two-phase-sneaky.stderr +++ b/tests/ui/borrowck/two-phase-sneaky.stderr @@ -9,6 +9,6 @@ LL | LL | v.push(format!("foo")); | ^ second mutable borrow occurs here -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr index 9f9d4bd8d..b3bf2f924 100644 --- a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr +++ b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr @@ -77,6 +77,8 @@ LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut))); | | | immutable borrow occurs here | | cast requires that `reg.sess_mut` is borrowed for `'a` | mutable borrow occurs here + | + = note: due to object lifetime defaults, `Box<dyn for<'b> LateLintPass<'b>>` actually means `Box<(dyn for<'b> LateLintPass<'b> + 'static)>` error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable --> $DIR/two-phase-surprise-no-conflict.rs:144:5 @@ -119,6 +121,8 @@ LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | | | first mutable borrow occurs here | | cast requires that `reg.sess_mut` is borrowed for `'a` | second mutable borrow occurs here + | + = note: due to object lifetime defaults, `Box<dyn for<'b> LateLintPass<'b>>` actually means `Box<(dyn for<'b> LateLintPass<'b> + 'static)>` error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:158:53 diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.fixed b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.fixed index b0c537610..85acafd88 100644 --- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.fixed +++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.fixed @@ -9,7 +9,7 @@ fn call<F>(f: F) where F : Fn() { fn main() { let y = vec![format!("World")]; call(|| { - y.clone().into_iter(); + <Vec<String> as Clone>::clone(&y).into_iter(); //~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure }); } diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index a2f6365b7..a2ff70255 100644 --- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -14,9 +14,9 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `y` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: you can `clone` the value and consume it, but this might not be your desired behavior | -LL | y.clone().into_iter(); - | ++++++++ +LL | <Vec<String> as Clone>::clone(&y).into_iter(); + | +++++++++++++++++++++++++++++++ + -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0507`. |