rust/tests/ui/pattern/deref-patterns/cant_move_out_of_pattern.rs

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

25 lines
473 B
Rust
Raw Normal View History

#![feature(deref_patterns)]
#![allow(incomplete_features)]
use std::rc::Rc;
struct Struct;
fn cant_move_out_box(b: Box<Struct>) -> Struct {
match b {
//~^ ERROR: cannot move out of a shared reference
deref!(x) => x,
_ => unreachable!(),
}
}
fn cant_move_out_rc(rc: Rc<Struct>) -> Struct {
match rc {
//~^ ERROR: cannot move out of a shared reference
deref!(x) => x,
_ => unreachable!(),
}
}
fn main() {}