Skip to content

Commit 60518a0

Browse files
committed
Unwrap an Option that can only be Some, as inherent impls can't overlap
1 parent fb17d88 commit 60518a0

File tree

1 file changed

+6
-6
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+6
-6
lines changed

compiler/rustc_middle/src/ty/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1590,12 +1590,12 @@ impl<'tcx> TyCtxt<'tcx> {
15901590
def_id1: DefId,
15911591
def_id2: DefId,
15921592
) -> Option<ImplOverlapKind> {
1593-
let impl_trait_ref1 = self.impl_trait_ref(def_id1);
1594-
let impl_trait_ref2 = self.impl_trait_ref(def_id2);
1593+
let impl_trait_ref1 = self.impl_trait_ref(def_id1).unwrap();
1594+
let impl_trait_ref2 = self.impl_trait_ref(def_id2).unwrap();
15951595
// If either trait impl references an error, they're allowed to overlap,
15961596
// as one of them essentially doesn't exist.
1597-
if impl_trait_ref1.is_some_and(|tr| tr.instantiate_identity().references_error())
1598-
|| impl_trait_ref2.is_some_and(|tr| tr.instantiate_identity().references_error())
1597+
if impl_trait_ref1.instantiate_identity().references_error()
1598+
|| impl_trait_ref2.instantiate_identity().references_error()
15991599
{
16001600
return Some(ImplOverlapKind::Permitted { marker: false });
16011601
}
@@ -1615,8 +1615,8 @@ impl<'tcx> TyCtxt<'tcx> {
16151615
};
16161616

16171617
let is_marker_overlap = {
1618-
let is_marker_impl = |trait_ref: Option<EarlyBinder<TraitRef<'_>>>| -> bool {
1619-
trait_ref.is_some_and(|tr| self.trait_def(tr.skip_binder().def_id).is_marker)
1618+
let is_marker_impl = |trait_ref: EarlyBinder<TraitRef<'_>>| -> bool {
1619+
self.trait_def(trait_ref.skip_binder().def_id).is_marker
16201620
};
16211621
is_marker_impl(impl_trait_ref1) && is_marker_impl(impl_trait_ref2)
16221622
};

0 commit comments

Comments
 (0)