diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-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/regions/regions-bounded-by-trait-requiring-static.rs')
-rw-r--r-- | src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs deleted file mode 100644 index 7d02a4619..000000000 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Test which of the builtin types are considered sendable. The tests -// in this file all test region bound and lifetime violations that are -// detected during type check. - -trait Dummy : 'static { } -fn assert_send<T:'static>() { } - -// lifetime pointers with 'static lifetime are ok - -fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) { - assert_send::<&'static isize>(); - assert_send::<&'static str>(); - assert_send::<&'static [isize]>(); - - // whether or not they are mutable - assert_send::<&'static mut isize>(); -} - -// otherwise lifetime pointers are not ok - -fn param_not_ok<'a>(x: &'a isize) { - assert_send::<&'a isize>(); - //~^ ERROR lifetime may not live long enough -} - -fn param_not_ok1<'a>(_: &'a isize) { - assert_send::<&'a str>(); - //~^ ERROR lifetime may not live long enough -} - -fn param_not_ok2<'a>(_: &'a isize) { - assert_send::<&'a [isize]>(); - //~^ ERROR lifetime may not live long enough -} - -// boxes are ok - -fn box_ok() { - assert_send::<Box<isize>>(); - assert_send::<String>(); - assert_send::<Vec<isize>>(); -} - -// but not if they own a bad thing - -fn box_with_region_not_ok<'a>() { - assert_send::<Box<&'a isize>>(); - //~^ ERROR lifetime may not live long enough -} - -// raw pointers are ok unless they point at unsendable things - -fn unsafe_ok1<'a>(_: &'a isize) { - assert_send::<*const isize>(); - assert_send::<*mut isize>(); -} - -fn unsafe_ok2<'a>(_: &'a isize) { - assert_send::<*const &'a isize>(); - //~^ ERROR lifetime may not live long enough -} - -fn unsafe_ok3<'a>(_: &'a isize) { - assert_send::<*mut &'a isize>(); - //~^ ERROR lifetime may not live long enough -} - -fn main() { -} |