mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-30 00:03:49 +00:00
24 lines
453 B
Rust
24 lines
453 B
Rust
//@ edition: 2018
|
|
// Regression test for <https://github.com/rust-lang/rust/issues/144155>.
|
|
|
|
struct NeedsDrop<'a>(&'a Vec<i32>);
|
|
|
|
async fn await_point() {}
|
|
|
|
impl Drop for NeedsDrop<'_> {
|
|
fn drop(&mut self) {}
|
|
}
|
|
|
|
fn foo() {
|
|
let v = vec![1, 2, 3];
|
|
let x = NeedsDrop(&v);
|
|
let c = async {
|
|
std::future::ready(()).await;
|
|
drop(x);
|
|
};
|
|
drop(v);
|
|
//~^ ERROR cannot move out of `v` because it is borrowed
|
|
}
|
|
|
|
fn main() {}
|