Skip to content

fix "bivariant wf" bug in the NLL subtyping code #54105

New issue

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

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

Already on GitHub? # to your account

Open
nikomatsakis opened this issue Sep 10, 2018 · 8 comments
Open

fix "bivariant wf" bug in the NLL subtyping code #54105

nikomatsakis opened this issue Sep 10, 2018 · 8 comments
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) A-trait-system Area: Trait system C-bug Category: This is a bug. NLL-sound Working towards the "invalid code does not compile" goal P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

#53873 generalized the NLL subtyping code to handle subtyping and the like, but I think it is vulnerable to a similar flaw as the one from #41677. I didn't want to block that PR so I am filing this issue to follow-up.

@nikomatsakis nikomatsakis self-assigned this Sep 10, 2018
@nikomatsakis nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. NLL-sound Working towards the "invalid code does not compile" goal labels Sep 10, 2018
@nikomatsakis nikomatsakis added this to the Edition 2018 RC 2 milestone Sep 10, 2018
nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Sep 10, 2018
bors added a commit that referenced this issue Sep 11, 2018
…n-ascription, r=pnkfelix

support ascription for patterns in NLL

This implements the strategy outlined in [this comment](#47184 (comment)):

- We first extend the NLL subtyping code so it can handle inference variables and subtyping.
- Then we extend HAIR patterns with type ascription.
- Then we treat the type `T` in `let pat: T = ...` as an ascription.

Before landing, a few things:

- [x] Fix the WF rule bug (filed a FIXME #54105)
- [x] Fix an ICE I encountered locally around bound regions, or else file a follow-up
- [x] More tests probably =)

r? @pnkfelix
@nikomatsakis nikomatsakis added the A-NLL Area: Non-lexical lifetimes (NLL) label Oct 4, 2018
@pnkfelix pnkfelix self-assigned this Oct 9, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Oct 9, 2018

assigning self to this to try to help offload work from @nikomatsakis

@nikomatsakis
Copy link
Contributor Author

I have yet to come up with a way to exercise this bug. I tried e.g. this example but we do catch it.

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Oct 18, 2018

I'm demoting this to Release. I still think there is probably a bug here but since we don't even know how to reproduce it, it doesn't seem like an RC2 blocker.

@nikomatsakis nikomatsakis removed this from the Rust 2018 Release milestone Nov 13, 2018
@nikomatsakis nikomatsakis added the A-trait-system Area: Trait system label Nov 13, 2018
@nikomatsakis
Copy link
Contributor Author

Tagging as A-traits too because @scalexm is expanding this code as part of their work on the trait system unification code, and we may wind up fixing it then. Still need to come up with a test case.

Removing from the Rust 2018 milestone.

@pnkfelix
Copy link
Member

NLL triage. This needs prioritization. I'm inclined to go with P-medium.

@pnkfelix
Copy link
Member

nominating for discussion at NLL meeting tonight. Namely, I'm seeking a volunteer to look for a test case.

@pnkfelix
Copy link
Member

pnkfelix commented Feb 27, 2019

removing I-nominated tag. We discussed briefly at the NLL meeting but I think I didn't make the bait here attractive enough.

@pnkfelix
Copy link
Member

pnkfelix commented Mar 6, 2019

NLL-triage. Marking P-medium.

@pnkfelix pnkfelix added the P-medium Medium priority label Mar 6, 2019
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Jan 13, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) A-trait-system Area: Trait system C-bug Category: This is a bug. NLL-sound Working towards the "invalid code does not compile" goal P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants