diff options
Diffstat (limited to 'compiler/rustc_middle/src/traits/mod.rs')
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 4d30c0e35e4..4006b2fcf17 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -115,8 +115,6 @@ impl Hash for ObligationCause<'_> { } } -const MISC_OBLIGATION_CAUSE_CODE: ObligationCauseCode<'static> = MiscObligation; - impl<'tcx> ObligationCause<'tcx> { #[inline] pub fn new( @@ -201,7 +199,7 @@ pub struct UnifyReceiverContext<'tcx> { #[derive(Clone, Debug, PartialEq, Eq, Hash, Lift, Default)] pub struct InternedObligationCauseCode<'tcx> { - /// `None` for `MISC_OBLIGATION_CAUSE_CODE` (a common case, occurs ~60% of + /// `None` for `ObligationCauseCode::MiscObligation` (a common case, occurs ~60% of /// the time). `Some` otherwise. code: Option<Lrc<ObligationCauseCode<'tcx>>>, } @@ -210,7 +208,11 @@ impl<'tcx> ObligationCauseCode<'tcx> { #[inline(always)] fn into(self) -> InternedObligationCauseCode<'tcx> { InternedObligationCauseCode { - code: if let MISC_OBLIGATION_CAUSE_CODE = self { None } else { Some(Lrc::new(self)) }, + code: if let ObligationCauseCode::MiscObligation = self { + None + } else { + Some(Lrc::new(self)) + }, } } } @@ -219,7 +221,7 @@ impl<'tcx> std::ops::Deref for InternedObligationCauseCode<'tcx> { type Target = ObligationCauseCode<'tcx>; fn deref(&self) -> &Self::Target { - self.code.as_deref().unwrap_or(&MISC_OBLIGATION_CAUSE_CODE) + self.code.as_deref().unwrap_or(&ObligationCauseCode::MiscObligation) } } |
