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