blob: 72b83e274c9298570646f13fd650864ff49a6bcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
//! Regression test for #122630
//@ compile-flags: -Zvalidate-mir
#![feature(coroutines, coroutine_trait, yield_expr)]
use std::ops::Coroutine;
const FOO_SIZE: usize = 1024;
struct Foo([u8; FOO_SIZE]);
impl Drop for Foo {
fn drop(&mut self) {}
}
fn overlap_move_points() -> impl Coroutine<Yield = ()> {
#[coroutine] static || {
let first = Foo([0; FOO_SIZE]);
yield;
let second = first;
yield;
let second = first;
//~^ ERROR: use of moved value: `first` [E0382]
yield;
}
}
fn main() {}
|