summaryrefslogtreecommitdiffstats
path: root/src/test/ui/span/borrowck-let-suggestion-suffixes.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/span/borrowck-let-suggestion-suffixes.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/span/borrowck-let-suggestion-suffixes.rs')
-rw-r--r--src/test/ui/span/borrowck-let-suggestion-suffixes.rs59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
deleted file mode 100644
index 18abfb5c3..000000000
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-fn id<T>(x: T) -> T { x }
-
-fn f() {
- let old = ['o']; // statement 0
- let mut v1 = Vec::new(); // statement 1
-
- let mut v2 = Vec::new(); // statement 2
-
- {
- let young = ['y']; // statement 3
-
- v2.push(&young[0]); // statement 4
- //~^ ERROR `young[_]` does not live long enough
- //~| NOTE borrowed value does not live long enough
- } //~ NOTE `young[_]` dropped here while still borrowed
-
- let mut v3 = Vec::new(); // statement 5
-
- v3.push(&id('x')); // statement 6
- //~^ ERROR temporary value dropped while borrowed
- //~| NOTE creates a temporary value which is freed while still in use
- //~| NOTE temporary value is freed at the end of this statement
- //~| HELP consider using a `let` binding to create a longer lived value
-
- {
-
- let mut v4 = Vec::new(); // (sub) statement 0
-
- v4.push(&id('y'));
- //~^ ERROR temporary value dropped while borrowed
- //~| NOTE creates a temporary value which is freed while still in use
- //~| NOTE temporary value is freed at the end of this statement
- //~| NOTE consider using a `let` binding to create a longer lived value
- v4.use_ref();
- //~^ NOTE borrow later used here
- } // (statement 7)
-
- let mut v5 = Vec::new(); // statement 8
-
- v5.push(&id('z'));
- //~^ ERROR temporary value dropped while borrowed
- //~| NOTE creates a temporary value which is freed while still in use
- //~| NOTE temporary value is freed at the end of this statement
- //~| HELP consider using a `let` binding to create a longer lived value
-
- v1.push(&old[0]);
-
- (v1, v2, v3, /* v4 is above. */ v5).use_ref();
- //~^ NOTE borrow later used here
- //~| NOTE borrow later used here
- //~| NOTE borrow later used here
-}
-
-fn main() {
- f();
-}
-
-trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
-impl<T> Fake for T { }