Skip to content

Commit 39592bc

Browse files
committed
partially revert acba644
This avoids the ICE in `tests/ui/type-alias-impl-trait/reveal_local.rs`.
1 parent d17ae64 commit 39592bc

File tree

1 file changed

+12
-11
lines changed
  • compiler/rustc_trait_selection/src/traits/select

1 file changed

+12
-11
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -2362,17 +2362,18 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
23622362
}
23632363

23642364
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => {
2365-
if self.infcx.can_define_opaque_ty(def_id) {
2366-
unreachable!()
2367-
} else {
2368-
// We can resolve the `impl Trait` to its concrete type,
2369-
// which enforces a DAG between the functions requiring
2370-
// the auto trait bounds in question.
2371-
match self.tcx().type_of_opaque(def_id) {
2372-
Ok(ty) => t.rebind(vec![ty.instantiate(self.tcx(), args)]),
2373-
Err(_) => {
2374-
return Err(SelectionError::OpaqueTypeAutoTraitLeakageUnknown(def_id));
2375-
}
2365+
// FIXME(new-solver): because we're still using the global cache
2366+
// when defining opaque types, we can reach here, but shouldn't.
2367+
// The test `type-alias-impl-trait/reveal_local.rs` is an
2368+
// example.
2369+
2370+
// We can resolve the `impl Trait` to its concrete type,
2371+
// which enforces a DAG between the functions requiring
2372+
// the auto trait bounds in question.
2373+
match self.tcx().type_of_opaque(def_id) {
2374+
Ok(ty) => t.rebind(vec![ty.instantiate(self.tcx(), args)]),
2375+
Err(_) => {
2376+
return Err(SelectionError::OpaqueTypeAutoTraitLeakageUnknown(def_id));
23762377
}
23772378
}
23782379
}

0 commit comments

Comments
 (0)