Skip to content

MIR-borrowck: (unsound) fails to see error in borrowck-init-in-fru.rs #44833

Closed
@pnkfelix

Description

@pnkfelix

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-init-in-fru.rs
error[E0381]: use of possibly uninitialized variable: `origin.y` (Ast)
  --> ./src/test/compile-fail/borrowck/borrowck-init-in-fru.rs:19:30
   |
19 |     origin = point {x: 10,.. origin}; //~ ERROR use of possibly uninitialized variable: `origin.y`
   |                              ^^^^^^ use of possibly uninitialized `origin.y`

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    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/Soundness

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions