Skip to content

Slice/Array patterns are not correctly move checked #66502

Closed
@matthewjasper

Description

@matthewjasper

The following should error, but doesn't

#![feature(slice_patterns)]

fn main() {
    let a = [String::from("HELLO"), String::from("WORLD")];
    let [_, mut x] = a;
    x = String::from("RUST");
    let [ref y @ ..] = a;
    println!("{:?}", y); 
}

Metadata

Metadata

Assignees

Labels

A-borrow-checkerArea: The borrow checkerA-slice-patternsArea: Slice patterns, https://github.com/rust-lang/rust/issues/23121C-bugCategory: This is a bug.F-slice_patterns`#![feature(slice_patterns)]`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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions