diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/generator/issue-105084.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/generator/issue-105084.rs')
-rw-r--r-- | tests/ui/generator/issue-105084.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs deleted file mode 100644 index 50b5da6e6..000000000 --- a/tests/ui/generator/issue-105084.rs +++ /dev/null @@ -1,42 +0,0 @@ -#![feature(generators)] -#![feature(generator_clone)] -#![feature(generator_trait)] -#![feature(rustc_attrs, stmt_expr_attributes)] - -use std::ops::Generator; -use std::pin::Pin; - -fn copy<T: Copy>(x: T) -> T { - x -} - -fn main() { - let mut g = || { - // This is desuraged as 4 stages: - // - allocate a `*mut u8` with `exchange_malloc`; - // - create a Box that is ignored for trait computations; - // - compute fields (and yields); - // - assign to `t`. - let t = #[rustc_box] - Box::new((5, yield)); - drop(t); - }; - - // Allocate the temporary box. - Pin::new(&mut g).resume(()); - - // The temporary box is in generator locals. - // As it is not taken into account for trait computation, - // the generator is `Copy`. - let mut h = copy(g); - //~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in - - // We now have 2 boxes with the same backing allocation: - // one inside `g` and one inside `h`. - // Proceed and drop `t` in `g`. - Pin::new(&mut g).resume(()); - //~^ ERROR borrow of moved value: `g` - - // Proceed and drop `t` in `h` -> double free! - Pin::new(&mut h).resume(()); -} |