diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/ui/unique | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/unique')
41 files changed, 0 insertions, 521 deletions
diff --git a/tests/ui/unique/unique-assign-copy.rs b/tests/ui/unique/unique-assign-copy.rs deleted file mode 100644 index b742973ce..000000000 --- a/tests/ui/unique/unique-assign-copy.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass - -pub fn main() { - let mut i: Box<_> = Box::new(1); - // Should be a copy - let mut j; - j = i.clone(); - *i = 2; - *j = 3; - assert_eq!(*i, 2); - assert_eq!(*j, 3); -} diff --git a/tests/ui/unique/unique-assign-drop.rs b/tests/ui/unique/unique-assign-drop.rs deleted file mode 100644 index e7685b589..000000000 --- a/tests/ui/unique/unique-assign-drop.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -#![allow(unused_assignments)] - -pub fn main() { - let i: Box<_> = Box::new(1); - let mut j: Box<_> = Box::new(2); - // Should drop the previous value of j - j = i; - assert_eq!(*j, 1); -} diff --git a/tests/ui/unique/unique-assign-generic.rs b/tests/ui/unique/unique-assign-generic.rs deleted file mode 100644 index d4932d833..000000000 --- a/tests/ui/unique/unique-assign-generic.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f<T>(t: T) -> T { - let t1 = t; - t1 -} - -pub fn main() { - let t = f::<Box<_>>(Box::new(100)); - assert_eq!(t, Box::new(100)); -} diff --git a/tests/ui/unique/unique-assign.rs b/tests/ui/unique/unique-assign.rs deleted file mode 100644 index d598744f1..000000000 --- a/tests/ui/unique/unique-assign.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -#![allow(unused_mut)] - -pub fn main() { - let mut i: Box<_>; - i = Box::new(1); - assert_eq!(*i, 1); -} diff --git a/tests/ui/unique/unique-autoderef-field.rs b/tests/ui/unique/unique-autoderef-field.rs deleted file mode 100644 index 64147e11f..000000000 --- a/tests/ui/unique/unique-autoderef-field.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -struct J { j: isize } - -pub fn main() { - let i: Box<_> = Box::new(J { - j: 100 - }); - assert_eq!(i.j, 100); -} diff --git a/tests/ui/unique/unique-autoderef-index.rs b/tests/ui/unique/unique-autoderef-index.rs deleted file mode 100644 index ea6598a7f..000000000 --- a/tests/ui/unique/unique-autoderef-index.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(vec![100]); - assert_eq!((*i)[0], 100); -} diff --git a/tests/ui/unique/unique-cmp.rs b/tests/ui/unique/unique-cmp.rs deleted file mode 100644 index ee05dd5a3..000000000 --- a/tests/ui/unique/unique-cmp.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(unused_allocation)] - -pub fn main() { - let i: Box<_> = Box::new(100); - assert_eq!(i, Box::new(100)); - assert!(i < Box::new(101)); - assert!(i <= Box::new(100)); - assert!(i > Box::new(99)); - assert!(i >= Box::new(99)); -} diff --git a/tests/ui/unique/unique-containing-tag.rs b/tests/ui/unique/unique-containing-tag.rs deleted file mode 100644 index 6c31ae99b..000000000 --- a/tests/ui/unique/unique-containing-tag.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -pub fn main() { - enum t { t1(isize), t2(isize), } - - let _x: Box<_> = Box::new(t::t1(10)); - - /*alt *x { - t1(a) { - assert_eq!(a, 10); - } - _ { panic!(); } - }*/ - - /*alt x { - Box::new(t1(a) { - assert_eq!(a, 10); - }) - _ { panic!(); } - }*/ -} diff --git a/tests/ui/unique/unique-create.rs b/tests/ui/unique/unique-create.rs deleted file mode 100644 index c566e7962..000000000 --- a/tests/ui/unique/unique-create.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -pub fn main() { - let _: Box<_> = Box::new(100); -} - -fn vec() { - vec![0]; -} diff --git a/tests/ui/unique/unique-decl-init-copy.rs b/tests/ui/unique/unique-decl-init-copy.rs deleted file mode 100644 index 5b9576fcc..000000000 --- a/tests/ui/unique/unique-decl-init-copy.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -pub fn main() { - let mut i: Box<_> = Box::new(1); - // Should be a copy - let mut j = i.clone(); - *i = 2; - *j = 3; - assert_eq!(*i, 2); - assert_eq!(*j, 3); -} diff --git a/tests/ui/unique/unique-decl-init.rs b/tests/ui/unique/unique-decl-init.rs deleted file mode 100644 index 1d70860c7..000000000 --- a/tests/ui/unique/unique-decl-init.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(1); - let j = i; - assert_eq!(*j, 1); -} diff --git a/tests/ui/unique/unique-decl-move.rs b/tests/ui/unique/unique-decl-move.rs deleted file mode 100644 index 21187510f..000000000 --- a/tests/ui/unique/unique-decl-move.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(100); - let j = i; - assert_eq!(*j, 100); -} diff --git a/tests/ui/unique/unique-decl.rs b/tests/ui/unique/unique-decl.rs deleted file mode 100644 index 84a1b2a5b..000000000 --- a/tests/ui/unique/unique-decl.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] - - -pub fn main() { - let _: Box<isize>; -} - -fn f(_i: Box<isize>) -> Box<isize> { - panic!(); -} diff --git a/tests/ui/unique/unique-deref.rs b/tests/ui/unique/unique-deref.rs deleted file mode 100644 index 33a1e9932..000000000 --- a/tests/ui/unique/unique-deref.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(100); - assert_eq!(*i, 100); -} diff --git a/tests/ui/unique/unique-destructure.rs b/tests/ui/unique/unique-destructure.rs deleted file mode 100644 index 7207ac962..000000000 --- a/tests/ui/unique/unique-destructure.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -#![feature(box_patterns)] - -struct Foo { a: isize, b: isize } - -pub fn main() { - let box Foo{ a, b } = Box::new(Foo { a: 100, b: 200 }); - assert_eq!(a + b, 300); -} diff --git a/tests/ui/unique/unique-drop-complex.rs b/tests/ui/unique/unique-drop-complex.rs deleted file mode 100644 index 2324f1e1a..000000000 --- a/tests/ui/unique/unique-drop-complex.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let _x: Box<_> = Box::new(vec![0,0,0,0,0]); -} diff --git a/tests/ui/unique/unique-ffi-symbols.rs b/tests/ui/unique/unique-ffi-symbols.rs deleted file mode 100644 index 77b5ead26..000000000 --- a/tests/ui/unique/unique-ffi-symbols.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -// We used to have a __rust_abi shim that resulted in duplicated symbols -// whenever the item path wasn't enough to disambiguate between them. -fn main() { - let a = { - extern "C" fn good() -> i32 { return 0; } - good as extern "C" fn() -> i32 - }; - let b = { - extern "C" fn good() -> i32 { return 5; } - good as extern "C" fn() -> i32 - }; - - assert!(a != b); - assert_eq!((a(), b()), (0, 5)); -} diff --git a/tests/ui/unique/unique-fn-arg-move.rs b/tests/ui/unique/unique-fn-arg-move.rs deleted file mode 100644 index 6d42df218..000000000 --- a/tests/ui/unique/unique-fn-arg-move.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -fn f(i: Box<isize>) { - assert_eq!(*i, 100); -} - -pub fn main() { - let i = Box::new(100); - f(i); -} diff --git a/tests/ui/unique/unique-fn-arg-mut.rs b/tests/ui/unique/unique-fn-arg-mut.rs deleted file mode 100644 index 01510200b..000000000 --- a/tests/ui/unique/unique-fn-arg-mut.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(i: &mut Box<isize>) { - *i = Box::new(200); -} - -pub fn main() { - let mut i = Box::new(100); - f(&mut i); - assert_eq!(*i, 200); -} diff --git a/tests/ui/unique/unique-fn-arg.rs b/tests/ui/unique/unique-fn-arg.rs deleted file mode 100644 index b4f3bc4b2..000000000 --- a/tests/ui/unique/unique-fn-arg.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -fn f(i: Box<isize>) { - assert_eq!(*i, 100); -} - -pub fn main() { - f(Box::new(100)); - let i = Box::new(100); - f(i); -} diff --git a/tests/ui/unique/unique-fn-ret.rs b/tests/ui/unique/unique-fn-ret.rs deleted file mode 100644 index 773a9bce1..000000000 --- a/tests/ui/unique/unique-fn-ret.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -fn f() -> Box<isize> { - Box::new(100) -} - -pub fn main() { - assert_eq!(f(), Box::new(100)); -} diff --git a/tests/ui/unique/unique-generic-assign.rs b/tests/ui/unique/unique-generic-assign.rs deleted file mode 100644 index 9c4405aa8..000000000 --- a/tests/ui/unique/unique-generic-assign.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #976 - - -// pretty-expanded FIXME #23616 - -fn f<T>(x: Box<T>) { - let _x2 = x; -} -pub fn main() { } diff --git a/tests/ui/unique/unique-in-tag.rs b/tests/ui/unique/unique-in-tag.rs deleted file mode 100644 index 6daa06fb1..000000000 --- a/tests/ui/unique/unique-in-tag.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -fn test1() { - enum bar { u(Box<isize>), w(isize), } - - let x = bar::u(Box::new(10)); - assert!(match x { - bar::u(a) => { - println!("{}", a); - *a - } - _ => { 66 } - } == 10); -} - -pub fn main() { - test1(); -} diff --git a/tests/ui/unique/unique-in-vec-copy.rs b/tests/ui/unique/unique-in-vec-copy.rs deleted file mode 100644 index ce52d15ef..000000000 --- a/tests/ui/unique/unique-in-vec-copy.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass - -pub fn main() { - let mut a: Vec<Box<_>> = vec![Box::new(10)]; - let b = a.clone(); - - assert_eq!(*a[0], 10); - assert_eq!(*b[0], 10); - - // This should only modify the value in a, not b - *a[0] = 20; - - assert_eq!(*a[0], 20); - assert_eq!(*b[0], 10); -} diff --git a/tests/ui/unique/unique-in-vec.rs b/tests/ui/unique/unique-in-vec.rs deleted file mode 100644 index 1e8d05e3d..000000000 --- a/tests/ui/unique/unique-in-vec.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let vect : Vec<Box<_>> = vec![Box::new(100)]; - assert_eq!(vect[0], Box::new(100)); -} diff --git a/tests/ui/unique/unique-init.rs b/tests/ui/unique/unique-init.rs deleted file mode 100644 index d19605046..000000000 --- a/tests/ui/unique/unique-init.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let _i: Box<_> = Box::new(100); -} diff --git a/tests/ui/unique/unique-kinds.rs b/tests/ui/unique/unique-kinds.rs deleted file mode 100644 index f02d0b507..000000000 --- a/tests/ui/unique/unique-kinds.rs +++ /dev/null @@ -1,64 +0,0 @@ -// run-pass - -use std::cmp::PartialEq; -use std::fmt::Debug; - -fn sendable() { - - fn f<T:Send + PartialEq + Debug>(i: T, j: T) { - assert_eq!(i, j); - } - - fn g<T:Send + PartialEq>(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(100); - f(i, j); - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(101); - g(i, j); -} - -fn copyable() { - - fn f<T:PartialEq + Debug>(i: T, j: T) { - assert_eq!(i, j); - } - - fn g<T:PartialEq>(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(100); - f(i, j); - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(101); - g(i, j); -} - -fn noncopyable() { - - fn f<T:PartialEq + Debug>(i: T, j: T) { - assert_eq!(i, j); - } - - fn g<T:PartialEq>(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(100); - f(i, j); - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(101); - g(i, j); -} - -pub fn main() { - sendable(); - copyable(); - noncopyable(); -} diff --git a/tests/ui/unique/unique-log.rs b/tests/ui/unique/unique-log.rs deleted file mode 100644 index 0715d1662..000000000 --- a/tests/ui/unique/unique-log.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -pub fn main() { - let i: Box<_> = Box::new(100); - println!("{}", i); -} diff --git a/tests/ui/unique/unique-match-discrim.rs b/tests/ui/unique/unique-match-discrim.rs deleted file mode 100644 index 6e6d74322..000000000 --- a/tests/ui/unique/unique-match-discrim.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #961 - -// pretty-expanded FIXME #23616 - -fn altsimple() { - match Box::new(true) { - _ => { } - } -} -pub fn main() { } diff --git a/tests/ui/unique/unique-move-drop.rs b/tests/ui/unique/unique-move-drop.rs deleted file mode 100644 index c0f5d8f90..000000000 --- a/tests/ui/unique/unique-move-drop.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -#![allow(unused_variables)] - -pub fn main() { - let i: Box<_> = Box::new(100); - let j: Box<_> = Box::new(200); - let j = i; - assert_eq!(*j, 100); -} diff --git a/tests/ui/unique/unique-move-temp.rs b/tests/ui/unique/unique-move-temp.rs deleted file mode 100644 index 103af8e1f..000000000 --- a/tests/ui/unique/unique-move-temp.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -#![allow(unused_mut)] - -pub fn main() { - let mut i: Box<_>; - i = Box::new(100); - assert_eq!(*i, 100); -} diff --git a/tests/ui/unique/unique-move.rs b/tests/ui/unique/unique-move.rs deleted file mode 100644 index 40a2718e4..000000000 --- a/tests/ui/unique/unique-move.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -#![allow(unused_mut)] - -pub fn main() { - let i: Box<_> = Box::new(100); - let mut j; - j = i; - assert_eq!(*j, 100); -} diff --git a/tests/ui/unique/unique-mutable.rs b/tests/ui/unique/unique-mutable.rs deleted file mode 100644 index 0367c0809..000000000 --- a/tests/ui/unique/unique-mutable.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { - let mut i: Box<_> = Box::new(0); - *i = 1; - assert_eq!(*i, 1); -} diff --git a/tests/ui/unique/unique-object-move.rs b/tests/ui/unique/unique-object-move.rs deleted file mode 100644 index bb35a9b2d..000000000 --- a/tests/ui/unique/unique-object-move.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(dead_code)] -// Issue #5192 - -// pretty-expanded FIXME #23616 - -pub trait EventLoop { fn foo(&self) {} } - -pub struct UvEventLoop { - uvio: isize -} - -impl EventLoop for UvEventLoop { } - -pub fn main() { - let loop_: Box<dyn EventLoop> = Box::new(UvEventLoop { uvio: 0 }) as Box<dyn EventLoop>; - let _loop2_ = loop_; -} diff --git a/tests/ui/unique/unique-pat-2.rs b/tests/ui/unique/unique-pat-2.rs deleted file mode 100644 index 9c73fd220..000000000 --- a/tests/ui/unique/unique-pat-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] -#![allow(non_shorthand_field_patterns)] - -#![feature(box_patterns)] - -struct Foo {a: isize, b: usize} - -enum bar { u(Box<Foo>), w(isize), } - -pub fn main() { - let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) { - bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) } - _ => { 66 } - }; - assert_eq!(v, 50); -} diff --git a/tests/ui/unique/unique-pat-3.rs b/tests/ui/unique/unique-pat-3.rs deleted file mode 100644 index 2e81f898d..000000000 --- a/tests/ui/unique/unique-pat-3.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -enum bar { u(Box<isize>), w(isize), } - -pub fn main() { - let v = match bar::u(10.into()) { - bar::u(a) => { - println!("{}", a); - *a - } - _ => { 66 } - }; - assert_eq!(v, 10); -} diff --git a/tests/ui/unique/unique-pat.rs b/tests/ui/unique/unique-pat.rs deleted file mode 100644 index c2474d0e7..000000000 --- a/tests/ui/unique/unique-pat.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -#![feature(box_patterns)] - -fn simple() { - match Box::new(true) { - box true => { } - _ => { panic!(); } - } -} - -pub fn main() { - simple(); -} diff --git a/tests/ui/unique/unique-rec.rs b/tests/ui/unique/unique-rec.rs deleted file mode 100644 index 9f8ad9bb0..000000000 --- a/tests/ui/unique/unique-rec.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -struct X { x: isize } - -pub fn main() { - let x: Box<_> = Box::new(X {x: 1}); - let bar = x; - assert_eq!(bar.x, 1); -} diff --git a/tests/ui/unique/unique-send-2.rs b/tests/ui/unique/unique-send-2.rs deleted file mode 100644 index 23ddd2cdc..000000000 --- a/tests/ui/unique/unique-send-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// run-pass -#![allow(unused_must_use)] -// ignore-emscripten no threads support - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -fn child(tx: &Sender<Box<usize>>, i: usize) { - tx.send(Box::new(i)).unwrap(); -} - -pub fn main() { - let (tx, rx) = channel(); - let n = 100; - let mut expected = 0; - let ts = (0..n).map(|i| { - expected += i; - let tx = tx.clone(); - thread::spawn(move|| { - child(&tx, i) - }) - }).collect::<Vec<_>>(); - - let mut actual = 0; - for _ in 0..n { - let j = rx.recv().unwrap(); - actual += *j; - } - - assert_eq!(expected, actual); - - for t in ts { t.join(); } -} diff --git a/tests/ui/unique/unique-send.rs b/tests/ui/unique/unique-send.rs deleted file mode 100644 index 431cc2be5..000000000 --- a/tests/ui/unique/unique-send.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -use std::sync::mpsc::channel; - -pub fn main() { - let (tx, rx) = channel::<Box<_>>(); - tx.send(Box::new(100)).unwrap(); - let v = rx.recv().unwrap(); - assert_eq!(v, Box::new(100)); -} diff --git a/tests/ui/unique/unique-swap.rs b/tests/ui/unique/unique-swap.rs deleted file mode 100644 index 4f33ff9a8..000000000 --- a/tests/ui/unique/unique-swap.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass - -use std::mem::swap; - -pub fn main() { - let mut i: Box<_> = Box::new(100); - let mut j: Box<_> = Box::new(200); - swap(&mut i, &mut j); - assert_eq!(i, Box::new(200)); - assert_eq!(j, Box::new(100)); -} |