summaryrefslogtreecommitdiffstats
path: root/src/test/ui/closures/2229_closure_analysis/issue-88476.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/ui/closures/2229_closure_analysis/issue-88476.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/closures/2229_closure_analysis/issue-88476.rs')
-rw-r--r--src/test/ui/closures/2229_closure_analysis/issue-88476.rs62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/issue-88476.rs b/src/test/ui/closures/2229_closure_analysis/issue-88476.rs
deleted file mode 100644
index f5906d306..000000000
--- a/src/test/ui/closures/2229_closure_analysis/issue-88476.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-// edition:2021
-
-#![feature(rustc_attrs)]
-
-// Test that we can't move out of struct that impls `Drop`.
-
-
-use std::rc::Rc;
-
-// Test that we restrict precision when moving not-`Copy` types, if any of the parent paths
-// implement `Drop`. This is to ensure that we don't move out of a type that implements Drop.
-pub fn test1() {
- struct Foo(Rc<i32>);
-
- impl Drop for Foo {
- fn drop(self: &mut Foo) {}
- }
-
- let f = Foo(Rc::new(1));
- let x = #[rustc_capture_analysis] move || {
- //~^ ERROR: attributes on expressions are experimental
- //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
- //~| ERROR: First Pass analysis includes:
- //~| ERROR: Min Capture analysis includes:
- println!("{:?}", f.0);
- //~^ NOTE: Capturing f[(0, 0)] -> ImmBorrow
- //~| NOTE: Min Capture f[] -> ByValue
- };
-
- x();
-}
-
-// Test that we don't restrict precision when moving `Copy` types(i.e. when copying),
-// even if any of the parent paths implement `Drop`.
-fn test2() {
- struct Character {
- hp: u32,
- name: String,
- }
-
- impl Drop for Character {
- fn drop(&mut self) {}
- }
-
- let character = Character { hp: 100, name: format!("A") };
-
- let c = #[rustc_capture_analysis] move || {
- //~^ ERROR: attributes on expressions are experimental
- //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701>
- //~| ERROR: First Pass analysis includes:
- //~| ERROR: Min Capture analysis includes:
- println!("{}", character.hp)
- //~^ NOTE: Capturing character[(0, 0)] -> ImmBorrow
- //~| NOTE: Min Capture character[(0, 0)] -> ByValue
- };
-
- c();
-
- println!("{}", character.name);
-}
-
-fn main() {}