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

MIR-borrowck: (unsound) fails to see errors in borrowck-vec-pattern-move-tail.rs #44834

Closed
pnkfelix opened this issue Sep 25, 2017 · 0 comments
Closed
Assignees
Labels
A-borrow-checker Area: The borrow checker B-unstable Blocker: Implemented in the nightly compiler and unstable. C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Sep 25, 2017

Many MIR-borrowck bugs have been categorized as either extra errors or poor diagnostics, but this is a case where MIR borrowck is simply failing to flag the main error in the code in question.

We see below that AST-borrowck is flagging the error while MIR-borrowck says nothing. (This is atop the mir-borrowck4 branch from #44736 )

 % ./objdir-dbgopt/build/x86_64-unknown-linux-gnu/stage1/bin/rustc -Z emit-end-regions \
    -Z borrowck-mir ./src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs
error[E0506]: cannot assign to `a[..]` because it is borrowed (Ast)
  --> ./src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs:20:5
   |
16 |         [1, 2, ref tail..] => tail,
   |                -------- borrow of `a[..]` occurs here
...
20 |     a[2] = 0; //~ ERROR cannot assign to `a[..]` because it is borrowed
   |     ^^^^^^^^ assignment to borrowed `a[..]` occurs here

error: aborting due to previous error
@TimNN TimNN added A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness labels Sep 27, 2017
@bstrie bstrie added the B-unstable Blocker: Implemented in the nightly compiler and unstable. label Sep 27, 2017
@pnkfelix pnkfelix added WG-compiler-nll T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 13, 2017
@arielb1 arielb1 added this to the NLL prototype milestone Nov 15, 2017
arielb1 added a commit to arielb1/rust that referenced this issue Dec 6, 2017
Fixes rust-lang#44831.
Fixes rust-lang#44834.
Fixes rust-lang#45537.
Fixes rust-lang#45696 (by implementing DerefPure semantics, which is what we want
going forward).
bors added a commit that referenced this issue Dec 6, 2017
MIR borrowck: implement union-and-array-compatible semantics

Fixes #44831.
Fixes #44834.
Fixes #45537.
Fixes #45696 (by implementing DerefPure semantics, which is what we want going forward).

r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker B-unstable Blocker: Implemented in the nightly compiler and unstable. C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness 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

4 participants