-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The prototype MIR-borrowck from PR #43108 only emits errors, never any notes.
To achieve parity of error message quality with AST-borrowck, we need to add notes.
(In most cases, one can probably cross-reference the emitted error with the point where that error is emitted in the AST-borrowck, and then figure out how to construct the same note.)
Mentoring instructions here.
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
pnkfelix commentedon Sep 15, 2017
Incidentally, someone taking this on may also want to consider incorporating some sort of fix here: nikomatsakis/nll-rfc#9
zilbuz commentedon Sep 15, 2017
I might be interested in doing this. Since I'm new to rust, any pointer to where I should start ? In particular, in which files am I expected to make changes ? Thanks :)
pnkfelix commentedon Sep 19, 2017
@zilbuz I would recommend you join us in https://gitter.im/rust-impl-period/WG-compiler-nll (assuming you have not already). We can give you real time guidance there.
But the quick answer to your immediate questions are:
err.span_label
, for example).KiChjang commentedon Sep 19, 2017
I would also be looking into this issue.
nikomatsakis commentedon Sep 19, 2017
I think there is room for multiple people to hack on this, but it'd be good to coordinate. Ideally @pnkfelix (or maybe I...) would go through the tests and try to make up a bullet list. I don't have time to do this just now, but perhaps if you are actively hacking on this, you could leave a note with which notes you are poking at?
Also, I'm not sure quite what @pnkfelix had in mind in terms of writing tests, but I think that for now, anyway, the best strategy is probably to clone the test from
src/test/compile-fail/borrowck
intosrc/test/compile-fail/mir-dataflow
and add#[rustc_mir_borrowck]
annotations. Or, actually, even better might be to createsrc/test/ui/mir-borrowck
and put the test in there. We can then have two copies of each function, one with#[rustc_mir_borrowck]
and one without. Due to the nature of UI tests, this will mean that the "expected output" shows us both the original and new output, making it easy to compare them. (Eventually we can remove the two variants, of course.)KiChjang commentedon Sep 19, 2017
So for this simple erroneous program here:
rustc spits out a lot of junk errors:
I'm going to first try and fix it up so that it only points correctly to the uninitialized
i
variable.nikomatsakis commentedon Sep 21, 2017
@KiChjang just to repeat what I said in gitter for the record, it seems that the problem is that we are considering a
StorageDead(X)
to be a "use" of X20 remaining items