diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 07133525d5d..08b22a6e0e1 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -21,6 +21,7 @@ use rustc_middle::ty::{ self, subst::Subst, suggest_constraining_type_params, EarlyBinder, PredicateKind, Ty, }; use rustc_mir_dataflow::move_paths::{InitKind, MoveOutIndex, MovePathIndex}; +use rustc_span::hygiene::DesugaringKind; use rustc_span::symbol::sym; use rustc_span::{BytePos, Span}; use rustc_trait_selection::infer::InferCtxtExt; @@ -331,7 +332,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { spans.push(span); } - let (item_msg, name, desc) = + let (binding, name, desc) = match self.describe_place_with_options(used_place, IncludingDowncast(true)) { Some(name) => (format!("`{name}`"), format!("`{name}`"), format!("`{name}` ")), None => ("value".to_string(), "the variable".to_string(), String::new()), @@ -351,7 +352,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } else { "initialized in all conditions" }; - let mut err = struct_span_err!(self, span, E0381, "binding {desc}isn't {initialized}"); + let used = desired_action.as_general_verb_in_past_tense(); + let mut err = + struct_span_err!(self, span, E0381, "{used} binding {desc}isn't {initialized}"); use_spans.var_span_label_path_only( &mut err, format!("{} occurs due to use{}", desired_action.as_noun(), use_spans.describe()), @@ -359,12 +362,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { if let InitializationRequiringAction::PartialAssignment = desired_action { err.help( - "partial initialization isn't supported, fully initialize the binding with \ - a default value and mutate, or use `std::mem::MaybeUninit`", + "partial initialization isn't supported, fully initialize the binding with a \ + default value and mutate it, or use `std::mem::MaybeUninit`", ); } - let verb = desired_action.as_verb_in_past_tense(); - err.span_label(span, format!("{item_msg} {verb} here but it isn't {initialized}",)); + err.span_label(span, format!("{binding} {used} here but it isn't {initialized}")); // We use the statements were the binding was initialized, and inspect the HIR to look // for the branching codepaths that aren't covered, to point at them. @@ -400,7 +402,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.span_label(sp, &label); } } - err.span_label(decl_span, "variable declared here"); + err.span_label(decl_span, "binding declared here but left uninitialized"); err } @@ -2559,10 +2561,10 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> { v.visit_expr(body); if v.1 { self.errors.push(( - cond.span, + ex.span.to(cond.span), format!( - "this `if` expression might be missing an `else` arm where {} is \ - initialized", + "this `if` expression might be missing an `else` arm that initializes \ + {}", self.name, ), )); @@ -2578,10 +2580,24 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> { match (a.1, b.1) { (true, true) | (false, false) => {} (true, false) => { - self.errors.push(( - cond.span, - format!("{} is uninitialized if this condition isn't met", self.name,), - )); + if other.span.is_desugaring(DesugaringKind::WhileLoop) { + self.errors.push(( + cond.span, + format!( + "{} is uninitialized if this condition isn't met and the \ + `while` loop runs 0 times", + self.name + ), + )); + } else { + self.errors.push(( + body.span.shrink_to_hi().until(other.span), + format!( + "{} is uninitialized if this `else` arm is executed", + self.name + ), + )); + } } (false, true) => { self.errors.push(( @@ -2591,7 +2607,7 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> { } } } - hir::ExprKind::Match(_, arms, _) => { + hir::ExprKind::Match(e, arms, loop_desugar) => { // If the binding is initialized in one of the match arms, then the other match // arms might be missing an initialization. let results: Vec = arms @@ -2605,13 +2621,32 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> { if results.iter().any(|x| *x) && !results.iter().all(|x| *x) { for (arm, seen) in arms.iter().zip(results) { if !seen { - self.errors.push(( - arm.pat.span, - format!( - "{} is uninitialized if this pattern is matched", - self.name - ), - )); + if loop_desugar == hir::MatchSource::ForLoopDesugar { + self.errors.push(( + e.span, + format!( + "{} is uninitialized if the `for` loop runs 0 times", + self.name + ), + )); + } else if let Some(guard) = &arm.guard { + self.errors.push(( + arm.pat.span.to(guard.body().span), + format!( + "{} is uninitialized if this pattern and condition are \ + matched", + self.name + ), + )); + } else { + self.errors.push(( + arm.pat.span, + format!( + "{} is uninitialized if this pattern is matched", + self.name + ), + )); + } } } } @@ -2619,8 +2654,7 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> { // FIXME: should we also account for binops, particularly `&&` and `||`? `try` should // also be accounted for. For now it is fine, as if we don't find *any* relevant // branching code paths, we point at the places where the binding *is* initialized for - // *some* context. We should also specialize the output for `while` and `for` loops, - // but for now we can rely on their desugaring to provide appropriate output. + // *some* context. _ => {} } walk_expr(self, ex); diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 338df3c70e3..2ed35062da1 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -907,6 +907,16 @@ impl InitializationRequiringAction { InitializationRequiringAction::PartialAssignment => "partially assigned", } } + + fn as_general_verb_in_past_tense(self) -> &'static str { + match self { + InitializationRequiringAction::Borrow + | InitializationRequiringAction::MatchOn + | InitializationRequiringAction::Use => "used", + InitializationRequiringAction::Assignment => "assigned", + InitializationRequiringAction::PartialAssignment => "partially assigned", + } + } } impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { diff --git a/src/test/ui/asm/x86_64/type-check-5.stderr b/src/test/ui/asm/x86_64/type-check-5.stderr index 26aac4ed2c1..e9c93fea561 100644 --- a/src/test/ui/asm/x86_64/type-check-5.stderr +++ b/src/test/ui/asm/x86_64/type-check-5.stderr @@ -1,16 +1,16 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/type-check-5.rs:15:28 | LL | let x: u64; - | - variable declared here + | - binding declared here but left uninitialized LL | asm!("{}", in(reg) x); | ^ `x` used here but it isn't initialized -error[E0381]: binding `y` isn't initialized +error[E0381]: used binding `y` isn't initialized --> $DIR/type-check-5.rs:18:9 | LL | let mut y: u64; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | asm!("{}", inout(reg) y); | ^^^^^^^^^^^^^^^^^^^^^^^^ `y` used here but it isn't initialized diff --git a/src/test/ui/async-await/no-non-guaranteed-initialization.stderr b/src/test/ui/async-await/no-non-guaranteed-initialization.stderr index c6490c7bf4d..b23e2da0e09 100644 --- a/src/test/ui/async-await/no-non-guaranteed-initialization.stderr +++ b/src/test/ui/async-await/no-non-guaranteed-initialization.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `y` isn't initialized in all conditions +error[E0381]: used binding `y` isn't initialized in all conditions --> $DIR/no-non-guaranteed-initialization.rs:9:5 | LL | let y; - | - variable declared here + | - binding declared here but left uninitialized LL | if x > 5 { - | ----- this `if` expression might be missing an `else` arm where `y` is initialized + | ----- this `if` expression might be missing an `else` arm that initializes `y` ... LL | y | ^ `y` used here but it isn't initialized in all conditions diff --git a/src/test/ui/async-await/partial-initialization-across-await.stderr b/src/test/ui/async-await/partial-initialization-across-await.stderr index 981e32cadd9..6a0eeffb946 100644 --- a/src/test/ui/async-await/partial-initialization-across-await.stderr +++ b/src/test/ui/async-await/partial-initialization-across-await.stderr @@ -1,32 +1,32 @@ -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/partial-initialization-across-await.rs:13:5 | LL | let mut t: (i32, i32); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 42; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/partial-initialization-across-await.rs:21:5 | LL | let mut t: T; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 42; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/partial-initialization-across-await.rs:29:5 | LL | let mut t: S; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.x = 42; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 3 previous errors diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr index 57787b89249..1ed92865da5 100644 --- a/src/test/ui/borrowck/assign_mutable_fields.stderr +++ b/src/test/ui/borrowck/assign_mutable_fields.stderr @@ -1,22 +1,22 @@ -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/assign_mutable_fields.rs:9:5 | LL | let mut x: (u32, u32); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | x.0 = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/assign_mutable_fields.rs:17:5 | LL | let mut x: (u32, u32); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | x.0 = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr index de57243a5db..a78ac1e593a 100644 --- a/src/test/ui/borrowck/borrowck-and-init.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.stderr @@ -1,13 +1,13 @@ -error[E0381]: binding `i` isn't initialized in all conditions +error[E0381]: used binding `i` isn't initialized in all conditions --> $DIR/borrowck-and-init.rs:5:20 | LL | let i: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | LL | println!("{}", false && { i = 5; true }); | ----- binding initialized here in some conditions LL | println!("{}", i); - | ^ `i` borrowed here but it isn't initialized in all conditions + | ^ `i` used here but it isn't initialized in all conditions | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr index 0f0fbedaf17..e720db1c696 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-block-unint.rs:4:11 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | force(|| { - | ^^ `x` borrowed here but it isn't initialized + | ^^ `x` used here but it isn't initialized LL | println!("{}", x); | - borrow occurs due to use in closure diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr index 2b5547dbf95..23ea1a2de7f 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr @@ -1,11 +1,11 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-break-uninit-2.rs:9:20 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized ... LL | println!("{}", x); - | ^ `x` borrowed here but it isn't initialized + | ^ `x` used here but it isn't initialized | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr index 9d0fd5dac93..2b9b0a190f6 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr @@ -1,11 +1,11 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-break-uninit.rs:9:20 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized ... LL | println!("{}", x); - | ^ `x` borrowed here but it isn't initialized + | ^ `x` used here but it isn't initialized | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr index 492bbfa9eb2..e009f5913ed 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr @@ -108,35 +108,35 @@ LL | let _z = A { a: 4, .. x }; | = note: move occurs because `x.b` has type `Box`, which does not implement the `Copy` trait -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/borrowck-field-sensitivity.rs:81:5 | LL | let mut x: A; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | x.a = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/borrowck-field-sensitivity.rs:87:5 | LL | let mut x: A; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | x.a = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/borrowck-field-sensitivity.rs:94:5 | LL | let mut x: A; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | x.b = Box::new(1); | ^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-if-no-else.stderr b/src/test/ui/borrowck/borrowck-if-no-else.stderr index 178381e8477..134e7d5df4b 100644 --- a/src/test/ui/borrowck/borrowck-if-no-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-no-else.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `x` isn't initialized in all conditions +error[E0381]: used binding `x` isn't initialized in all conditions --> $DIR/borrowck-if-no-else.rs:5:9 | LL | let x: isize; if 1 > 2 { x = 10; } - | - ----- this `if` expression might be missing an `else` arm where `x` is initialized + | - ----- this `if` expression might be missing an `else` arm that initializes `x` | | - | variable declared here + | binding declared here but left uninitialized LL | foo(x); | ^ `x` used here but it isn't initialized in all conditions diff --git a/src/test/ui/borrowck/borrowck-if-with-else.stderr b/src/test/ui/borrowck/borrowck-if-with-else.stderr index f1af7b67b1c..f4b0c393074 100644 --- a/src/test/ui/borrowck/borrowck-if-with-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-with-else.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `x` isn't initialized in all conditions +error[E0381]: used binding `x` isn't initialized in all conditions --> $DIR/borrowck-if-with-else.rs:10:9 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | if 1 > 2 { | ----- `x` is uninitialized if this condition is met ... diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr index 8bdccd0dad6..e8a2fbc91ea 100644 --- a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `i` isn't initialized +error[E0381]: used binding `i` isn't initialized --> $DIR/borrowck-init-in-called-fn-expr.rs:4:9 | LL | let i: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | i | ^ `i` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr index 84ec5598abb..1e950d6a20d 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `i` isn't initialized +error[E0381]: used binding `i` isn't initialized --> $DIR/borrowck-init-in-fn-expr.rs:4:9 | LL | let i: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | i | ^ `i` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.stderr index ddb2473d1eb..7a35a9a537c 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fru.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fru.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `origin.y` isn't initialized +error[E0381]: used binding `origin.y` isn't initialized --> $DIR/borrowck-init-in-fru.rs:9:14 | LL | let mut origin: Point; - | ---------- variable declared here + | ---------- binding declared here but left uninitialized LL | origin = Point { x: 10, ..origin }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ `origin.y` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.stderr b/src/test/ui/borrowck/borrowck-init-op-equal.stderr index f1d7ec6a446..74704b2abfe 100644 --- a/src/test/ui/borrowck/borrowck-init-op-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-op-equal.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `v` isn't initialized +error[E0381]: used binding `v` isn't initialized --> $DIR/borrowck-init-op-equal.rs:3:5 | LL | let v: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | v += 1; | ^^^^^^ `v` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr index 26422af9c63..7542576d636 100644 --- a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `v` isn't initialized +error[E0381]: used binding `v` isn't initialized --> $DIR/borrowck-init-plus-equal.rs:3:9 | LL | let mut v: isize; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | v = v + 1; | ^ `v` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr index 7fcec304647..633c4017d16 100644 --- a/src/test/ui/borrowck/borrowck-or-init.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.stderr @@ -1,13 +1,13 @@ -error[E0381]: binding `i` isn't initialized in all conditions +error[E0381]: used binding `i` isn't initialized in all conditions --> $DIR/borrowck-or-init.rs:5:20 | LL | let i: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | LL | println!("{}", false || { i = 5; true }); | ----- binding initialized here in some conditions LL | println!("{}", i); - | ^ `i` borrowed here but it isn't initialized in all conditions + | ^ `i` used here but it isn't initialized in all conditions | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr index be5de8a0a5a..06351a94306 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `x.0` isn't initialized +error[E0381]: assigned binding `x.0` isn't initialized --> $DIR/borrowck-partial-reinit-4.rs:17:5 | LL | let mut x : (Test2, Test2); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | (x.0).0 = Some(Test); | ^^^^^^^ `x.0` assigned here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-return.stderr b/src/test/ui/borrowck/borrowck-return.stderr index f42ac9fc541..1c916e22317 100644 --- a/src/test/ui/borrowck/borrowck-return.stderr +++ b/src/test/ui/borrowck/borrowck-return.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-return.rs:3:12 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | return x; | ^ `x` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr index 6168961bd16..2cea4392d6a 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.stderr +++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-storage-dead.rs:16:17 | LL | let x: i32; - | - variable declared here + | - binding declared here but left uninitialized LL | let _ = x + 1; | ^ `x` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr index 64bccecf68a..588b1b0c972 100644 --- a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `bar` isn't initialized +error[E0381]: used binding `bar` isn't initialized --> $DIR/borrowck-uninit-after-item.rs:4:9 | LL | let bar; - | --- variable declared here + | --- binding declared here but left uninitialized LL | fn baz(_x: isize) { } LL | baz(bar); | ^^^ `bar` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr index 0ffa5cee5f1..3bc3a477787 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `a.x` isn't initialized +error[E0381]: used binding `a.x` isn't initialized --> $DIR/borrowck-uninit-field-access.rs:21:13 | LL | let mut a: Point; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | let _ = a.x + 1; | ^^^ `a.x` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr index 273370a4eef..744cb14e662 100644 --- a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr @@ -1,80 +1,80 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:6:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x += 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:9:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x -= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:12:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x *= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:15:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x /= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:18:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x %= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:21:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x ^= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:24:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x &= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:27:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x |= 1; | ^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:30:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x <<= 1; | ^^^^^^^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit-in-assignop.rs:33:5 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | x >>= 1; | ^^^^^^^ `x` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr index e78f5888df6..9f33a163e08 100644 --- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.stderr @@ -1,66 +1,66 @@ -error[E0381]: binding `**x` isn't initialized +error[E0381]: used binding `**x` isn't initialized --> $DIR/borrowck-uninit-ref-chain.rs:8:14 | LL | let x: &&Box; - | - variable declared here + | - binding declared here but left uninitialized LL | let _y = &**x; - | ^^^^ `**x` borrowed here but it isn't initialized + | ^^^^ `**x` used here but it isn't initialized -error[E0381]: binding `**x` isn't initialized +error[E0381]: used binding `**x` isn't initialized --> $DIR/borrowck-uninit-ref-chain.rs:11:14 | LL | let x: &&S; - | - variable declared here + | - binding declared here but left uninitialized LL | let _y = &**x; - | ^^^^ `**x` borrowed here but it isn't initialized + | ^^^^ `**x` used here but it isn't initialized -error[E0381]: binding `**x` isn't initialized +error[E0381]: used binding `**x` isn't initialized --> $DIR/borrowck-uninit-ref-chain.rs:14:14 | LL | let x: &&i32; - | - variable declared here + | - binding declared here but left uninitialized LL | let _y = &**x; - | ^^^^ `**x` borrowed here but it isn't initialized + | ^^^^ `**x` used here but it isn't initialized -error[E0381]: binding `a` isn't fully initialized +error[E0381]: partially assigned binding `a` isn't fully initialized --> $DIR/borrowck-uninit-ref-chain.rs:18:5 | LL | let mut a: S; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | a.x = 0; | ^^^^^^^ `a` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `a` isn't fully initialized +error[E0381]: partially assigned binding `a` isn't fully initialized --> $DIR/borrowck-uninit-ref-chain.rs:22:5 | LL | let mut a: S<&&i32, &&i32>; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | a.x = &&0; | ^^^^^^^^^ `a` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `a` isn't fully initialized +error[E0381]: partially assigned binding `a` isn't fully initialized --> $DIR/borrowck-uninit-ref-chain.rs:27:5 | LL | let mut a: S; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | a.x = 0; | ^^^^^^^ `a` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `a` isn't fully initialized +error[E0381]: partially assigned binding `a` isn't fully initialized --> $DIR/borrowck-uninit-ref-chain.rs:31:5 | LL | let mut a: S<&&i32, &&i32>; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | a.x = &&0; | ^^^^^^^^^ `a` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-uninit.stderr b/src/test/ui/borrowck/borrowck-uninit.stderr index c5ee9cfd297..d5566691a82 100644 --- a/src/test/ui/borrowck/borrowck-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-uninit.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-uninit.rs:5:9 | LL | let x: isize; - | - variable declared here + | - binding declared here but left uninitialized LL | foo(x); | ^ `x` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr index eee04f79033..b7ff5f3955e 100644 --- a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr +++ b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr @@ -1,24 +1,24 @@ -error[E0381]: binding `s` isn't fully initialized +error[E0381]: partially assigned binding `s` isn't fully initialized --> $DIR/borrowck-union-uninitialized.rs:13:9 | LL | let mut s: S; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | let mut u: U; LL | s.a = 0; | ^^^^^^^ `s` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `u` isn't fully initialized +error[E0381]: partially assigned binding `u` isn't fully initialized --> $DIR/borrowck-union-uninitialized.rs:14:9 | LL | let mut u: U; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | s.a = 0; LL | u.a = 0; | ^^^^^^^ `u` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr index f7975c8ac92..6372096caef 100644 --- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr +++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.stderr @@ -1,16 +1,16 @@ -error[E0381]: binding `*w` isn't initialized +error[E0381]: used binding `*w` isn't initialized --> $DIR/borrowck-use-in-index-lvalue.rs:3:5 | LL | let w: &mut [isize]; - | - variable declared here + | - binding declared here but left uninitialized LL | w[5] = 0; | ^^^^ `*w` used here but it isn't initialized -error[E0381]: binding `*w` isn't initialized +error[E0381]: used binding `*w` isn't initialized --> $DIR/borrowck-use-in-index-lvalue.rs:6:5 | LL | let mut w: &mut [isize]; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | w[5] = 0; | ^^^^ `*w` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr index 3d024b531ef..fea69c2e40d 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `*x` isn't initialized +error[E0381]: used binding `*x` isn't initialized --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:9:13 | LL | let x: &i32; - | - variable declared here + | - binding declared here but left uninitialized LL | let y = x as *const dyn Foo; - | ^ `*x` borrowed here but it isn't initialized + | ^ `*x` used here but it isn't initialized error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr index 20a5dcaade7..e75e0335296 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `*x` isn't initialized +error[E0381]: used binding `*x` isn't initialized --> $DIR/borrowck-use-uninitialized-in-cast.rs:7:13 | LL | let x: &i32; - | - variable declared here + | - binding declared here but left uninitialized LL | let y = x as *const i32; - | ^ `*x` borrowed here but it isn't initialized + | ^ `*x` used here but it isn't initialized error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr index 501f0c65151..ab7d50b834a 100644 --- a/src/test/ui/borrowck/borrowck-while-break.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.stderr @@ -1,13 +1,13 @@ -error[E0381]: binding `v` isn't initialized in all conditions +error[E0381]: used binding `v` isn't initialized in all conditions --> $DIR/borrowck-while-break.rs:7:20 | LL | let v; - | - variable declared here + | - binding declared here but left uninitialized LL | while cond { - | ---- `v` is uninitialized if this condition isn't met + | ---- `v` is uninitialized if this condition isn't met and the `while` loop runs 0 times ... LL | println!("{}", v); - | ^ `v` borrowed here but it isn't initialized in all conditions + | ^ `v` used here but it isn't initialized in all conditions | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/borrowck-while-cond.stderr b/src/test/ui/borrowck/borrowck-while-cond.stderr index 87d505b5fbb..e41c1c55e60 100644 --- a/src/test/ui/borrowck/borrowck-while-cond.stderr +++ b/src/test/ui/borrowck/borrowck-while-cond.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/borrowck-while-cond.rs:3:11 | LL | let x: bool; - | - variable declared here + | - binding declared here but left uninitialized LL | while x { } | ^ `x` used here but it isn't initialized diff --git a/src/test/ui/borrowck/borrowck-while.stderr b/src/test/ui/borrowck/borrowck-while.stderr index 36dda8ee13f..5bb86b11ba5 100644 --- a/src/test/ui/borrowck/borrowck-while.stderr +++ b/src/test/ui/borrowck/borrowck-while.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `x` isn't initialized in all conditions +error[E0381]: used binding `x` isn't initialized in all conditions --> $DIR/borrowck-while.rs:4:12 | LL | let mut x: isize; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | while 1 == 1 { x = 10; } - | ------ `x` is uninitialized if this condition isn't met + | ------ `x` is uninitialized if this condition isn't met and the `while` loop runs 0 times LL | return x; | ^ `x` used here but it isn't initialized in all conditions diff --git a/src/test/ui/borrowck/disallow-possibly-uninitialized.stderr b/src/test/ui/borrowck/disallow-possibly-uninitialized.stderr index f6a0e3dbae0..9a84c6fefae 100644 --- a/src/test/ui/borrowck/disallow-possibly-uninitialized.stderr +++ b/src/test/ui/borrowck/disallow-possibly-uninitialized.stderr @@ -1,42 +1,42 @@ -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/disallow-possibly-uninitialized.rs:6:5 | LL | let mut t: (u64, u64); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 1; | ^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/disallow-possibly-uninitialized.rs:11:5 | LL | let mut t: (u64, u64); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.1 = 1; | ^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/disallow-possibly-uninitialized.rs:16:5 | LL | let mut t: (u64, u64); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 1; | ^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/disallow-possibly-uninitialized.rs:20:5 | LL | let mut t: (u64,); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 1; | ^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 4 previous errors diff --git a/src/test/ui/borrowck/issue-24267-flow-exit.stderr b/src/test/ui/borrowck/issue-24267-flow-exit.stderr index 25f7df4f582..d436e8ff909 100644 --- a/src/test/ui/borrowck/issue-24267-flow-exit.stderr +++ b/src/test/ui/borrowck/issue-24267-flow-exit.stderr @@ -1,22 +1,22 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/issue-24267-flow-exit.rs:12:20 | LL | let x: i32; - | - variable declared here + | - binding declared here but left uninitialized LL | loop { x = break; } LL | println!("{}", x); - | ^ `x` borrowed here but it isn't initialized + | ^ `x` used here but it isn't initialized | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/issue-24267-flow-exit.rs:18:20 | LL | let x: i32; - | - variable declared here + | - binding declared here but left uninitialized LL | for _ in 0..10 { x = continue; } LL | println!("{}", x); - | ^ `x` borrowed here but it isn't initialized + | ^ `x` used here but it isn't initialized | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr index 99c25ad5446..2a0eba396f1 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-marks-mut-as-used.stderr @@ -1,32 +1,32 @@ -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:12:9 | LL | let mut t: Tuple; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = S(1); | ^^^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `u` isn't fully initialized +error[E0381]: partially assigned binding `u` isn't fully initialized --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:20:9 | LL | let mut u: Tpair; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | u.0 = S(1); | ^^^^^^^^^^ `u` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `v` isn't fully initialized +error[E0381]: partially assigned binding `v` isn't fully initialized --> $DIR/issue-54499-field-mutation-marks-mut-as-used.rs:28:9 | LL | let mut v: Spair; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | v.x = S(1); | ^^^^^^^^^^ `v` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 3 previous errors diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr index 1c78524a1b1..67a62583057 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-never-init.stderr @@ -1,32 +1,32 @@ -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/issue-54499-field-mutation-of-never-init.rs:12:9 | LL | let t: Tuple; - | - variable declared here + | - binding declared here but left uninitialized LL | t.0 = S(1); | ^^^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `u` isn't fully initialized +error[E0381]: partially assigned binding `u` isn't fully initialized --> $DIR/issue-54499-field-mutation-of-never-init.rs:20:9 | LL | let u: Tpair; - | - variable declared here + | - binding declared here but left uninitialized LL | u.0 = S(1); | ^^^^^^^^^^ `u` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `v` isn't fully initialized +error[E0381]: partially assigned binding `v` isn't fully initialized --> $DIR/issue-54499-field-mutation-of-never-init.rs:28:9 | LL | let v: Spair; - | - variable declared here + | - binding declared here but left uninitialized LL | v.x = S(1); | ^^^^^^^^^^ `v` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 3 previous errors diff --git a/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr b/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr index f809b7d4c3b..f5d2eecfa91 100644 --- a/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr +++ b/src/test/ui/borrowck/issue-62107-match-arm-scopes.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `e` isn't initialized +error[E0381]: used binding `e` isn't initialized --> $DIR/issue-62107-match-arm-scopes.rs:3:11 | LL | let e: i32; - | - variable declared here + | - binding declared here but left uninitialized LL | match e { | ^ `e` used here but it isn't initialized diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr index 045f95632d8..e6b25573e70 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr @@ -1,22 +1,22 @@ -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/reassignment_immutable_fields.rs:7:5 | LL | let x: (u32, u32); - | - variable declared here + | - binding declared here but left uninitialized LL | x.0 = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/reassignment_immutable_fields.rs:15:5 | LL | let x: (u32, u32); - | - variable declared here + | - binding declared here but left uninitialized LL | x.0 = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr index d8486792723..a3885b5f5ca 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr @@ -1,12 +1,12 @@ -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5 | LL | let x: Foo; - | - variable declared here + | - binding declared here but left uninitialized LL | x.a = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable --> $DIR/reassignment_immutable_fields_overlapping.rs:13:5 diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr index db69f0b0db7..49c81adad49 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr @@ -7,15 +7,15 @@ LL | x = (22, 44); LL | x.0 = 1; | ^^^^^^^ cannot assign -error[E0381]: binding `x` isn't fully initialized +error[E0381]: partially assigned binding `x` isn't fully initialized --> $DIR/reassignment_immutable_fields_twice.rs:12:5 | LL | let x: (u32, u32); - | - variable declared here + | - binding declared here but left uninitialized LL | x.0 = 1; | ^^^^^^^ `x` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 2 previous errors diff --git a/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr b/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr index c891fff228a..fea5441ec67 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr @@ -12,68 +12,68 @@ LL + _ => todo!(), LL ~ }; | -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/pattern-matching-should-fail.rs:8:23 | LL | let x: !; - | - variable declared here + | - binding declared here but left uninitialized LL | let c1 = || match x { }; | ^ `x` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/pattern-matching-should-fail.rs:15:14 | LL | let x: !; - | - variable declared here + | - binding declared here but left uninitialized LL | let c2 = || match x { _ => () }; | ^^ - borrow occurs due to use in closure | | - | `x` borrowed here but it isn't initialized + | `x` used here but it isn't initialized -error[E0381]: binding `variant` isn't initialized +error[E0381]: used binding `variant` isn't initialized --> $DIR/pattern-matching-should-fail.rs:27:13 | LL | let variant: !; - | ------- variable declared here + | ------- binding declared here but left uninitialized LL | let c = || { - | ^^ `variant` borrowed here but it isn't initialized + | ^^ `variant` used here but it isn't initialized LL | LL | match variant { | ------- borrow occurs due to use in closure -error[E0381]: binding `variant` isn't initialized +error[E0381]: used binding `variant` isn't initialized --> $DIR/pattern-matching-should-fail.rs:39:13 | LL | let variant: !; - | ------- variable declared here + | ------- binding declared here but left uninitialized LL | let c = || { - | ^^ `variant` borrowed here but it isn't initialized + | ^^ `variant` used here but it isn't initialized LL | match variant { | ------- borrow occurs due to use in closure -error[E0381]: binding `g` isn't initialized +error[E0381]: used binding `g` isn't initialized --> $DIR/pattern-matching-should-fail.rs:54:15 | LL | let g: !; - | - variable declared here + | - binding declared here but left uninitialized ... LL | match g { }; | ^ `g` used here but it isn't initialized -error[E0381]: binding `t` isn't initialized +error[E0381]: used binding `t` isn't initialized --> $DIR/pattern-matching-should-fail.rs:56:19 | LL | let t: !; - | - variable declared here + | - binding declared here but left uninitialized ... LL | match t { }; | ^ `t` used here but it isn't initialized -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/pattern-matching-should-fail.rs:67:23 | LL | let x: u8; - | - variable declared here + | - binding declared here but left uninitialized LL | let c1 = || match x { }; | ^ `x` used here but it isn't initialized diff --git a/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr b/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr index 0638a9c61c1..33f839c2866 100644 --- a/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr +++ b/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `*s` isn't initialized +error[E0381]: used binding `*s` isn't initialized --> $DIR/const-generic-default-wont-borrowck.rs:2:26 | LL | let s: &'static str; s.len() - | - ^^^^^^^ `*s` borrowed here but it isn't initialized + | - ^^^^^^^ `*s` used here but it isn't initialized | | - | variable declared here + | binding declared here but left uninitialized error: aborting due to previous error diff --git a/src/test/ui/consts/issue-78655.stderr b/src/test/ui/consts/issue-78655.stderr index 1c1a30d405d..f5b1123e7f3 100644 --- a/src/test/ui/consts/issue-78655.stderr +++ b/src/test/ui/consts/issue-78655.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/issue-78655.rs:3:5 | LL | let x; - | - variable declared here + | - binding declared here but left uninitialized LL | &x - | ^^ `x` borrowed here but it isn't initialized + | ^^ `x` used here but it isn't initialized error: could not evaluate constant pattern --> $DIR/issue-78655.rs:7:9 diff --git a/src/test/ui/drop/repeat-drop-2.stderr b/src/test/ui/drop/repeat-drop-2.stderr index 845b6de798f..48fa2bfa975 100644 --- a/src/test/ui/drop/repeat-drop-2.stderr +++ b/src/test/ui/drop/repeat-drop-2.stderr @@ -17,11 +17,11 @@ LL | const _: [String; 0] = [String::new(); 0]; | |constants cannot evaluate destructors | value is dropped here -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/repeat-drop-2.rs:12:14 | LL | let x: u8; - | - variable declared here + | - binding declared here but left uninitialized LL | let _ = [x; 0]; | ^ `x` used here but it isn't initialized diff --git a/src/test/ui/generator/partial-initialization-across-yield.stderr b/src/test/ui/generator/partial-initialization-across-yield.stderr index 26f45538023..3f9f1c046ba 100644 --- a/src/test/ui/generator/partial-initialization-across-yield.stderr +++ b/src/test/ui/generator/partial-initialization-across-yield.stderr @@ -1,32 +1,32 @@ -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/partial-initialization-across-yield.rs:12:9 | LL | let mut t: (i32, i32); - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 42; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/partial-initialization-across-yield.rs:22:9 | LL | let mut t: T; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.0 = 42; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/partial-initialization-across-yield.rs:32:9 | LL | let mut t: S; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | t.x = 42; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = 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 3 previous errors diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr index dd6949b19f6..75041031736 100644 --- a/src/test/ui/loops/loop-proper-liveness.stderr +++ b/src/test/ui/loops/loop-proper-liveness.stderr @@ -1,11 +1,11 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/loop-proper-liveness.rs:9:22 | LL | let x: i32; - | - variable declared here + | - binding declared here but left uninitialized ... LL | println!("{:?}", x); - | ^ `x` borrowed here but it isn't initialized + | ^ `x` used here but it isn't initialized | = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/mir/drop-elaboration-after-borrowck-error.stderr b/src/test/ui/mir/drop-elaboration-after-borrowck-error.stderr index ad2e5c9f643..d8154f8d2cb 100644 --- a/src/test/ui/mir/drop-elaboration-after-borrowck-error.stderr +++ b/src/test/ui/mir/drop-elaboration-after-borrowck-error.stderr @@ -16,11 +16,11 @@ LL | let a: [String; 1]; LL | }; | - value is dropped here -error[E0381]: binding `a` isn't initialized +error[E0381]: used binding `a` isn't initialized --> $DIR/drop-elaboration-after-borrowck-error.rs:7:5 | LL | let a: [String; 1]; - | - variable declared here + | - binding declared here but left uninitialized LL | LL | a[0] = String::new(); | ^^^^ `a` used here but it isn't initialized diff --git a/src/test/ui/moves/issue-72649-uninit-in-loop.rs b/src/test/ui/moves/issue-72649-uninit-in-loop.rs index e796466397b..d76b69ecdc8 100644 --- a/src/test/ui/moves/issue-72649-uninit-in-loop.rs +++ b/src/test/ui/moves/issue-72649-uninit-in-loop.rs @@ -57,14 +57,14 @@ fn moved_loop_2() { fn uninit_1() { loop { - let value: NonCopy; //~ NOTE variable declared here + let value: NonCopy; //~ NOTE declared here let _used = value; //~ ERROR binding `value` isn't initialized //~^ NOTE `value` used here but it isn't initialized } } fn uninit_2() { - let mut value: NonCopy; //~ NOTE variable declared here + let mut value: NonCopy; //~ NOTE declared here loop { let _used = value; //~ ERROR binding `value` isn't initialized //~^ NOTE `value` used here but it isn't initialized diff --git a/src/test/ui/moves/issue-72649-uninit-in-loop.stderr b/src/test/ui/moves/issue-72649-uninit-in-loop.stderr index 52dab5cabf8..c7373b5be9d 100644 --- a/src/test/ui/moves/issue-72649-uninit-in-loop.stderr +++ b/src/test/ui/moves/issue-72649-uninit-in-loop.stderr @@ -40,19 +40,19 @@ LL | let mut value = NonCopy{}; LL | let _used2 = value; | ^^^^^ value moved here, in previous iteration of loop -error[E0381]: binding `value` isn't initialized +error[E0381]: used binding `value` isn't initialized --> $DIR/issue-72649-uninit-in-loop.rs:61:21 | LL | let value: NonCopy; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | let _used = value; | ^^^^^ `value` used here but it isn't initialized -error[E0381]: binding `value` isn't initialized +error[E0381]: used binding `value` isn't initialized --> $DIR/issue-72649-uninit-in-loop.rs:69:21 | LL | let mut value: NonCopy; - | --------- variable declared here + | --------- binding declared here but left uninitialized LL | loop { LL | let _used = value; | ^^^^^ `value` used here but it isn't initialized diff --git a/src/test/ui/moves/move-into-dead-array-1.stderr b/src/test/ui/moves/move-into-dead-array-1.stderr index b5478196ef6..344a6bbf0c9 100644 --- a/src/test/ui/moves/move-into-dead-array-1.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `a` isn't initialized +error[E0381]: used binding `a` isn't initialized --> $DIR/move-into-dead-array-1.rs:14:5 | LL | let mut a: [D; 4]; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | a[i] = d(); | ^^^^ `a` used here but it isn't initialized diff --git a/src/test/ui/moves/move-of-addr-of-mut.stderr b/src/test/ui/moves/move-of-addr-of-mut.stderr index a145b6223c1..e75f2b1c089 100644 --- a/src/test/ui/moves/move-of-addr-of-mut.stderr +++ b/src/test/ui/moves/move-of-addr-of-mut.stderr @@ -1,10 +1,10 @@ -error[E0381]: binding `x` isn't initialized +error[E0381]: used binding `x` isn't initialized --> $DIR/move-of-addr-of-mut.rs:8:5 | LL | let mut x: S; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | std::ptr::addr_of_mut!(x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `x` borrowed here but it isn't initialized + | ^^^^^^^^^^^^^^^^^^^^^^^^^ `x` used here but it isn't initialized | = note: this error originates in the macro `std::ptr::addr_of_mut` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr index 71029065db1..f56b6294c20 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr @@ -1,16 +1,16 @@ -error[E0381]: binding `d` isn't initialized +error[E0381]: assigned binding `d` isn't initialized --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5 | LL | let d: D; - | - variable declared here + | - binding declared here but left uninitialized LL | d.x = 10; | ^^^^^^^^ `d` assigned here but it isn't initialized -error[E0381]: binding `d` isn't initialized +error[E0381]: assigned binding `d` isn't initialized --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:33:5 | LL | let mut d: D; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | d.x = 10; | ^^^^^^^^ `d` assigned here but it isn't initialized @@ -24,25 +24,25 @@ LL | drop(d); LL | d.x = 10; | ^^^^^^^^ value assigned here after move -error[E0381]: binding `d.s` isn't fully initialized +error[E0381]: partially assigned binding `d.s` isn't fully initialized --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:45:5 | LL | let d: D; - | - variable declared here + | - binding declared here but left uninitialized LL | d.s.y = 20; | ^^^^^^^^^^ `d.s` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `d.s` isn't fully initialized +error[E0381]: partially assigned binding `d.s` isn't fully initialized --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:50:5 | LL | let mut d: D; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | d.s.y = 20; | ^^^^^^^^^^ `d.s` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0382]: assign to part of moved value: `d` --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:56:5 diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr index df60868d840..2f5883b1563 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr @@ -1,22 +1,22 @@ -error[E0381]: binding `s` isn't fully initialized +error[E0381]: partially assigned binding `s` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:97:5 | LL | let s: S; - | - variable declared here + | - binding declared here but left uninitialized LL | s.x = 10; s.y = Box::new(20); | ^^^^^^^^ `s` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:103:5 | LL | let t: T; - | - variable declared here + | - binding declared here but left uninitialized LL | t.0 = 10; t.1 = Box::new(20); | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0382]: assign to part of moved value: `s` --> $DIR/issue-21232-partial-init-and-use.rs:109:5 @@ -38,25 +38,25 @@ LL | let mut t: T = (0, Box::new(0)); drop(t); LL | t.0 = 10; t.1 = Box::new(20); | ^^^^^^^^ value partially assigned here after move -error[E0381]: binding `s` isn't fully initialized +error[E0381]: partially assigned binding `s` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:123:5 | LL | let s: S; - | - variable declared here + | - binding declared here but left uninitialized LL | s.x = 10; | ^^^^^^^^ `s` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:129:5 | LL | let t: T; - | - variable declared here + | - binding declared here but left uninitialized LL | t.0 = 10; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0382]: assign to part of moved value: `s` --> $DIR/issue-21232-partial-init-and-use.rs:135:5 @@ -78,45 +78,45 @@ LL | let mut t: T = (0, Box::new(0)); drop(t); LL | t.0 = 10; | ^^^^^^^^ value partially assigned here after move -error[E0381]: binding `s` isn't fully initialized +error[E0381]: partially assigned binding `s` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:149:5 | LL | let s: S; - | - variable declared here + | - binding declared here but left uninitialized LL | s.x = 10; | ^^^^^^^^ `s` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `t` isn't fully initialized +error[E0381]: partially assigned binding `t` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:155:5 | LL | let t: Tvoid; - | - variable declared here + | - binding declared here but left uninitialized LL | t.0 = 10; | ^^^^^^^^ `t` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `q.r.f` isn't fully initialized +error[E0381]: partially assigned binding `q.r.f` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:170:5 | LL | let q: Q>; - | - variable declared here + | - binding declared here but left uninitialized LL | q.r.f.x = 10; q.r.f.y = Box::new(20); | ^^^^^^^^^^^^ `q.r.f` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `q.r.f` isn't fully initialized +error[E0381]: partially assigned binding `q.r.f` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:176:5 | LL | let q: Q; - | - variable declared here + | - binding declared here but left uninitialized LL | q.r.f.0 = 10; q.r.f.1 = Box::new(20); | ^^^^^^^^^^^^ `q.r.f` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0382]: assign to part of moved value: `q.r` --> $DIR/issue-21232-partial-init-and-use.rs:182:5 @@ -138,25 +138,25 @@ LL | q.r.f.0 = 10; q.r.f.1 = Box::new(20); | = note: move occurs because `q.r` has type `R<(u32, Box)>`, which does not implement the `Copy` trait -error[E0381]: binding `q.r.f` isn't fully initialized +error[E0381]: partially assigned binding `q.r.f` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:196:5 | LL | let q: Q>; - | - variable declared here + | - binding declared here but left uninitialized LL | q.r.f.x = 10; | ^^^^^^^^^^^^ `q.r.f` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `q.r.f` isn't fully initialized +error[E0381]: partially assigned binding `q.r.f` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:202:5 | LL | let q: Q; - | - variable declared here + | - binding declared here but left uninitialized LL | q.r.f.0 = 10; | ^^^^^^^^^^^^ `q.r.f` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0382]: assign to part of moved value: `q.r` --> $DIR/issue-21232-partial-init-and-use.rs:208:5 @@ -178,25 +178,25 @@ LL | q.r.f.0 = 10; | = note: move occurs because `q.r` has type `R<(u32, Box)>`, which does not implement the `Copy` trait -error[E0381]: binding `q.r.f` isn't fully initialized +error[E0381]: partially assigned binding `q.r.f` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:222:5 | LL | let mut q: Q>; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | q.r.f.x = 10; | ^^^^^^^^^^^^ `q.r.f` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` -error[E0381]: binding `q.r.f` isn't fully initialized +error[E0381]: partially assigned binding `q.r.f` isn't fully initialized --> $DIR/issue-21232-partial-init-and-use.rs:228:5 | LL | let mut q: Q; - | ----- variable declared here + | ----- binding declared here but left uninitialized LL | q.r.f.0 = 10; | ^^^^^^^^^^^^ `q.r.f` partially assigned here but it isn't fully initialized | - = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate, or use `std::mem::MaybeUninit` + = help: partial initialization isn't supported, fully initialize the binding with a default value and mutate it, or use `std::mem::MaybeUninit` error[E0382]: assign to part of moved value: `c` --> $DIR/issue-21232-partial-init-and-use.rs:245:13 diff --git a/src/test/ui/nll/match-cfg-fake-edges.stderr b/src/test/ui/nll/match-cfg-fake-edges.stderr index 43950433e62..39933db3648 100644 --- a/src/test/ui/nll/match-cfg-fake-edges.stderr +++ b/src/test/ui/nll/match-cfg-fake-edges.stderr @@ -1,11 +1,9 @@ -error[E0381]: binding `x` isn't initialized in all conditions +error[E0381]: used binding `x` isn't initialized in all conditions --> $DIR/match-cfg-fake-edges.rs:21:13 | LL | let x; - | - variable declared here + | - binding declared here but left uninitialized ... -LL | _ if { - | - `x` is uninitialized if this pattern is matched LL | x; | ^ `x` used here but it isn't initialized in all conditions diff --git a/src/test/ui/nll/match-on-borrowed.stderr b/src/test/ui/nll/match-on-borrowed.stderr index 0480aaa99c2..664f36f695c 100644 --- a/src/test/ui/nll/match-on-borrowed.stderr +++ b/src/test/ui/nll/match-on-borrowed.stderr @@ -33,11 +33,11 @@ LL | match t { LL | x; | - borrow later used here -error[E0381]: binding `n` isn't initialized +error[E0381]: used binding `n` isn't initialized --> $DIR/match-on-borrowed.rs:93:11 | LL | let n: Never; - | - variable declared here + | - binding declared here but left uninitialized LL | match n {} | ^ `n` used here but it isn't initialized diff --git a/src/test/ui/rfc-2497-if-let-chains/chains-without-let.stderr b/src/test/ui/rfc-2497-if-let-chains/chains-without-let.stderr index 1fb643b98ae..a3d8c608f4b 100644 --- a/src/test/ui/rfc-2497-if-let-chains/chains-without-let.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/chains-without-let.stderr @@ -1,28 +1,28 @@ -error[E0381]: binding `z` isn't initialized in all conditions +error[E0381]: used binding `z` isn't initialized in all conditions --> $DIR/chains-without-let.rs:3:34 | LL | let z; - | - variable declared here + | - binding declared here but left uninitialized LL | if true && { z = 3; true} && z == 3 {} | ----- ^ `z` used here but it isn't initialized in all conditions | | | binding initialized here in some conditions -error[E0381]: binding `z` isn't initialized in all conditions +error[E0381]: used binding `z` isn't initialized in all conditions --> $DIR/chains-without-let.rs:9:31 | LL | let z; - | - variable declared here + | - binding declared here but left uninitialized LL | true && { z = 3; true} && z == 3; | ----- ^ `z` used here but it isn't initialized in all conditions | | | binding initialized here in some conditions -error[E0381]: binding `z` isn't initialized in all conditions +error[E0381]: used binding `z` isn't initialized in all conditions --> $DIR/chains-without-let.rs:15:36 | LL | let z; - | - variable declared here + | - binding declared here but left uninitialized LL | if false || { z = 3; false} || z == 3 {} | ----- ^ `z` used here but it isn't initialized in all conditions | | diff --git a/src/test/ui/try-block/try-block-opt-init.stderr b/src/test/ui/try-block/try-block-opt-init.stderr index 17349f9c9f3..72e732599c0 100644 --- a/src/test/ui/try-block/try-block-opt-init.stderr +++ b/src/test/ui/try-block/try-block-opt-init.stderr @@ -1,14 +1,14 @@ -error[E0381]: binding `cfg_res` isn't initialized in all conditions +error[E0381]: used binding `cfg_res` isn't initialized in all conditions --> $DIR/try-block-opt-init.rs:15:5 | LL | let cfg_res; - | ------- variable declared here + | ------- binding declared here but left uninitialized ... LL | cfg_res = 5; | ----------- binding initialized here in some conditions ... LL | assert_eq!(cfg_res, 5); - | ^^^^^^^^^^^^^^^^^^^^^^ `cfg_res` borrowed here but it isn't initialized in all conditions + | ^^^^^^^^^^^^^^^^^^^^^^ `cfg_res` used here but it isn't initialized in all conditions | = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr b/src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr index 61e6295fa3f..95c209f47c9 100644 --- a/src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr +++ b/src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr @@ -1,8 +1,8 @@ -error[E0381]: binding `y` isn't initialized +error[E0381]: used binding `y` isn't initialized --> $DIR/privately-uninhabited-mir-call.rs:28:5 | LL | let y: &mut u32; - | - variable declared here + | - binding declared here but left uninitialized ... LL | *y = 2; | ^^^^^^ `y` used here but it isn't initialized