Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,9 @@ where
dst: I::Ty,
assume: I::Const,
) -> Result<Certainty, NoSolution> {
if src.has_non_region_infer() || dst.has_non_region_infer() {
Copy link
Copy Markdown
Contributor

@lcnr lcnr Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View changes since the review

also need to check assume 🤔

return Ok(Certainty::AMBIGUOUS);
}
self.delegate.is_transmutable(dst, src, assume)
}

Expand Down
10 changes: 10 additions & 0 deletions tests/ui/transmutability/transmutability-coherence.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#![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() {}
19 changes: 19 additions & 0 deletions tests/ui/transmutability/transmutability-coherence.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0747]: type provided when a constant was expected
--> $DIR/transmutability-coherence.rs:4:37
|
LL | impl<T: std::mem::TransmuteFrom<(), ()>> OpaqueTrait for T {}
| ^^

error[E0119]: conflicting implementations of trait `OpaqueTrait` for type `&_`
--> $DIR/transmutability-coherence.rs:7: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`.
Loading