about summary refs log tree commit diff
path: root/tests/ui/transmutability
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2024-04-15 18:10:46 +0200
committerlcnr <rust@lcnr.de>2024-09-05 07:57:17 +0000
commitd93e047c9f1b33892a604273ab3931815f5604a1 (patch)
tree3dcf2c427d6f78f49b8ab47fda61636b84a410e9 /tests/ui/transmutability
parent1a893ac648e03732aaa8b5371b602ab683970b0d (diff)
downloadrust-d93e047c9f1b33892a604273ab3931815f5604a1.tar.gz
rust-d93e047c9f1b33892a604273ab3931815f5604a1.zip
rebase and update fixed `crashes`
Diffstat (limited to 'tests/ui/transmutability')
-rw-r--r--tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs11
-rw-r--r--tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr27
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs
new file mode 100644
index 00000000000..0cebc99cd41
--- /dev/null
+++ b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.rs
@@ -0,0 +1,11 @@
+#![feature(transmutability)]
+#![feature(type_alias_impl_trait)]
+trait OpaqueTrait {}
+type OpaqueType = impl OpaqueTrait;
+//~^ ERROR unconstrained opaque type
+trait AnotherTrait {}
+impl<T: std::mem::TransmuteFrom<(), ()>> AnotherTrait for T {}
+//~^ ERROR type provided when a constant was expected
+impl AnotherTrait for OpaqueType {}
+//~^ ERROR conflicting implementations of trait `AnotherTrait`
+pub fn main() {}
diff --git a/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr
new file mode 100644
index 00000000000..2424541af23
--- /dev/null
+++ b/tests/ui/transmutability/malformed-program-gracefulness/coherence-bikeshed-intrinsic-from.stderr
@@ -0,0 +1,27 @@
+error: unconstrained opaque type
+  --> $DIR/coherence-bikeshed-intrinsic-from.rs:4:19
+   |
+LL | type OpaqueType = impl OpaqueTrait;
+   |                   ^^^^^^^^^^^^^^^^
+   |
+   = note: `OpaqueType` must be used in combination with a concrete type within the same module
+
+error[E0747]: type provided when a constant was expected
+  --> $DIR/coherence-bikeshed-intrinsic-from.rs:7:37
+   |
+LL | impl<T: std::mem::TransmuteFrom<(), ()>> AnotherTrait for T {}
+   |                                     ^^
+
+error[E0119]: conflicting implementations of trait `AnotherTrait`
+  --> $DIR/coherence-bikeshed-intrinsic-from.rs:9:1
+   |
+LL | impl<T: std::mem::TransmuteFrom<(), ()>> AnotherTrait for T {}
+   | ----------------------------------------------------------- first implementation here
+LL |
+LL | impl AnotherTrait for OpaqueType {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0119, E0747.
+For more information about an error, try `rustc --explain E0119`.