Add transmutability test to cover for superseded PR

This commit is contained in:
Lucas Sunsi Abreu
2026-10-13 07:51:07 -03:00
parent 91e426a051
commit 90fbfefc69
3 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
error[E0747]: type provided when a constant was expected
--> $DIR/coherence.rs:10:37
|
LL | impl<T: std::mem::TransmuteFrom<(), ()>> OpaqueTrait for T {}
| ^^
error[E0119]: conflicting implementations of trait `OpaqueTrait` for type `&_`
--> $DIR/coherence.rs:13:1
|
LL | impl<T: std::mem::TransmuteFrom<(), ()>> OpaqueTrait for T {}
| ---------------------------------------------------------- first implementation here
...
LL | impl<T> OpaqueTrait for &T where T: OpaqueTrait {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0119, E0747.
For more information about an error, try `rustc --explain E0119`.

View File

@@ -0,0 +1,19 @@
error[E0747]: type provided when a constant was expected
--> $DIR/coherence.rs:10:37
|
LL | impl<T: std::mem::TransmuteFrom<(), ()>> OpaqueTrait for T {}
| ^^
error[E0119]: conflicting implementations of trait `OpaqueTrait` for type `&_`
--> $DIR/coherence.rs:13:1
|
LL | impl<T: std::mem::TransmuteFrom<(), ()>> OpaqueTrait for T {}
| ---------------------------------------------------------- first implementation here
...
LL | impl<T> OpaqueTrait for &T where T: OpaqueTrait {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0119, E0747.
For more information about an error, try `rustc --explain E0119`.

View File

@@ -0,0 +1,16 @@
//! Regression test for <https://github.com/rust-lang/rust/pull/149228>
//@ revisions: old next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
#![feature(transmutability)]
trait OpaqueTrait {}
impl<T: std::mem::TransmuteFrom<(), ()>> OpaqueTrait for T {}
//~^ ERROR: type provided when a constant was expected
impl<T> OpaqueTrait for &T where T: OpaqueTrait {}
//~^ ERROR: conflicting implementations of trait `OpaqueTrait` for type `&_`
fn main() {}