Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two-phase borrows creates extra error messages #48418

Closed
nikomatsakis opened this issue Feb 22, 2018 · 2 comments
Closed

two-phase borrows creates extra error messages #48418

nikomatsakis opened this issue Feb 22, 2018 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Feb 22, 2018

As uncovered in #47689, two-phase borrows as implemented can lead to "extra" and confusing error messages. The problem is that each time we have a "gen " of the activation, we do the activation check -- but if there are two activations in a row, each of them can emit an error, when we only want an error from the first.

The HEAD~1 commit in branch issue-48418 on my repository fixes the problem, but probably not in a sound way, as discussed in this commit (and its successor).

The proper fix either involves adding a dominator check (suppress activation of bit B at A2 if it is dominated by another activation of bit B at A1), or else a "must activate" sort of analysis.

cc @pnkfelix

@nikomatsakis nikomatsakis added WG-compiler-nll T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 22, 2018
@nikomatsakis nikomatsakis added this to the NLL: diagnostic parity milestone Feb 22, 2018
@nikomatsakis nikomatsakis added A-diagnostics Area: Messages for errors, warnings, and lints A-NLL Area: Non-lexical lifetimes (NLL) labels Feb 22, 2018
@nikomatsakis
Copy link
Contributor Author

cc @rust-lang/wg-compiler-nll -- this is a bit of an opaque description, but maybe someone is interested in taking a crack at this? If so, @pnkfelix or I can try to hammer out more precise instructions if needed, though perhaps we ought to settle on the fix we actually want. =)

@nikomatsakis
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant