diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 451427a6980..1bca7ed8d32 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -899,6 +899,10 @@ fn assemble_candidates_for_transmutability( return; } + if obligation.references_error() { + return; + } + candidates.vec.push(TransmutabilityCandidate); }