tracking issue for bugs fixed by the MIR borrow checker or NLL #47366
Copy link
Copy link
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.Category: This is a bug.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCE-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.fixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.
Description
Part of: #43234
The MIR-based borrow checker used by NLL fixes a number of bugs in the existing AST-based borrow checker. Our plan for these bugs is to fix them by transitioning to the MIR-based borrow checker. In the meantime, we wish to add tests that show that the bugs are fixed with NLL, and then close the bugs (so they don't clutter up the issue tracker). This issue tracks the set of such bugs and gives instructions for how to proceed.
Bugs fixed by MIR
All these bugs are confirmed as fixed; the checkmark indicates that a PR with a test is enqueued or landed.
- Compiler accepts return mut ref to local var on no longer valid stackframe #46557
- borrowed referent of a
&Tsometimes incorrectly allowed #38899 - binding-less matches on borrowed data are incorrectly allowed #45045 (using example from this comment)
- Broken move semantics in
decl_macro#46314 - What are the semantics of '#[thread_local] static ...' without 'mut'? #47053 (PR Properly pass down immutability info for thread-locals. #47425)
- tracking issue for bugs fixed by the MIR borrow checker or NLL #47366 (examples from [this comment])
- Lifetime bounds in Copy impls are ignored #29149 (fix in Do not ignore lifetime bounds in Copy impls #47877)
- Incorrect partially moved value error check when pattern matching boxed structures. #16223
- nll rejects this code #48238 (and specifically this reduction)
- Borrow checker unsoundness with unions #45157
- Broken move semantics in
decl_macro#46314 (hygiene interaction) - Inconsistent evaluation order for assignment operations #27868 -- evaluation order and operators
- Incorrect partially moved value error check when pattern matching boxed structures. #16223 -- incorrect partially moved value error check
Procedure
- First, if you wish, add yourself to the list of participants for the WG-compiler-nll working group.
- This will help us to find people who might like to help later!
- Create a regression test in
src/test/ui/nll/- The name can be
issue-XXX.rs, though giving a more descriptive name is also good - The file should include a comment saying
// Regression test for #XXXhowever to ease searching later
- The name can be
- This test should include the error from the bug along with the following header material:
- Rust license
#![feature(nll)]at the top- comments like
//~ ERRORfor the errors, or whatever is needed for test harness to pass
- Run
./x.py test --stage 1 src/test/ui --test-args nll, this will test all the nll tests (including yours) - Presuming that passes, open a PR! Otherwise, stop in at the WG-compiler-nll gitter channel
- Put
r? @nikomatsakisin the PR summary
- Put
Reacted by Luis Gerhorst
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.Category: This is a bug.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCE-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.fixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.
Activity
chrisvittal commentedon Jan 11, 2018
I'll take this. Looks straightforward.
Add NLL tests for rust-lang#46557 and rust-lang#38899
nikomatsakis commentedon Jan 14, 2018
Added #45045 to the list.
nikomatsakis commentedon Jan 16, 2018
This isn't meant to be closed but rather kept open as a record of the issues involved. =)
nikomatsakis commentedon Jan 16, 2018
Added #46314 to the list
[-]add tests for bugs fixed by the MIR borrow checker[/-][+]tracking issue for bugs fixed by the MIR borrow checker[/+]Rollup merge of rust-lang#47456 - chrisvittal:nll-tests, r=nikomatsakis
Rollup merge of rust-lang#47456 - chrisvittal:nll-tests, r=nikomatsakis
nikomatsakis commentedon Jan 17, 2018
Added #47053, though I think that it will be handled in #47425
3 remaining items
sapphire-arches commentedon Feb 19, 2018
Added #16223
Rollup merge of rust-lang#53326 - memoryruins:issue-27868-test, r=nik…
acrrd commentedon May 4, 2019
The test for #48238 has been added in #49295.
The test for #27868 has been added in #53326.
The test for #16223 (that appears two times in the list) has been added in #49781.
Rollup merge of rust-lang#64221 - Centril:nll-no-migrate-2015, r=matt…
Rollup merge of rust-lang#64221 - Centril:nll-no-migrate-2015, r=matt…
Rollup merge of rust-lang#64221 - Centril:nll-no-migrate-2015, r=matt…
Rollup merge of rust-lang#64221 - Centril:nll-no-migrate-2015, r=matt…