rust/src/test/ui/let-else/let-else-binding-immutable.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
207 B
Rust
Raw Normal View History

// from rfc2005 test suite
#![feature(let_else)]
pub fn main() {
let Some(x) = &Some(3) else {
panic!();
};
*x += 1; //~ ERROR: cannot assign to `*x`, which is behind a `&` reference
}