summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lifetimes/lifetime-bound-will-change-warning.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/lifetimes/lifetime-bound-will-change-warning.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/lifetimes/lifetime-bound-will-change-warning.rs')
-rw-r--r--src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs
deleted file mode 100644
index 0d0303705..000000000
--- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-// aux-build:lifetime_bound_will_change_warning_lib.rs
-
-// Test that various corner cases cause an error. These are tests
-// that used to pass before we tweaked object defaults.
-
-#![allow(dead_code)]
-#![allow(unused_variables)]
-
-
-extern crate lifetime_bound_will_change_warning_lib as lib;
-
-fn just_ref(x: &dyn Fn()) {
-}
-
-fn ref_obj(x: &Box<dyn Fn()>) {
- // this will change to &Box<Fn()+'static>...
-
- // Note: no warning is issued here, because the type of `x` will change to 'static
- if false { ref_obj(x); }
-}
-
-fn test1<'a>(x: &'a Box<dyn Fn() + 'a>) {
- // just_ref will stay the same.
- just_ref(&**x)
-}
-
-fn test1cc<'a>(x: &'a Box<dyn Fn() + 'a>) {
- // same as test1, but cross-crate
- lib::just_ref(&**x)
-}
-
-fn test2<'a>(x: &'a Box<dyn Fn() + 'a>) {
- // but ref_obj will not, so warn.
- ref_obj(x)
- //~^ ERROR borrowed data escapes
-}
-
-fn test2cc<'a>(x: &'a Box<dyn Fn() + 'a>) {
- // same as test2, but cross crate
- lib::ref_obj(x)
- //~^ ERROR borrowed data escapes
-}
-
-fn test3<'a>(x: &'a Box<dyn Fn() + 'static>) {
- // here, we have a 'static bound, so even when ref_obj changes, no error results
- ref_obj(x)
-}
-
-fn test3cc<'a>(x: &'a Box<dyn Fn() + 'static>) {
- // same as test3, but cross crate
- lib::ref_obj(x)
-}
-
-
-fn main() {
-}