Skip to content

Commit 2d7dd56

Browse files
authored
Rollup merge of rust-lang#102069 - compiler-errors:no-eq-in-register-opaque, r=oli-obk
Skip `Equate` relation in `handle_opaque_type` r? `@oli-obk`
2 parents 8110cce + 5b96e5e commit 2d7dd56

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

compiler/rustc_infer/src/infer/opaque_types.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_data_structures::sync::Lrc;
77
use rustc_data_structures::vec_map::VecMap;
88
use rustc_hir as hir;
99
use rustc_middle::traits::ObligationCause;
10+
use rustc_middle::ty::error::{ExpectedFound, TypeError};
1011
use rustc_middle::ty::fold::BottomUpFolder;
1112
use rustc_middle::ty::GenericArgKind;
1213
use rustc_middle::ty::{
@@ -176,16 +177,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
176177
} else if let Some(res) = process(b, a) {
177178
res
178179
} else {
179-
// Rerun equality check, but this time error out due to
180-
// different types.
181-
match self.at(cause, param_env).define_opaque_types(false).eq(a, b) {
182-
Ok(_) => span_bug!(
183-
cause.span,
184-
"opaque types are never equal to anything but themselves: {:#?}",
185-
(a.kind(), b.kind())
186-
),
187-
Err(e) => Err(e),
188-
}
180+
let (a, b) = self.resolve_vars_if_possible((a, b));
181+
Err(TypeError::Sorts(ExpectedFound::new(true, a, b)))
189182
}
190183
}
191184

0 commit comments

Comments
 (0)