Skip to content

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

Closed
@pnkfelix

Description

@pnkfelix
Member

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

Activity

added
C-bugCategory: This is a bug.
I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
on Sep 27, 2017
added
B-unstableBlocker: Implemented in the nightly compiler and unstable.
on Sep 27, 2017
added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 13, 2017
added this to the NLL prototype milestone on Nov 15, 2017
added a commit that references this issue on Dec 6, 2017

Auto merge of #46268 - arielb1:union-borrow, r=nikomatsakis

cf30759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-borrow-checkerArea: The borrow checkerB-unstableBlocker: Implemented in the nightly compiler and unstable.C-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @pnkfelix@bstrie@TimNN@arielb1

      Issue actions

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