Skip to content

MIR Borrowck does not handle borrows of array elements #45537

Closed
@nikomatsakis

Description

@nikomatsakis

This example only shows 1 error, from the AST borrow checker:

#![allow(warnings)]
#![feature(rustc_attrs)]

fn use_x(_: usize) -> bool { true }

#[rustc_mir_borrowck]
fn main() {
    let mut v = [1, 2, 3];
    let p = &v[0];
    if true {
        use_x(*p);
    } else {
        use_x(22);
    }
    v[0] += 1;
}

cc @arielb1

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions