Fix label on uninit binding field assignment
This commit is contained in:
parent
a86fa4fa38
commit
5f91614d12
3 changed files with 31 additions and 30 deletions
|
@ -350,8 +350,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
let mut visitor = ConditionVisitor { spans: &spans, name: &name, errors: vec![] };
|
let mut visitor = ConditionVisitor { spans: &spans, name: &name, errors: vec![] };
|
||||||
visitor.visit_body(&body);
|
visitor.visit_body(&body);
|
||||||
|
|
||||||
let isnt_initialized =
|
let isnt_initialized = if let InitializationRequiringAction::PartialAssignment
|
||||||
if let InitializationRequiringAction::PartialAssignment = desired_action {
|
| InitializationRequiringAction::Assignment = desired_action
|
||||||
|
{
|
||||||
// The same error is emitted for bindings that are *sometimes* initialized and the ones
|
// The same error is emitted for bindings that are *sometimes* initialized and the ones
|
||||||
// that are *partially* initialized by assigning to a field of an uninitialized
|
// that are *partially* initialized by assigning to a field of an uninitialized
|
||||||
// binding. We differentiate between them for more accurate wording here.
|
// binding. We differentiate between them for more accurate wording here.
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
error[E0381]: assigned binding `x.0` isn't initialized
|
error[E0381]: assigned binding `x.0` isn't fully initialized
|
||||||
--> $DIR/borrowck-partial-reinit-4.rs:17:5
|
--> $DIR/borrowck-partial-reinit-4.rs:17:5
|
||||||
|
|
|
|
||||||
LL | let mut x : (Test2, Test2);
|
LL | let mut x : (Test2, Test2);
|
||||||
| ----- binding declared here but left uninitialized
|
| ----- binding declared here but left uninitialized
|
||||||
LL | (x.0).0 = Some(Test);
|
LL | (x.0).0 = Some(Test);
|
||||||
| ^^^^^^^ `x.0` assigned here but it isn't initialized
|
| ^^^^^^^ `x.0` assigned here but it isn't fully initialized
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
error[E0381]: assigned binding `d` isn't initialized
|
error[E0381]: assigned binding `d` isn't fully initialized
|
||||||
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5
|
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:28:5
|
||||||
|
|
|
|
||||||
LL | let d: D;
|
LL | let d: D;
|
||||||
| - binding declared here but left uninitialized
|
| - binding declared here but left uninitialized
|
||||||
LL | d.x = 10;
|
LL | d.x = 10;
|
||||||
| ^^^^^^^^ `d` assigned here but it isn't initialized
|
| ^^^^^^^^ `d` assigned here but it isn't fully initialized
|
||||||
|
|
||||||
error[E0381]: assigned binding `d` isn't initialized
|
error[E0381]: assigned binding `d` isn't fully initialized
|
||||||
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:33:5
|
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:33:5
|
||||||
|
|
|
|
||||||
LL | let mut d: D;
|
LL | let mut d: D;
|
||||||
| ----- binding declared here but left uninitialized
|
| ----- binding declared here but left uninitialized
|
||||||
LL | d.x = 10;
|
LL | d.x = 10;
|
||||||
| ^^^^^^^^ `d` assigned here but it isn't initialized
|
| ^^^^^^^^ `d` assigned here but it isn't fully initialized
|
||||||
|
|
||||||
error[E0382]: assign of moved value: `d`
|
error[E0382]: assign of moved value: `d`
|
||||||
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:39:5
|
--> $DIR/issue-21232-partial-init-and-erroneous-use.rs:39:5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue