Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd span label to E0384 for MIR borrowck #44806
Conversation
rust-highfive
assigned
nikomatsakis
Sep 24, 2017
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
carols10cents
added
the
S-waiting-on-review
label
Sep 25, 2017
This comment has been minimized.
This comment has been minimized.
|
r? @pnkfelix |
rust-highfive
assigned
pnkfelix
and unassigned
nikomatsakis
Sep 25, 2017
This comment has been minimized.
This comment has been minimized.
|
@KiChjang can you look into porting the test, in the same manner as discussed at #44811 (comment) |
pnkfelix
reviewed
Sep 25, 2017
| continue; | ||
| } | ||
| Lvalue::Local(local) => { | ||
| let assigned_span = self.mir.local_decls[local].source_info.span; |
This comment has been minimized.
This comment has been minimized.
pnkfelix
Sep 25, 2017
Member
Does the source info for the declaration always correspond to the assigned span when reported by AST borrowck?
In particular, I'm thinking of cases like:
let declare_without_init: i32;
match result {
Ok(_) => declare_without_init = 1,
Err(_) => declare_without_init = 2,
}
...
declare_without_init = 3;where the AST-borrowck today, for better or worse, tags the assignment in the first match arm as the "first assignment"
This comment has been minimized.
This comment has been minimized.
KiChjang
Sep 25, 2017
•
Author
Member
I don't actually know, I've only looked around the source code and used my own deduction skills to do what makes sense in order to retrieve a span. Perhaps @nikomatsakis may know more about this?
This comment has been minimized.
This comment has been minimized.
KiChjang
Sep 26, 2017
•
Author
Member
I just compiled the example you gave with my patch -- it actually does the wrongest thing, which is displaying the span of let declare_without_init: i32;. It would seem like mir.local_decls would not provide the location in which a variable is assigned.
KiChjang
force-pushed the
KiChjang:mir-err-notes-2
branch
4 times, most recently
from
58c5692
to
3bfe4c0
Sep 25, 2017
This comment has been minimized.
This comment has been minimized.
|
I believe this can be re-reviewed. r? @pnkfelix |
This comment has been minimized.
This comment has been minimized.
|
I think your revision tags are not working:
|
arielb1
reviewed
Sep 26, 2017
| @@ -8,6 +8,9 @@ | |||
| // option. This file may not be copied, modified, or distributed | |||
| // except according to those terms. | |||
|
|
|||
| // revisions: ast mir | |||
| //[mir]compfile-flags: -Zemit-end-regions -Zborrowck-mir | |||
This comment has been minimized.
This comment has been minimized.
arielb1
Sep 26, 2017
•
Contributor
I think you want to use [mir]compile-flags (not compfile) here. I think that's why you're getting the travis error.
This comment has been minimized.
This comment has been minimized.
KiChjang
force-pushed the
KiChjang:mir-err-notes-2
branch
2 times, most recently
from
9fcfad9
to
afa52ca
Sep 26, 2017
This comment has been minimized.
This comment has been minimized.
|
KiChjang
force-pushed the
KiChjang:mir-err-notes-2
branch
2 times, most recently
from
6354d75
to
c8ae9f4
Sep 26, 2017
KiChjang
force-pushed the
KiChjang:mir-err-notes-2
branch
from
c8ae9f4
to
6d4989b
Sep 27, 2017
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Sep 28, 2017
This comment has been minimized.
This comment has been minimized.
|
|
KiChjang commentedSep 24, 2017
Corresponds to
report_illegal_reassignment.Part of #44596.