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