mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
Tweak wording and spans
This commit is contained in:
parent
29e2aa12ff
commit
9cb1874cd6
@ -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<bool> = 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);
|
||||
|
@ -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> {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -108,35 +108,35 @@ LL | let _z = A { a: 4, .. x };
|
||||
|
|
||||
= note: move occurs because `x.b` has type `Box<isize>`, 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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
...
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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<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 `**x` isn't initialized
|
||||
error[E0381]: used binding `**x` isn't initialized
|
||||
--> $DIR/borrowck-uninit-ref-chain.rs:11:14
|
||||
|
|
||||
LL | let x: &&S<i32, 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 `**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<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: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<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: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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<B>;
|
||||
| - 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<B>;
|
||||
| - 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<Void>;
|
||||
| - 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<S<B>>;
|
||||
| - 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<T>;
|
||||
| - 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<u32>)>`, 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<S<B>>;
|
||||
| - 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<T>;
|
||||
| - 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<u32>)>`, 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<S<Void>>;
|
||||
| ----- 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<Tvoid>;
|
||||
| ----- 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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
| |
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user