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/traits/alias | |
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/traits/alias')
44 files changed, 0 insertions, 2127 deletions
diff --git a/src/test/ui/traits/alias/ambiguous.rs b/src/test/ui/traits/alias/ambiguous.rs deleted file mode 100644 index 28409e0c6..000000000 --- a/src/test/ui/traits/alias/ambiguous.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(trait_alias)] - -mod inner { - pub trait A { fn foo(&self); } - pub trait B { fn foo(&self); } - - impl A for u8 { - fn foo(&self) {} - } - impl B for u8 { - fn foo(&self) {} - } - - pub trait C = A + B; -} - -use inner::C; - -fn main() { - let t = 1u8; - t.foo(); //~ ERROR E0034 - - inner::A::foo(&t); // ok -} diff --git a/src/test/ui/traits/alias/ambiguous.stderr b/src/test/ui/traits/alias/ambiguous.stderr deleted file mode 100644 index 0fe1a7967..000000000 --- a/src/test/ui/traits/alias/ambiguous.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0034]: multiple applicable items in scope - --> $DIR/ambiguous.rs:21:7 - | -LL | t.foo(); - | ^^^ multiple `foo` found - | -note: candidate #1 is defined in an impl of the trait `A` for the type `u8` - --> $DIR/ambiguous.rs:8:9 - | -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^ -note: candidate #2 is defined in an impl of the trait `B` for the type `u8` - --> $DIR/ambiguous.rs:11:9 - | -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 - | -LL | A::foo(&t); - | ~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 - | -LL | B::foo(&t); - | ~~~~~~~~~~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0034`. diff --git a/src/test/ui/traits/alias/auxiliary/greeter.rs b/src/test/ui/traits/alias/auxiliary/greeter.rs deleted file mode 100644 index 9e4122155..000000000 --- a/src/test/ui/traits/alias/auxiliary/greeter.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(trait_alias)] - -pub trait Hello { - fn hello(&self); -} - -pub struct Hi; - -impl Hello for Hi { - fn hello(&self) {} -} - -pub trait Greet = Hello; diff --git a/src/test/ui/traits/alias/auxiliary/send_sync.rs b/src/test/ui/traits/alias/auxiliary/send_sync.rs deleted file mode 100644 index 9e56b87e0..000000000 --- a/src/test/ui/traits/alias/auxiliary/send_sync.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(trait_alias)] - -pub trait SendSync = Send + Sync; diff --git a/src/test/ui/traits/alias/basic.rs b/src/test/ui/traits/alias/basic.rs deleted file mode 100644 index d8168f299..000000000 --- a/src/test/ui/traits/alias/basic.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass - -#![feature(trait_alias)] - -pub trait Foo {} -pub trait FooAlias = Foo; - -fn main() {} diff --git a/src/test/ui/traits/alias/bounds.rs b/src/test/ui/traits/alias/bounds.rs deleted file mode 100644 index b97eb38c5..000000000 --- a/src/test/ui/traits/alias/bounds.rs +++ /dev/null @@ -1,57 +0,0 @@ -// run-pass - -#![feature(trait_alias)] - -use std::marker::PhantomData; - -trait Empty {} -trait EmptyAlias = Empty; -trait CloneDefault = Clone + Default; -trait SendSyncAlias = Send + Sync; -trait WhereSendAlias = where Self: Send; -trait SendEqAlias<T> = Send where T: PartialEq<Self>; -trait I32Iterator = Iterator<Item = i32>; - -#[allow(dead_code)] -struct Foo<T: SendSyncAlias>(PhantomData<T>); -#[allow(dead_code)] -struct Bar<T>(PhantomData<T>) where T: SendSyncAlias; - -impl dyn EmptyAlias {} - -impl<T: SendSyncAlias> Empty for T {} - -fn a<T: CloneDefault>() -> (T, T) { - let one = T::default(); - let two = one.clone(); - (one, two) -} - -fn b(x: &impl SendEqAlias<i32>) -> bool { - 22_i32 == *x -} - -fn c<T: I32Iterator>(x: &mut T) -> Option<i32> { - x.next() -} - -fn d<T: SendSyncAlias>() { - is_send_and_sync::<T>(); -} - -fn is_send_and_sync<T: Send + Sync>() {} - -fn main() { - let both = a::<i32>(); - assert_eq!(both.0, 0); - assert_eq!(both.1, 0); - let both: (i32, i32) = a(); - assert_eq!(both.0, 0); - assert_eq!(both.1, 0); - - assert!(b(&22)); - - assert_eq!(c(&mut vec![22].into_iter()), Some(22)); - - d::<i32>(); -} diff --git a/src/test/ui/traits/alias/cross-crate.rs b/src/test/ui/traits/alias/cross-crate.rs deleted file mode 100644 index 8919c6434..000000000 --- a/src/test/ui/traits/alias/cross-crate.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:send_sync.rs - -#![feature(trait_alias)] - -extern crate send_sync; - -use std::rc::Rc; -use send_sync::SendSync; - -fn use_alias<T: SendSync>() {} - -fn main() { - use_alias::<u32>(); - use_alias::<Rc<u32>>(); - //~^ ERROR `Rc<u32>` cannot be sent between threads safely [E0277] - //~^^ ERROR `Rc<u32>` cannot be shared between threads safely [E0277] -} diff --git a/src/test/ui/traits/alias/cross-crate.stderr b/src/test/ui/traits/alias/cross-crate.stderr deleted file mode 100644 index ae9d7d0a9..000000000 --- a/src/test/ui/traits/alias/cross-crate.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0277]: `Rc<u32>` cannot be sent between threads safely - --> $DIR/cross-crate.rs:14:17 - | -LL | use_alias::<Rc<u32>>(); - | ^^^^^^^ `Rc<u32>` cannot be sent between threads safely - | - = help: the trait `Send` is not implemented for `Rc<u32>` - = note: required for `Rc<u32>` to implement `SendSync` -note: required by a bound in `use_alias` - --> $DIR/cross-crate.rs:10:17 - | -LL | fn use_alias<T: SendSync>() {} - | ^^^^^^^^ required by this bound in `use_alias` - -error[E0277]: `Rc<u32>` cannot be shared between threads safely - --> $DIR/cross-crate.rs:14:17 - | -LL | use_alias::<Rc<u32>>(); - | ^^^^^^^ `Rc<u32>` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `Rc<u32>` - = note: required for `Rc<u32>` to implement `SendSync` -note: required by a bound in `use_alias` - --> $DIR/cross-crate.rs:10:17 - | -LL | fn use_alias<T: SendSync>() {} - | ^^^^^^^^ required by this bound in `use_alias` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/alias/generic-default-in-dyn.rs b/src/test/ui/traits/alias/generic-default-in-dyn.rs deleted file mode 100644 index d44e1c2a9..000000000 --- a/src/test/ui/traits/alias/generic-default-in-dyn.rs +++ /dev/null @@ -1,10 +0,0 @@ -trait SendEqAlias<T> = PartialEq; -//~^ ERROR trait aliases are experimental - -struct Foo<T>(dyn SendEqAlias<T>); -//~^ ERROR the type parameter `Rhs` must be explicitly specified [E0393] - -struct Bar<T>(dyn SendEqAlias<T>, T); -//~^ ERROR the type parameter `Rhs` must be explicitly specified [E0393] - -fn main() {} diff --git a/src/test/ui/traits/alias/generic-default-in-dyn.stderr b/src/test/ui/traits/alias/generic-default-in-dyn.stderr deleted file mode 100644 index 76a068e86..000000000 --- a/src/test/ui/traits/alias/generic-default-in-dyn.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0658]: trait aliases are experimental - --> $DIR/generic-default-in-dyn.rs:1:1 - | -LL | trait SendEqAlias<T> = PartialEq; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information - = help: add `#![feature(trait_alias)]` to the crate attributes to enable - -error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/generic-default-in-dyn.rs:4:19 - | -LL | struct Foo<T>(dyn SendEqAlias<T>); - | ^^^^^^^^^^^^^^ missing reference to `Rhs` - | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait PartialEq<Rhs: ?Sized = Self> { - | --------------------------------------- type parameter `Rhs` must be specified for this - | - = note: because of the default `Self` reference, type parameters must be specified on object types - -error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/generic-default-in-dyn.rs:7:19 - | -LL | struct Bar<T>(dyn SendEqAlias<T>, T); - | ^^^^^^^^^^^^^^ missing reference to `Rhs` - | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait PartialEq<Rhs: ?Sized = Self> { - | --------------------------------------- type parameter `Rhs` must be specified for this - | - = note: because of the default `Self` reference, type parameters must be specified on object types - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0393, E0658. -For more information about an error, try `rustc --explain E0393`. diff --git a/src/test/ui/traits/alias/impl.rs b/src/test/ui/traits/alias/impl.rs deleted file mode 100644 index 6e35793a0..000000000 --- a/src/test/ui/traits/alias/impl.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(trait_alias)] - -trait DefaultAlias = Default; - -impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias - -fn main() {} diff --git a/src/test/ui/traits/alias/impl.stderr b/src/test/ui/traits/alias/impl.stderr deleted file mode 100644 index cedcd1021..000000000 --- a/src/test/ui/traits/alias/impl.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0404]: expected trait, found trait alias `DefaultAlias` - --> $DIR/impl.rs:5:6 - | -LL | impl DefaultAlias for () {} - | ^^^^^^^^^^^^ not a trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0404`. diff --git a/src/test/ui/traits/alias/import-cross-crate.rs b/src/test/ui/traits/alias/import-cross-crate.rs deleted file mode 100644 index 868585cd0..000000000 --- a/src/test/ui/traits/alias/import-cross-crate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -// aux-build:greeter.rs - -#![feature(trait_alias)] - -extern crate greeter; - -// Import only the alias, not the real trait. -use greeter::{Greet, Hi}; - -fn main() { - let hi = Hi; - hi.hello(); // From `Hello`, via `Greet` alias. -} diff --git a/src/test/ui/traits/alias/import.rs b/src/test/ui/traits/alias/import.rs deleted file mode 100644 index 802a8f156..000000000 --- a/src/test/ui/traits/alias/import.rs +++ /dev/null @@ -1,40 +0,0 @@ -// run-pass - -#![feature(trait_alias)] - -mod inner { - pub trait Foo { - fn foo(&self); - } - - pub struct Qux; - - impl Foo for Qux { - fn foo(&self) {} - } - - pub trait Bar = Foo; -} - -mod two { - pub trait A { - fn foo(); - } - - impl A for u8 { - fn foo() {} - } -} - -// Import only the alias, not the `Foo` trait. -use inner::{Bar, Qux}; - -// Declaring an alias also brings in aliased methods. -trait Two = two::A; - -fn main() { - let q = Qux; - q.foo(); // From Bar. - - u8::foo(); // From A. -} diff --git a/src/test/ui/traits/alias/issue-60021-assoc-method-resolve.rs b/src/test/ui/traits/alias/issue-60021-assoc-method-resolve.rs deleted file mode 100644 index 5e27ed3c6..000000000 --- a/src/test/ui/traits/alias/issue-60021-assoc-method-resolve.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass - -#![feature(trait_alias)] - -trait SomeTrait { - fn map(&self) {} -} - -impl<T> SomeTrait for Option<T> {} - -trait SomeAlias = SomeTrait; - -fn main() { - let x = Some(123); - // This should resolve to the trait impl for Option - Option::map(x, |z| z); - // This should resolve to the trait impl for SomeTrait - SomeTrait::map(&x); -} diff --git a/src/test/ui/traits/alias/issue-72415-assoc-const-resolve.rs b/src/test/ui/traits/alias/issue-72415-assoc-const-resolve.rs deleted file mode 100644 index e49125d10..000000000 --- a/src/test/ui/traits/alias/issue-72415-assoc-const-resolve.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass - -#![feature(trait_alias)] - -trait Bounded { const MAX: Self; } - -impl Bounded for u32 { - // This should correctly resolve to the associated const in the inherent impl of u32. - const MAX: Self = u32::MAX; -} - -trait Num = Bounded + Copy; - -fn main() {} diff --git a/src/test/ui/traits/alias/issue-75983.rs b/src/test/ui/traits/alias/issue-75983.rs deleted file mode 100644 index f9a7f36de..000000000 --- a/src/test/ui/traits/alias/issue-75983.rs +++ /dev/null @@ -1,17 +0,0 @@ -// check-pass - -#![feature(trait_alias)] - -struct Bar; -trait Foo {} -impl Foo for Bar {} - -trait Baz = Foo where Bar: Foo; - -fn new() -> impl Baz { - Bar -} - -fn main() { - let _ = new(); -} diff --git a/src/test/ui/traits/alias/issue-83613.rs b/src/test/ui/traits/alias/issue-83613.rs deleted file mode 100644 index 2462e703a..000000000 --- a/src/test/ui/traits/alias/issue-83613.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(type_alias_impl_trait)] -trait OpaqueTrait {} -impl<T> OpaqueTrait for T {} -type OpaqueType = impl OpaqueTrait; -fn mk_opaque() -> OpaqueType { - || 0 -} -trait AnotherTrait {} -impl<T: Send> AnotherTrait for T {} -impl AnotherTrait for OpaqueType {} -//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `OpaqueType` -fn main() {} diff --git a/src/test/ui/traits/alias/issue-83613.stderr b/src/test/ui/traits/alias/issue-83613.stderr deleted file mode 100644 index a78294da6..000000000 --- a/src/test/ui/traits/alias/issue-83613.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType` - --> $DIR/issue-83613.rs:10:1 - | -LL | impl<T: Send> AnotherTrait for T {} - | -------------------------------- first implementation here -LL | impl AnotherTrait for OpaqueType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/traits/alias/maybe-bound.rs b/src/test/ui/traits/alias/maybe-bound.rs deleted file mode 100644 index 284baa481..000000000 --- a/src/test/ui/traits/alias/maybe-bound.rs +++ /dev/null @@ -1,29 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) - -// Test that `dyn ... + ?Sized + ...` resulting from the expansion of trait aliases is okay. - -#![feature(trait_alias)] - -trait Foo {} - -trait S = ?Sized; - -// Nest a couple of levels deep: -trait _0 = S; -trait _1 = _0; - -// Straight list expansion: -type _T0 = dyn _1 + Foo; - -// In second position: -type _T1 = dyn Foo + _1; - -// ... and with an auto trait: -type _T2 = dyn Foo + Send + _1; - -// Twice: -trait _2 = _1 + _1; - -type _T3 = dyn _2 + Foo; - -fn main() {} diff --git a/src/test/ui/traits/alias/no-duplicates.rs b/src/test/ui/traits/alias/no-duplicates.rs deleted file mode 100644 index 88feb8917..000000000 --- a/src/test/ui/traits/alias/no-duplicates.rs +++ /dev/null @@ -1,126 +0,0 @@ -// The purpose of this test is to demonstrate that duplicating object safe traits -// that are not auto traits is rejected with trait aliases even though one could -// reasonably accept this. - -#![feature(trait_alias)] - -use std::marker::Unpin; - -// Some arbitrary object-safe trait: -trait Obj {} - -// Nest a few levels deep: -trait _0 = Obj; -trait _1 = _0; - -type _T00 = dyn _0 + _0; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T01 = dyn _1 + _0; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T02 = dyn _1 + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T03 = dyn Obj + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T04 = dyn _1 + Obj; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Nest some more and in weird ways: - -trait _2 = _0 + _1; -trait _3 = Obj; -trait _4 = _3; - -type _T10 = dyn _2 + _3; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T11 = dyn _3 + _2; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T12 = dyn Obj + _2; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T13 = dyn _2 + Obj; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T14 = dyn _1 + _3; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T15 = dyn _3 + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T16 = dyn _1 + _4; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T17 = dyn _4 + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Include auto traits: - -trait _5 = Obj + Send; - -type _T20 = dyn _5 + _5; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T21 = dyn Obj + _5; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T22 = dyn _5 + Obj; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T23 = dyn _5 + Send + Sync + Obj; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Also nest: - -trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send - -type _T30 = dyn _6; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T31 = dyn _6 + Send; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T32 = dyn Send + _6; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Nest some more: - -trait _7 = _5 + Sync; -trait _8 = Unpin + _7; - -type _T40 = dyn _8 + Obj; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T41 = dyn Obj + _8; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T42 = dyn _8 + _4; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T43 = dyn _4 + _8; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T44 = dyn _4 + Send + Sync + _8; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Take higher ranked types into account. - -// Note that `'a` and `'b` are intentionally different to make sure we consider -// them semantically the same. -trait ObjL<'l> {} -trait _9 = for<'a> ObjL<'a>; -trait _10 = for<'b> ObjL<'b>; -type _T50 = dyn _9 + _10; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -trait ObjT<T> {} -trait _11 = ObjT<for<'a> fn(&'a u8)>; -trait _12 = ObjT<for<'b> fn(&'b u8)>; -type _T60 = dyn _11 + _12; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -fn main() {} diff --git a/src/test/ui/traits/alias/no-duplicates.stderr b/src/test/ui/traits/alias/no-duplicates.stderr deleted file mode 100644 index bf244b97e..000000000 --- a/src/test/ui/traits/alias/no-duplicates.stderr +++ /dev/null @@ -1,527 +0,0 @@ -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:16:22 - | -LL | trait _0 = Obj; - | --- - | | - | additional non-auto trait - | first non-auto trait -... -LL | type _T00 = dyn _0 + _0; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:19:22 - | -LL | trait _0 = Obj; - | --- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | type _T01 = dyn _1 + _0; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:22:22 - | -LL | trait _0 = Obj; - | --- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _1 = _0; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -... -LL | type _T02 = dyn _1 + _1; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:25:23 - | -LL | trait _0 = Obj; - | --- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | type _T03 = dyn Obj + _1; - | --- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:28:22 - | -LL | trait _0 = Obj; - | --- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | type _T04 = dyn _1 + Obj; - | -- ^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:37:17 - | -LL | trait _0 = Obj; - | --- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _2 = _0 + _1; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T10 = dyn _2 + _3; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:40:22 - | -LL | trait _0 = Obj; - | --- additional non-auto trait -... -LL | trait _2 = _0 + _1; - | -- referenced here (additional use) -LL | trait _3 = Obj; - | --- first non-auto trait -... -LL | type _T11 = dyn _3 + _2; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:43:23 - | -LL | trait _0 = Obj; - | --- additional non-auto trait -... -LL | trait _2 = _0 + _1; - | -- referenced here (additional use) -... -LL | type _T12 = dyn Obj + _2; - | --- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:46:17 - | -LL | trait _0 = Obj; - | --- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _2 = _0 + _1; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T13 = dyn _2 + Obj; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:49:22 - | -LL | trait _0 = Obj; - | --- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _3 = Obj; - | --- additional non-auto trait -... -LL | type _T14 = dyn _1 + _3; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:52:22 - | -LL | trait _0 = Obj; - | --- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _3 = Obj; - | --- first non-auto trait -... -LL | type _T15 = dyn _3 + _1; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:55:22 - | -LL | trait _0 = Obj; - | --- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _3 = Obj; - | --- additional non-auto trait -LL | trait _4 = _3; - | -- referenced here (additional use) -... -LL | type _T16 = dyn _1 + _4; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:58:22 - | -LL | trait _0 = Obj; - | --- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _3 = Obj; - | --- first non-auto trait -LL | trait _4 = _3; - | -- referenced here (first use) -... -LL | type _T17 = dyn _4 + _1; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:65:22 - | -LL | trait _5 = Obj + Send; - | --- - | | - | additional non-auto trait - | first non-auto trait -LL | -LL | type _T20 = dyn _5 + _5; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:68:23 - | -LL | trait _5 = Obj + Send; - | --- additional non-auto trait -... -LL | type _T21 = dyn Obj + _5; - | --- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:71:22 - | -LL | trait _5 = Obj + Send; - | --- first non-auto trait -... -LL | type _T22 = dyn _5 + Obj; - | -- ^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:74:36 - | -LL | trait _5 = Obj + Send; - | --- first non-auto trait -... -LL | type _T23 = dyn _5 + Send + Sync + Obj; - | -- ^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:81:17 - | -LL | trait _5 = Obj + Send; - | --- - | | - | additional non-auto trait - | first non-auto trait -... -LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send - | -- -- referenced here (additional use) - | | - | referenced here (first use) -LL | -LL | type _T30 = dyn _6; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:84:17 - | -LL | trait _5 = Obj + Send; - | --- - | | - | additional non-auto trait - | first non-auto trait -... -LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T31 = dyn _6 + Send; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:87:24 - | -LL | trait _5 = Obj + Send; - | --- - | | - | additional non-auto trait - | first non-auto trait -... -LL | trait _6 = _5 + _5; // ==> Obj + Send + Obj + Send - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T32 = dyn Send + _6; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:95:22 - | -LL | trait _5 = Obj + Send; - | --- first non-auto trait -... -LL | trait _7 = _5 + Sync; - | -- referenced here (first use) -LL | trait _8 = Unpin + _7; - | -- referenced here (first use) -LL | -LL | type _T40 = dyn _8 + Obj; - | -- ^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:98:23 - | -LL | trait _5 = Obj + Send; - | --- additional non-auto trait -... -LL | trait _7 = _5 + Sync; - | -- referenced here (additional use) -LL | trait _8 = Unpin + _7; - | -- referenced here (additional use) -... -LL | type _T41 = dyn Obj + _8; - | --- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:101:22 - | -LL | trait _3 = Obj; - | --- additional non-auto trait -LL | trait _4 = _3; - | -- referenced here (additional use) -... -LL | trait _5 = Obj + Send; - | --- first non-auto trait -... -LL | trait _7 = _5 + Sync; - | -- referenced here (first use) -LL | trait _8 = Unpin + _7; - | -- referenced here (first use) -... -LL | type _T42 = dyn _8 + _4; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:104:22 - | -LL | trait _3 = Obj; - | --- first non-auto trait -LL | trait _4 = _3; - | -- referenced here (first use) -... -LL | trait _5 = Obj + Send; - | --- additional non-auto trait -... -LL | trait _7 = _5 + Sync; - | -- referenced here (additional use) -LL | trait _8 = Unpin + _7; - | -- referenced here (additional use) -... -LL | type _T43 = dyn _4 + _8; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:107:36 - | -LL | trait _3 = Obj; - | --- first non-auto trait -LL | trait _4 = _3; - | -- referenced here (first use) -... -LL | trait _5 = Obj + Send; - | --- additional non-auto trait -... -LL | trait _7 = _5 + Sync; - | -- referenced here (additional use) -LL | trait _8 = Unpin + _7; - | -- referenced here (additional use) -... -LL | type _T44 = dyn _4 + Send + Sync + _8; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:117:22 - | -LL | trait _9 = for<'a> ObjL<'a>; - | ---------------- first non-auto trait -LL | trait _10 = for<'b> ObjL<'b>; - | ---------------- additional non-auto trait -LL | type _T50 = dyn _9 + _10; - | -- ^^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: for<'a> ObjL<'a> + for<'b> ObjL<'b> {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-duplicates.rs:123:23 - | -LL | trait _11 = ObjT<for<'a> fn(&'a u8)>; - | ------------------------ first non-auto trait -LL | trait _12 = ObjT<for<'b> fn(&'b u8)>; - | ------------------------ additional non-auto trait -LL | type _T60 = dyn _11 + _12; - | --- ^^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)> {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error: aborting due to 27 previous errors - -For more information about this error, try `rustc --explain E0225`. diff --git a/src/test/ui/traits/alias/no-extra-traits.rs b/src/test/ui/traits/alias/no-extra-traits.rs deleted file mode 100644 index 4dad8c0f8..000000000 --- a/src/test/ui/traits/alias/no-extra-traits.rs +++ /dev/null @@ -1,121 +0,0 @@ -// The purpose of this test is to demonstrate that trait alias expansion -// preserves the rule that `dyn Trait` may only reference one non-auto trait. - -#![feature(trait_alias)] - -use std::marker::Unpin; - -// Some arbitrary object-safe traits: -trait ObjA {} -trait ObjB {} - -// Nest a few levels deep: -trait _0 = ObjA; -trait _1 = _0; - -type _T00 = dyn _0 + ObjB; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T01 = dyn ObjB + _0; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T02 = dyn ObjB + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T03 = dyn _1 + ObjB; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Nest some more and in weird ways: - -trait _2 = ObjB; -trait _3 = _2; -trait _4 = _3; - -type _T10 = dyn _2 + _3; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T11 = dyn _3 + _2; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T12 = dyn _2 + _4; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T13 = dyn _4 + _2; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Include auto traits: - -trait _5 = Sync + ObjB + Send; - -type _T20 = dyn _5 + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T21 = dyn _1 + _5; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T22 = dyn _5 + ObjA; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T23 = dyn ObjA + _5; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T24 = dyn Send + _5 + _1 + Sync; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T25 = dyn _1 + Sync + _5 + Send; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T26 = dyn Sync + Send + _5 + ObjA; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T27 = dyn Send + Sync + ObjA + _5; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Also nest: - -trait _6 = _1 + _5; -trait _7 = _6; -trait _8 = _7; - -type _T30 = dyn _6; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T31 = dyn _6 + Send; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T32 = dyn Send + _6; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T33 = dyn _8; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T34 = dyn _8 + Send; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T35 = dyn Send + _8; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -// Nest some more: - -trait _9 = _5 + Sync; -trait _10 = Unpin + _9; - -type _T40 = dyn _10 + ObjA; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T41 = dyn ObjA + _10; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T42 = dyn _10 + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T43 = dyn Send + _10 + Sync + ObjA; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T44 = dyn ObjA + _10 + Send + Sync; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -type _T45 = dyn Sync + Send + _10 + _1; -//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - -fn main() {} diff --git a/src/test/ui/traits/alias/no-extra-traits.stderr b/src/test/ui/traits/alias/no-extra-traits.stderr deleted file mode 100644 index 4b1ddf684..000000000 --- a/src/test/ui/traits/alias/no-extra-traits.stderr +++ /dev/null @@ -1,579 +0,0 @@ -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:16:22 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -... -LL | type _T00 = dyn _0 + ObjB; - | -- ^^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:19:24 - | -LL | trait _0 = ObjA; - | ---- additional non-auto trait -... -LL | type _T01 = dyn ObjB + _0; - | ---- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:22:24 - | -LL | trait _0 = ObjA; - | ---- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | type _T02 = dyn ObjB + _1; - | ---- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:25:22 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | type _T03 = dyn _1 + ObjB; - | -- ^^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:34:22 - | -LL | trait _2 = ObjB; - | ---- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _3 = _2; - | -- referenced here (additional use) -... -LL | type _T10 = dyn _2 + _3; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:37:22 - | -LL | trait _2 = ObjB; - | ---- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _3 = _2; - | -- referenced here (first use) -... -LL | type _T11 = dyn _3 + _2; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:40:22 - | -LL | trait _2 = ObjB; - | ---- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _3 = _2; - | -- referenced here (additional use) -LL | trait _4 = _3; - | -- referenced here (additional use) -... -LL | type _T12 = dyn _2 + _4; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:43:22 - | -LL | trait _2 = ObjB; - | ---- - | | - | additional non-auto trait - | first non-auto trait -LL | trait _3 = _2; - | -- referenced here (first use) -LL | trait _4 = _3; - | -- referenced here (first use) -... -LL | type _T13 = dyn _4 + _2; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:50:22 - | -LL | trait _0 = ObjA; - | ---- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -LL | -LL | type _T20 = dyn _5 + _1; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:53:22 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | type _T21 = dyn _1 + _5; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:56:22 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | type _T22 = dyn _5 + ObjA; - | -- ^^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:59:24 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | type _T23 = dyn ObjA + _5; - | ---- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:62:29 - | -LL | trait _0 = ObjA; - | ---- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | type _T24 = dyn Send + _5 + _1 + Sync; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:65:29 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | type _T25 = dyn _1 + Sync + _5 + Send; - | -- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:68:36 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | type _T26 = dyn Sync + Send + _5 + ObjA; - | -- ^^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:71:38 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | type _T27 = dyn Send + Sync + ObjA + _5; - | ---- ^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:80:17 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _6 = _1 + _5; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T30 = dyn _6; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:83:17 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _6 = _1 + _5; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T31 = dyn _6 + Send; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:86:24 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _6 = _1 + _5; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -... -LL | type _T32 = dyn Send + _6; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:89:17 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _6 = _1 + _5; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -LL | trait _7 = _6; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -LL | trait _8 = _7; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -... -LL | type _T33 = dyn _8; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:92:17 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _6 = _1 + _5; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -LL | trait _7 = _6; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -LL | trait _8 = _7; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -... -LL | type _T34 = dyn _8 + Send; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:95:24 - | -LL | trait _0 = ObjA; - | ---- first non-auto trait -LL | trait _1 = _0; - | -- referenced here (first use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _6 = _1 + _5; - | -- -- referenced here (additional use) - | | - | referenced here (first use) -LL | trait _7 = _6; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -LL | trait _8 = _7; - | -- - | | - | referenced here (additional use) - | referenced here (first use) -... -LL | type _T35 = dyn Send + _8; - | ^^ - | | - | trait alias used in trait object type (additional use) - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:103:23 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | trait _9 = _5 + Sync; - | -- referenced here (first use) -LL | trait _10 = Unpin + _9; - | -- referenced here (first use) -LL | -LL | type _T40 = dyn _10 + ObjA; - | --- ^^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:106:24 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _9 = _5 + Sync; - | -- referenced here (additional use) -LL | trait _10 = Unpin + _9; - | -- referenced here (additional use) -... -LL | type _T41 = dyn ObjA + _10; - | ---- ^^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:109:23 - | -LL | trait _0 = ObjA; - | ---- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | trait _9 = _5 + Sync; - | -- referenced here (first use) -LL | trait _10 = Unpin + _9; - | -- referenced here (first use) -... -LL | type _T42 = dyn _10 + _1; - | --- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:112:37 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | trait _9 = _5 + Sync; - | -- referenced here (first use) -LL | trait _10 = Unpin + _9; - | -- referenced here (first use) -... -LL | type _T43 = dyn Send + _10 + Sync + ObjA; - | --- ^^^^ additional non-auto trait - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:115:24 - | -LL | trait _5 = Sync + ObjB + Send; - | ---- additional non-auto trait -... -LL | trait _9 = _5 + Sync; - | -- referenced here (additional use) -LL | trait _10 = Unpin + _9; - | -- referenced here (additional use) -... -LL | type _T44 = dyn ObjA + _10 + Send + Sync; - | ---- ^^^ trait alias used in trait object type (additional use) - | | - | first non-auto trait - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/no-extra-traits.rs:118:37 - | -LL | trait _0 = ObjA; - | ---- additional non-auto trait -LL | trait _1 = _0; - | -- referenced here (additional use) -... -LL | trait _5 = Sync + ObjB + Send; - | ---- first non-auto trait -... -LL | trait _9 = _5 + Sync; - | -- referenced here (first use) -LL | trait _10 = Unpin + _9; - | -- referenced here (first use) -... -LL | type _T45 = dyn Sync + Send + _10 + _1; - | --- ^^ trait alias used in trait object type (additional use) - | | - | trait alias used in trait object type (first use) - | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}` - = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> - -error: aborting due to 28 previous errors - -For more information about this error, try `rustc --explain E0225`. diff --git a/src/test/ui/traits/alias/object-fail.rs b/src/test/ui/traits/alias/object-fail.rs deleted file mode 100644 index 5c753ff20..000000000 --- a/src/test/ui/traits/alias/object-fail.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(trait_alias)] - -trait EqAlias = Eq; -trait IteratorAlias = Iterator; - -fn main() { - let _: &dyn EqAlias = &123; - //~^ ERROR the trait `Eq` cannot be made into an object [E0038] - let _: &dyn IteratorAlias = &vec![123].into_iter(); - //~^ ERROR must be specified -} diff --git a/src/test/ui/traits/alias/object-fail.stderr b/src/test/ui/traits/alias/object-fail.stderr deleted file mode 100644 index 325bc6d28..000000000 --- a/src/test/ui/traits/alias/object-fail.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0038]: the trait `Eq` cannot be made into an object - --> $DIR/object-fail.rs:7:13 - | -LL | let _: &dyn EqAlias = &123; - | ^^^^^^^^^^^ `Eq` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> - --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait Eq: PartialEq<Self> { - | ^^^^^^^^^^^^^^^ the trait cannot be made into an object because it uses `Self` as a type parameter - -error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified - --> $DIR/object-fail.rs:9:17 - | -LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); - | ^^^^^^^^^^^^^ help: specify the associated type: `IteratorAlias<Item = Type>` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0038, E0191. -For more information about an error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/alias/object-wf.rs b/src/test/ui/traits/alias/object-wf.rs deleted file mode 100644 index 1440f02df..000000000 --- a/src/test/ui/traits/alias/object-wf.rs +++ /dev/null @@ -1,85 +0,0 @@ -// check-pass - -// This test checks that trait objects involving trait aliases are well-formed. - -#![feature(trait_alias)] - -trait Obj {} - -trait _0 = Send + Sync; - -// Just auto traits: - -trait _1 = _0 + Send + Sync; - -use std::marker::Unpin; - -fn _f0() { - let _: Box<dyn _0>; - let _: Box<dyn _1>; - let _: Box<dyn Unpin + _1 + Send + Sync>; -} - -// Include object safe traits: - -fn _f1() { - let _: Box<dyn Obj + _0>; - let _: Box<dyn Obj + _1>; - let _: Box<dyn Obj + _1 + _0>; -} - -// And when the object safe trait is in a trait alias: - -trait _2 = Obj; - -fn _f2() { - let _: Box<dyn _2 + _0>; - let _: Box<dyn _2 + _1>; - let _: Box<dyn _2 + _1 + _0>; -} - -// And it should also work when that trait is has auto traits to the right of it. - -trait _3 = Obj + Unpin; - -fn _f3() { - let _: Box<dyn _3 + _0>; - let _: Box<dyn _3 + _1>; - let _: Box<dyn _3 + _1 + _0>; -} - -// Nest the trait deeply: - -trait _4 = _3; -trait _5 = _4 + Sync + _0 + Send; -trait _6 = _5 + Send + _1 + Sync; - -fn _f4() { - let _: Box<dyn _6 + _0>; - let _: Box<dyn _6 + _1>; - let _: Box<dyn _6 + _1 + _0>; -} - -// Just nest the trait alone: - -trait _7 = _2; -trait _8 = _7; -trait _9 = _8; - -fn _f5() { - let _: Box<dyn _9>; -} - -// First bound is auto trait: - -trait _10 = Send + Obj; -trait _11 = Obj + Send; -trait _12 = Sync + _11; -trait _13 = Send + _12; - -fn f6() { - let _: Box<dyn _10>; - let _: Box<dyn _13>; -} - -fn main() {} diff --git a/src/test/ui/traits/alias/object.rs b/src/test/ui/traits/alias/object.rs deleted file mode 100644 index 12177cd82..000000000 --- a/src/test/ui/traits/alias/object.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass - -#![feature(trait_alias)] - -trait Foo = PartialEq<i32> + Send; -trait Bar = Foo + Sync; - -trait I32Iterator = Iterator<Item = i32>; - -pub fn main() { - let a: &dyn Bar = &123; - assert!(*a == 123); - let b = Box::new(456) as Box<dyn Foo>; - assert!(*b == 456); - - let c: &mut dyn I32Iterator = &mut vec![123].into_iter(); - assert_eq!(c.next(), Some(123)); -} diff --git a/src/test/ui/traits/alias/only-maybe-bound.rs b/src/test/ui/traits/alias/only-maybe-bound.rs deleted file mode 100644 index e4abf314e..000000000 --- a/src/test/ui/traits/alias/only-maybe-bound.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Test that `dyn ?Sized` (i.e., a trait object with only a maybe buond) is not allowed, when just -// `?Sized` results from trait alias expansion. - -#![feature(trait_alias)] - -trait S = ?Sized; - -// Nest a couple of levels deep: -trait _0 = S; -trait _1 = _0; - -// Straight list expansion: -type _T0 = dyn _1; -//~^ ERROR at least one trait is required for an object type [E0224] - -// Twice: -trait _2 = _1 + _1; - -type _T1 = dyn _2; -//~^ ERROR at least one trait is required for an object type [E0224] - -fn main() {} diff --git a/src/test/ui/traits/alias/only-maybe-bound.stderr b/src/test/ui/traits/alias/only-maybe-bound.stderr deleted file mode 100644 index 175ec8120..000000000 --- a/src/test/ui/traits/alias/only-maybe-bound.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0224]: at least one trait is required for an object type - --> $DIR/only-maybe-bound.rs:13:12 - | -LL | trait _1 = _0; - | -------- this alias does not contain a trait -... -LL | type _T0 = dyn _1; - | ^^^^^^ - -error[E0224]: at least one trait is required for an object type - --> $DIR/only-maybe-bound.rs:19:12 - | -LL | trait _2 = _1 + _1; - | -------- this alias does not contain a trait -LL | -LL | type _T1 = dyn _2; - | ^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0224`. diff --git a/src/test/ui/traits/alias/self-in-const-generics.rs b/src/test/ui/traits/alias/self-in-const-generics.rs deleted file mode 100644 index b0de8ccd6..000000000 --- a/src/test/ui/traits/alias/self-in-const-generics.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] -#![feature(trait_alias)] - -trait Bar<const N: usize> {} - -trait BB = Bar<{ 2 + 1 }>; - -fn foo(x: &dyn BB) {} -//~^ ERROR the trait alias `BB` cannot be made into an object [E0038] - -fn main() {} diff --git a/src/test/ui/traits/alias/self-in-const-generics.stderr b/src/test/ui/traits/alias/self-in-const-generics.stderr deleted file mode 100644 index 61cc217cf..000000000 --- a/src/test/ui/traits/alias/self-in-const-generics.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0038]: the trait alias `BB` cannot be made into an object - --> $DIR/self-in-const-generics.rs:9:16 - | -LL | fn foo(x: &dyn BB) {} - | ^^ - | - = note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/alias/self-in-generics.rs b/src/test/ui/traits/alias/self-in-generics.rs deleted file mode 100644 index 0bb6335f9..000000000 --- a/src/test/ui/traits/alias/self-in-generics.rs +++ /dev/null @@ -1,15 +0,0 @@ -// astconv uses `FreshTy(0)` as a dummy `Self` type when instanciating trait objects. -// This `FreshTy(0)` can leak into substs, causing ICEs in several places. -// Using `save-analysis` triggers type-checking `f` that would be normally skipped -// as `type_of` emitted an error. -// -// compile-flags: -Zsave-analysis - -#![feature(trait_alias)] - -pub trait SelfInput = Fn(&mut Self); - -pub fn f(_f: &dyn SelfInput) {} -//~^ ERROR the trait alias `SelfInput` cannot be made into an object [E0038] - -fn main() {} diff --git a/src/test/ui/traits/alias/self-in-generics.stderr b/src/test/ui/traits/alias/self-in-generics.stderr deleted file mode 100644 index 110d60e6e..000000000 --- a/src/test/ui/traits/alias/self-in-generics.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0038]: the trait alias `SelfInput` cannot be made into an object - --> $DIR/self-in-generics.rs:12:19 - | -LL | pub fn f(_f: &dyn SelfInput) {} - | ^^^^^^^^^ - | - = note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/alias/style_lint.rs b/src/test/ui/traits/alias/style_lint.rs deleted file mode 100644 index 33be20054..000000000 --- a/src/test/ui/traits/alias/style_lint.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass - -#![feature(trait_alias)] - -trait Foo = std::fmt::Display + std::fmt::Debug; -trait bar = std::fmt::Display + std::fmt::Debug; //~WARN trait alias `bar` should have an upper camel case name - -fn main() {} diff --git a/src/test/ui/traits/alias/style_lint.stderr b/src/test/ui/traits/alias/style_lint.stderr deleted file mode 100644 index 91e2ea90e..000000000 --- a/src/test/ui/traits/alias/style_lint.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: trait alias `bar` should have an upper camel case name - --> $DIR/style_lint.rs:6:7 - | -LL | trait bar = std::fmt::Display + std::fmt::Debug; - | ^^^ help: convert the identifier to upper camel case: `Bar` - | - = note: `#[warn(non_camel_case_types)]` on by default - -warning: 1 warning emitted - diff --git a/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.fixed b/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.fixed deleted file mode 100644 index 8a94abaeb..000000000 --- a/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.fixed +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test of #43913. - -// run-rustfix - -#![feature(trait_alias)] -#![allow(bare_trait_objects, dead_code)] - -trait Strings = Iterator<Item=String>; - -struct Struct<S: Strings>(S); -//~^ ERROR: expected trait, found type alias `Strings` - -fn main() {} diff --git a/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.rs b/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.rs deleted file mode 100644 index 40c678c28..000000000 --- a/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test of #43913. - -// run-rustfix - -#![feature(trait_alias)] -#![allow(bare_trait_objects, dead_code)] - -type Strings = Iterator<Item=String>; - -struct Struct<S: Strings>(S); -//~^ ERROR: expected trait, found type alias `Strings` - -fn main() {} diff --git a/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr b/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr deleted file mode 100644 index 6e03eeada..000000000 --- a/src/test/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0404]: expected trait, found type alias `Strings` - --> $DIR/suggest-trait-alias-instead-of-type.rs:10:18 - | -LL | struct Struct<S: Strings>(S); - | ^^^^^^^ type aliases cannot be used as traits - | -help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias - | -LL | trait Strings = Iterator<Item=String>; - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0404`. diff --git a/src/test/ui/traits/alias/syntax-fail.rs b/src/test/ui/traits/alias/syntax-fail.rs deleted file mode 100644 index 039bbce8c..000000000 --- a/src/test/ui/traits/alias/syntax-fail.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![feature(trait_alias)] - -trait Foo {} -auto trait A = Foo; //~ ERROR trait aliases cannot be `auto` -unsafe trait B = Foo; //~ ERROR trait aliases cannot be `unsafe` - -trait C: Ord = Eq; //~ ERROR bounds are not allowed on trait aliases -trait D: = Eq; //~ ERROR bounds are not allowed on trait aliases - -fn main() {} diff --git a/src/test/ui/traits/alias/syntax-fail.stderr b/src/test/ui/traits/alias/syntax-fail.stderr deleted file mode 100644 index 748b92056..000000000 --- a/src/test/ui/traits/alias/syntax-fail.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: trait aliases cannot be `auto` - --> $DIR/syntax-fail.rs:4:1 - | -LL | auto trait A = Foo; - | ^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto` - -error: trait aliases cannot be `unsafe` - --> $DIR/syntax-fail.rs:5:1 - | -LL | unsafe trait B = Foo; - | ^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` - -error: bounds are not allowed on trait aliases - --> $DIR/syntax-fail.rs:7:8 - | -LL | trait C: Ord = Eq; - | ^^^^^ - -error: bounds are not allowed on trait aliases - --> $DIR/syntax-fail.rs:8:8 - | -LL | trait D: = Eq; - | ^ - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/traits/alias/syntax.rs b/src/test/ui/traits/alias/syntax.rs deleted file mode 100644 index 17557a51a..000000000 --- a/src/test/ui/traits/alias/syntax.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass - -#![feature(trait_alias)] - -trait SimpleAlias = Default; -trait GenericAlias<T> = Iterator<Item = T>; -trait Partial<T> = IntoIterator<Item = T>; -trait SpecificAlias = GenericAlias<i32>; -trait PartialEqRef<'a, T: 'a> = PartialEq<&'a T>; -trait StaticAlias = 'static; - -trait Things<T> {} -trait Romeo {} -#[allow(dead_code)] -struct The<T>(T); -#[allow(dead_code)] -struct Fore<T>(T); -impl<T, U> Things<T> for The<U> {} -impl<T> Romeo for Fore<T> {} - -trait WithWhere<Art, Thou> = Romeo + Romeo where Fore<(Art, Thou)>: Romeo; -trait BareWhere<Wild, Are> = where The<Wild>: Things<Are>; - -fn main() {} diff --git a/src/test/ui/traits/alias/wf.rs b/src/test/ui/traits/alias/wf.rs deleted file mode 100644 index d10e2abb0..000000000 --- a/src/test/ui/traits/alias/wf.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(trait_alias)] - -trait Foo {} -trait A<T: Foo> {} -trait B<T> = A<T>; //~ ERROR `T: Foo` is not satisfied - -fn main() {} diff --git a/src/test/ui/traits/alias/wf.stderr b/src/test/ui/traits/alias/wf.stderr deleted file mode 100644 index 7172008d3..000000000 --- a/src/test/ui/traits/alias/wf.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/wf.rs:5:14 - | -LL | trait B<T> = A<T>; - | ^^^^ the trait `Foo` is not implemented for `T` - | -note: required by a bound in `A` - --> $DIR/wf.rs:4:12 - | -LL | trait A<T: Foo> {} - | ^^^ required by this bound in `A` -help: consider restricting type parameter `T` - | -LL | trait B<T: Foo> = A<T>; - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. |