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/builtin-superkinds | |
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/builtin-superkinds')
18 files changed, 0 insertions, 322 deletions
diff --git a/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs b/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs deleted file mode 100644 index acfd1e13e..000000000 --- a/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Test library crate for cross-crate usages of traits inheriting -// from the builtin kinds. Mostly tests metadata correctness. - -#![crate_type="lib"] - -pub trait RequiresShare : Sync { } -pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } -pub trait RequiresCopy : Copy { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities-transitive.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities-transitive.rs deleted file mode 100644 index 1f997d371..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities-transitive.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -// Tests "transitivity" of super-builtin-kinds on traits. Here, if -// we have a Foo, we know we have a Bar, and if we have a Bar, we -// know we have a Send. So if we have a Foo we should know we have -// a Send. Basically this just makes sure rustc is using -// each_bound_trait_and_supertraits in type_contents correctly. - - -use std::sync::mpsc::{channel, Sender}; - -trait Bar : Send { } -trait Foo : Bar { } - -impl <T: Send> Foo for T { } -impl <T: Send> Bar for T { } - -fn foo<T: Foo + 'static>(val: T, chan: Sender<T>) { - chan.send(val).unwrap(); -} - -pub fn main() { - let (tx, rx) = channel(); - foo(31337, tx); - assert_eq!(rx.recv().unwrap(), 31337); -} diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities-xc.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities-xc.rs deleted file mode 100644 index 8416bb3a3..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities-xc.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-pass -// aux-build:trait_superkinds_in_metadata.rs - -// Tests "capabilities" granted by traits with super-builtin-kinds, -// even when using them cross-crate. - - -extern crate trait_superkinds_in_metadata; - -use std::sync::mpsc::{channel, Sender, Receiver}; -use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; - -#[derive(PartialEq, Debug)] -struct X<T>(T); - -impl <T: Sync> RequiresShare for X<T> { } -impl <T: Sync+Send> RequiresRequiresShareAndSend for X<T> { } - -fn foo<T: RequiresRequiresShareAndSend + 'static>(val: T, chan: Sender<T>) { - chan.send(val).unwrap(); -} - -pub fn main() { - let (tx, rx): (Sender<X<isize>>, Receiver<X<isize>>) = channel(); - foo(X(31337), tx); - assert_eq!(rx.recv().unwrap(), X(31337)); -} diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities.rs deleted file mode 100644 index e936f921a..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-capabilities.rs +++ /dev/null @@ -1,21 +0,0 @@ -// run-pass -// Tests "capabilities" granted by traits that inherit from super- -// builtin-kinds, e.g., if a trait requires Send to implement, then -// at usage site of that trait, we know we have the Send capability. - - -use std::sync::mpsc::{channel, Sender, Receiver}; - -trait Foo : Send { } - -impl <T: Send> Foo for T { } - -fn foo<T: Foo + 'static>(val: T, chan: Sender<T>) { - chan.send(val).unwrap(); -} - -pub fn main() { - let (tx, rx): (Sender<isize>, Receiver<isize>) = channel(); - foo(31337, tx); - assert_eq!(rx.recv().unwrap(), 31337); -} diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs deleted file mode 100644 index e716489c2..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Test for traits that inherit from multiple builtin kinds at once, -// testing that all such kinds must be present on implementing types. - -trait Foo : Send+Sync { } - -impl <T: Sync+'static> Foo for (T,) { } -//~^ ERROR `T` cannot be sent between threads safely [E0277] - -impl <T: Send> Foo for (T,T) { } -//~^ ERROR `T` cannot be shared between threads safely [E0277] - -impl <T: Send+Sync> Foo for (T,T,T) { } // (ok) - -fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr deleted file mode 100644 index 492316f00..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0277]: `T` cannot be sent between threads safely - --> $DIR/builtin-superkinds-double-superkind.rs:6:24 - | -LL | impl <T: Sync+'static> Foo for (T,) { } - | ^^^ `T` cannot be sent between threads safely - | - = note: required because it appears within the type `(T,)` -note: required by a bound in `Foo` - --> $DIR/builtin-superkinds-double-superkind.rs:4:13 - | -LL | trait Foo : Send+Sync { } - | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound - | -LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { } - | +++++++++++++++++++ - -error[E0277]: `T` cannot be shared between threads safely - --> $DIR/builtin-superkinds-double-superkind.rs:9:16 - | -LL | impl <T: Send> Foo for (T,T) { } - | ^^^ `T` cannot be shared between threads safely - | - = note: required because it appears within the type `(T, T)` -note: required by a bound in `Foo` - --> $DIR/builtin-superkinds-double-superkind.rs:4:18 - | -LL | trait Foo : Send+Sync { } - | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound - | -LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { } - | +++++++++++++++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs deleted file mode 100644 index b4555a180..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:trait_superkinds_in_metadata.rs - -// Test for traits inheriting from the builtin kinds cross-crate. -// Mostly tests correctness of metadata. - -extern crate trait_superkinds_in_metadata; -use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; - -struct X<T>(T); - -impl <T:Sync> RequiresShare for X<T> { } - -impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { } -//~^ ERROR `T` cannot be sent between threads safely [E0277] - -fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr deleted file mode 100644 index a46e4b233..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: `T` cannot be sent between threads safely - --> $DIR/builtin-superkinds-in-metadata.rs:13:23 - | -LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely - | -note: required because it appears within the type `X<T>` - --> $DIR/builtin-superkinds-in-metadata.rs:9:8 - | -LL | struct X<T>(T); - | ^ -note: required by a bound in `RequiresRequiresShareAndSend` - --> $DIR/auxiliary/trait_superkinds_in_metadata.rs:7:58 - | -LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } - | ^^^^ required by this bound in `RequiresRequiresShareAndSend` -help: consider further restricting this bound - | -LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { } - | +++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata2.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata2.rs deleted file mode 100644 index cdde48871..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass - -#![allow(unused_imports)] - -// aux-build:trait_superkinds_in_metadata.rs - -// Tests (correct) usage of trait super-builtin-kinds cross-crate. - -extern crate trait_superkinds_in_metadata; -use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; -use trait_superkinds_in_metadata::RequiresCopy; -use std::marker; - -#[derive(Copy, Clone)] -struct X<T>(#[allow(unused_tuple_struct_fields)] T); - -impl<T:Sync> RequiresShare for X<T> { } - -impl<T:Sync+Send> RequiresRequiresShareAndSend for X<T> { } - -impl<T:Copy> RequiresCopy for X<T> { } - -pub fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-phantom-typaram.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-phantom-typaram.rs deleted file mode 100644 index 9b80664b0..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-phantom-typaram.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// Tests that even when a type parameter doesn't implement a required -// super-builtin-kind of a trait, if the type parameter is never used, -// the type can implement the trait anyway. - -// pretty-expanded FIXME #23616 - -use std::marker; - -trait Foo : Send { } - -struct X<T> { marker: marker::PhantomData<T> } - -impl<T:Send> Foo for X<T> { } - -pub fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs deleted file mode 100644 index 6fba87b31..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Tests (negatively) the ability for the Self type in default methods -// to use capabilities granted by builtin kinds as supertraits. - -use std::sync::mpsc::{channel, Sender}; - -trait Foo : Sized+Sync+'static { - fn foo(self, mut chan: Sender<Self>) { } -} - -impl <T: Sync> Foo for T { } -//~^ ERROR the parameter type `T` may not live long enough - -fn main() { - let (tx, rx) = channel(); - 1193182.foo(tx); - assert_eq!(rx.recv(), 1193182); -} diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr deleted file mode 100644 index e2b177b95..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/builtin-superkinds-self-type.rs:10:16 - | -LL | impl <T: Sync> Foo for T { } - | ^^^ ...so that the type `T` will meet its required lifetime bounds... - | -note: ...that is required by this bound - --> $DIR/builtin-superkinds-self-type.rs:6:24 - | -LL | trait Foo : Sized+Sync+'static { - | ^^^^^^^ -help: consider adding an explicit lifetime bound... - | -LL | impl <T: Sync + 'static> Foo for T { } - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs deleted file mode 100644 index 1620f8d5c..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Basic test for traits inheriting from the builtin kinds, checking -// the type contents of the implementing type (that's not a typaram). - -trait Foo : Send { } - -impl Foo for std::rc::Rc<i8> { } -//~^ ERROR `Rc<i8>` cannot be sent between threads safely - -fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr deleted file mode 100644 index 9db9cbfdb..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: `Rc<i8>` cannot be sent between threads safely - --> $DIR/builtin-superkinds-simple.rs:6:6 - | -LL | impl Foo for std::rc::Rc<i8> { } - | ^^^ `Rc<i8>` cannot be sent between threads safely - | - = help: the trait `Send` is not implemented for `Rc<i8>` -note: required by a bound in `Foo` - --> $DIR/builtin-superkinds-simple.rs:4:13 - | -LL | trait Foo : Send { } - | ^^^^ required by this bound in `Foo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple2.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-simple2.rs deleted file mode 100644 index 8d2477157..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple2.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// Simple test case of implementing a trait with super-builtin-kinds. - -// pretty-expanded FIXME #23616 - -trait Foo : Send { } - -impl Foo for isize { } - -pub fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs deleted file mode 100644 index 74ae62711..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Basic test for traits inheriting from the builtin kinds. - -trait Foo : Send { } - -impl <T: Sync+'static> Foo for T { } -//~^ ERROR `T` cannot be sent between threads safely - -fn main() { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr deleted file mode 100644 index 3ec0b907d..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: `T` cannot be sent between threads safely - --> $DIR/builtin-superkinds-typaram-not-send.rs:5:24 - | -LL | impl <T: Sync+'static> Foo for T { } - | ^^^ `T` cannot be sent between threads safely - | -note: required by a bound in `Foo` - --> $DIR/builtin-superkinds-typaram-not-send.rs:3:13 - | -LL | trait Foo : Send { } - | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound - | -LL | impl <T: Sync+'static + std::marker::Send> Foo for T { } - | +++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram.rs deleted file mode 100644 index f999dfff7..000000000 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -// Tests correct implementation of traits with super-builtin-kinds -// using a bounded type parameter. - -// pretty-expanded FIXME #23616 - -trait Foo : Send { } - -impl <T: Send> Foo for T { } - -pub fn main() { } |