summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/wf-object
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/traits/wf-object
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-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/wf-object')
-rw-r--r--src/test/ui/traits/wf-object/maybe-bound.rs18
-rw-r--r--src/test/ui/traits/wf-object/maybe-bound.stderr32
-rw-r--r--src/test/ui/traits/wf-object/no-duplicates.rs33
-rw-r--r--src/test/ui/traits/wf-object/no-duplicates.stderr58
-rw-r--r--src/test/ui/traits/wf-object/only-maybe-bound.rs7
-rw-r--r--src/test/ui/traits/wf-object/only-maybe-bound.stderr15
-rw-r--r--src/test/ui/traits/wf-object/reverse-order.rs15
7 files changed, 0 insertions, 178 deletions
diff --git a/src/test/ui/traits/wf-object/maybe-bound.rs b/src/test/ui/traits/wf-object/maybe-bound.rs
deleted file mode 100644
index 17771e976..000000000
--- a/src/test/ui/traits/wf-object/maybe-bound.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Test that `dyn ... + ?Sized + ...` is okay (though `?Sized` has no effect in trait objects).
-
-trait Foo {}
-
-type _0 = dyn ?Sized + Foo;
-//~^ ERROR `?Trait` is not permitted in trait object types
-
-type _1 = dyn Foo + ?Sized;
-//~^ ERROR `?Trait` is not permitted in trait object types
-
-type _2 = dyn Foo + ?Sized + ?Sized;
-//~^ ERROR `?Trait` is not permitted in trait object types
-//~| ERROR `?Trait` is not permitted in trait object types
-
-type _3 = dyn ?Sized + Foo;
-//~^ ERROR `?Trait` is not permitted in trait object types
-
-fn main() {}
diff --git a/src/test/ui/traits/wf-object/maybe-bound.stderr b/src/test/ui/traits/wf-object/maybe-bound.stderr
deleted file mode 100644
index 2fe3f0fc3..000000000
--- a/src/test/ui/traits/wf-object/maybe-bound.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error: `?Trait` is not permitted in trait object types
- --> $DIR/maybe-bound.rs:5:15
- |
-LL | type _0 = dyn ?Sized + Foo;
- | ^^^^^^
-
-error: `?Trait` is not permitted in trait object types
- --> $DIR/maybe-bound.rs:8:21
- |
-LL | type _1 = dyn Foo + ?Sized;
- | ^^^^^^
-
-error: `?Trait` is not permitted in trait object types
- --> $DIR/maybe-bound.rs:11:21
- |
-LL | type _2 = dyn Foo + ?Sized + ?Sized;
- | ^^^^^^
-
-error: `?Trait` is not permitted in trait object types
- --> $DIR/maybe-bound.rs:11:30
- |
-LL | type _2 = dyn Foo + ?Sized + ?Sized;
- | ^^^^^^
-
-error: `?Trait` is not permitted in trait object types
- --> $DIR/maybe-bound.rs:15:15
- |
-LL | type _3 = dyn ?Sized + Foo;
- | ^^^^^^
-
-error: aborting due to 5 previous errors
-
diff --git a/src/test/ui/traits/wf-object/no-duplicates.rs b/src/test/ui/traits/wf-object/no-duplicates.rs
deleted file mode 100644
index 678ede582..000000000
--- a/src/test/ui/traits/wf-object/no-duplicates.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// The purpose of this test is to demonstrate that duplicating object safe traits
-// that are not auto-traits is rejected even though one could reasonably accept this.
-
-// Some arbitrary object-safe trait:
-trait Obj {}
-
-// Demonstrate that recursive expansion of trait aliases doesn't affect stable behavior:
-type _0 = dyn Obj + Obj;
-//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
-
-// Some variations:
-
-type _1 = dyn Send + Obj + Obj;
-//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
-
-type _2 = dyn Obj + Send + Obj;
-//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
-
-type _3 = dyn Obj + Send + Send; // But it is OK to duplicate auto traits.
-
-// 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> {}
-type _4 = dyn for<'a> ObjL<'a> + for<'b> ObjL<'b>;
-//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
-
-trait ObjT<T> {}
-type _5 = dyn ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)>;
-//~^ ERROR only auto traits can be used as additional traits in a trait object [E0225]
-
-fn main() {}
diff --git a/src/test/ui/traits/wf-object/no-duplicates.stderr b/src/test/ui/traits/wf-object/no-duplicates.stderr
deleted file mode 100644
index 50dfcf956..000000000
--- a/src/test/ui/traits/wf-object/no-duplicates.stderr
+++ /dev/null
@@ -1,58 +0,0 @@
-error[E0225]: only auto traits can be used as additional traits in a trait object
- --> $DIR/no-duplicates.rs:8:21
- |
-LL | type _0 = dyn Obj + Obj;
- | --- ^^^ additional non-auto trait
- | |
- | 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:13:28
- |
-LL | type _1 = dyn Send + Obj + Obj;
- | --- ^^^ additional non-auto trait
- | |
- | 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:16:28
- |
-LL | type _2 = dyn Obj + Send + Obj;
- | --- ^^^ additional non-auto trait
- | |
- | 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:26:34
- |
-LL | type _4 = dyn for<'a> ObjL<'a> + for<'b> ObjL<'b>;
- | ---------------- ^^^^^^^^^^^^^^^^ additional non-auto trait
- | |
- | first non-auto trait
- |
- = 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:30:42
- |
-LL | type _5 = dyn ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)>;
- | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ additional non-auto trait
- | |
- | first non-auto trait
- |
- = 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 5 previous errors
-
-For more information about this error, try `rustc --explain E0225`.
diff --git a/src/test/ui/traits/wf-object/only-maybe-bound.rs b/src/test/ui/traits/wf-object/only-maybe-bound.rs
deleted file mode 100644
index 3e6db3e99..000000000
--- a/src/test/ui/traits/wf-object/only-maybe-bound.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// Test that `dyn ?Sized` (i.e., a trait object with only a maybe buond) is not allowed.
-
-type _0 = dyn ?Sized;
-//~^ ERROR at least one trait is required for an object type [E0224]
-//~| ERROR ?Trait` is not permitted in trait object types
-
-fn main() {}
diff --git a/src/test/ui/traits/wf-object/only-maybe-bound.stderr b/src/test/ui/traits/wf-object/only-maybe-bound.stderr
deleted file mode 100644
index cbc41feec..000000000
--- a/src/test/ui/traits/wf-object/only-maybe-bound.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: `?Trait` is not permitted in trait object types
- --> $DIR/only-maybe-bound.rs:3:15
- |
-LL | type _0 = dyn ?Sized;
- | ^^^^^^
-
-error[E0224]: at least one trait is required for an object type
- --> $DIR/only-maybe-bound.rs:3:11
- |
-LL | type _0 = dyn ?Sized;
- | ^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0224`.
diff --git a/src/test/ui/traits/wf-object/reverse-order.rs b/src/test/ui/traits/wf-object/reverse-order.rs
deleted file mode 100644
index 4f676cbe3..000000000
--- a/src/test/ui/traits/wf-object/reverse-order.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-pass
-
-// Ensure that `dyn $($AutoTrait)+ ObjSafe` is well-formed.
-
-use std::marker::Unpin;
-
-// Some arbitrary object-safe trait:
-trait Obj {}
-
-type _0 = dyn Unpin;
-type _1 = dyn Send + Obj;
-type _2 = dyn Send + Unpin + Obj;
-type _3 = dyn Send + Unpin + Sync + Obj;
-
-fn main() {}