summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generator/dropck-resume.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/generator/dropck-resume.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/generator/dropck-resume.rs')
-rw-r--r--src/test/ui/generator/dropck-resume.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/test/ui/generator/dropck-resume.rs b/src/test/ui/generator/dropck-resume.rs
deleted file mode 100644
index 4c18077f3..000000000
--- a/src/test/ui/generator/dropck-resume.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-struct SetToNone<'a: 'b, 'b>(&'b mut Option<&'a i32>);
-
-impl<'a, 'b> Drop for SetToNone<'a, 'b> {
- fn drop(&mut self) {
- *self.0 = None;
- }
-}
-
-fn drop_using_generator() -> i32 {
- let mut y = Some(&0);
- let z = &mut y;
- let r;
- {
- let mut g = move |r| {
- let _s = SetToNone(r);
- yield;
- };
- let mut g = Pin::new(&mut g);
- g.as_mut().resume(z);
- r = y.as_ref().unwrap();
- //~^ ERROR cannot borrow `y` as immutable because it is also borrowed as mutable
- }
- **r
-}
-
-fn main() {
- println!("{}", drop_using_generator());
-}