diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-10 22:04:46 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-12 09:43:39 +0000 |
| commit | a9e0e968be44160eae362ff5272ebf91eba7b214 (patch) | |
| tree | 149b7714924d9e9fa83ddcc7e4c2c40cfa96ec60 | |
| parent | 90a43f14063c601fa6a3791aac092bfc2e094911 (diff) | |
| download | rust-a9e0e968be44160eae362ff5272ebf91eba7b214.tar.gz rust-a9e0e968be44160eae362ff5272ebf91eba7b214.zip | |
Unwrap an Option that can only be Some, as inherent impls can't overlap
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index e41368957c7..574ca0ee7eb 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1590,12 +1590,12 @@ impl<'tcx> TyCtxt<'tcx> { def_id1: DefId, def_id2: DefId, ) -> Option<ImplOverlapKind> { - let impl_trait_ref1 = self.impl_trait_ref(def_id1); - let impl_trait_ref2 = self.impl_trait_ref(def_id2); + let impl_trait_ref1 = self.impl_trait_ref(def_id1).unwrap(); + let impl_trait_ref2 = self.impl_trait_ref(def_id2).unwrap(); // If either trait impl references an error, they're allowed to overlap, // as one of them essentially doesn't exist. - if impl_trait_ref1.is_some_and(|tr| tr.instantiate_identity().references_error()) - || impl_trait_ref2.is_some_and(|tr| tr.instantiate_identity().references_error()) + if impl_trait_ref1.instantiate_identity().references_error() + || impl_trait_ref2.instantiate_identity().references_error() { return Some(ImplOverlapKind::Permitted { marker: false }); } @@ -1615,8 +1615,8 @@ impl<'tcx> TyCtxt<'tcx> { }; let is_marker_overlap = { - let is_marker_impl = |trait_ref: Option<EarlyBinder<TraitRef<'_>>>| -> bool { - trait_ref.is_some_and(|tr| self.trait_def(tr.skip_binder().def_id).is_marker) + let is_marker_impl = |trait_ref: EarlyBinder<TraitRef<'_>>| -> bool { + self.trait_def(trait_ref.skip_binder().def_id).is_marker }; is_marker_impl(impl_trait_ref1) && is_marker_impl(impl_trait_ref2) }; |
