2022-12-08 19:14:56 -06:00
|
|
|
//@ run-rustfix
|
|
|
|
#![allow(unused)]
|
2014-05-22 18:57:53 -05:00
|
|
|
struct S(String);
|
2013-06-20 14:11:47 -05:00
|
|
|
impl Drop for S {
|
2013-11-01 20:06:31 -05:00
|
|
|
fn drop(&mut self) { }
|
2013-06-20 14:11:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn move_in_match() {
|
2014-05-25 05:17:19 -05:00
|
|
|
match S("foo".to_string()) {
|
2016-05-16 17:40:27 -05:00
|
|
|
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
|
2019-04-22 02:40:08 -05:00
|
|
|
S(_s) => {}
|
2013-06-20 14:11:47 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn move_in_let() {
|
2014-05-25 05:17:19 -05:00
|
|
|
let S(_s) = S("foo".to_string());
|
2016-05-16 17:40:27 -05:00
|
|
|
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
|
2013-06-20 14:11:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn move_in_fn_arg(S(_s): S) {
|
2016-05-16 17:40:27 -05:00
|
|
|
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
|
2013-06-20 14:11:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|