Skip to content

Commit f2ea04b

Browse files
committed
orphan check: don't support unnameable types
1 parent 4146079 commit f2ea04b

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

compiler/rustc_next_trait_solver/src/coherence.rs

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ where
336336
| ty::Uint(..)
337337
| ty::Float(..)
338338
| ty::Str
339-
| ty::FnDef(..)
340339
| ty::Pat(..)
341340
| ty::FnPtr(..)
342341
| ty::Array(..)
@@ -403,7 +402,6 @@ where
403402
// implement, so we don't use this behavior.
404403
// Addendum: Moreover, revealing the underlying type is likely to cause cycle
405404
// errors as we rely on coherence / the specialization graph during typeck.
406-
407405
self.found_non_local_ty(ty)
408406
}
409407
}
@@ -435,31 +433,14 @@ where
435433
}
436434
}
437435
ty::Error(_) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
438-
ty::Closure(did, ..) => {
439-
if self.def_id_is_local(did) {
440-
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
441-
} else {
442-
self.found_non_local_ty(ty)
443-
}
444-
}
445-
ty::CoroutineClosure(did, ..) => {
446-
if self.def_id_is_local(did) {
447-
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
448-
} else {
449-
self.found_non_local_ty(ty)
450-
}
451-
}
452-
ty::Coroutine(did, ..) => {
453-
if self.def_id_is_local(did) {
454-
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
455-
} else {
456-
self.found_non_local_ty(ty)
457-
}
436+
437+
ty::Closure(..)
438+
| ty::FnDef(..)
439+
| ty::CoroutineClosure(..)
440+
| ty::Coroutine(..)
441+
| ty::CoroutineWitness(..) => {
442+
unreachable!("unnameable type in coherence: {ty:?}");
458443
}
459-
// This should only be created when checking whether we have to check whether some
460-
// auto trait impl applies. There will never be multiple impls, so we can just
461-
// act as if it were a local type here.
462-
ty::CoroutineWitness(..) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
463444
};
464445
// A bit of a hack, the `OrphanChecker` is only used to visit a `TraitRef`, so
465446
// the first type we visit is always the self type.

0 commit comments

Comments
 (0)