about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits/mod.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-09 20:05:59 -0400
committerMichael Goulet <michael@errs.io>2024-05-10 10:42:56 -0400
commit4bde8a8f4b039c44baae49dea2f728a28d152122 (patch)
tree9449a2c31786b9b8713cd5edf36e1a2bae8f2b72 /compiler/rustc_middle/src/traits/mod.rs
parent04c049498d8c24b890bc22f8ee2d541d5e4ee2f6 (diff)
downloadrust-4bde8a8f4b039c44baae49dea2f728a28d152122.tar.gz
rust-4bde8a8f4b039c44baae49dea2f728a28d152122.zip
Remove glob imports for ObligationCauseCode
Diffstat (limited to 'compiler/rustc_middle/src/traits/mod.rs')
-rw-r--r--compiler/rustc_middle/src/traits/mod.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs
index 1ae037e09a7..50b85d895ad 100644
--- a/compiler/rustc_middle/src/traits/mod.rs
+++ b/compiler/rustc_middle/src/traits/mod.rs
@@ -33,8 +33,6 @@ use std::hash::{Hash, Hasher};
 
 pub use self::select::{EvaluationCache, EvaluationResult, OverflowError, SelectionCache};
 
-pub use self::ObligationCauseCode::*;
-
 /// Depending on the stage of compilation, we want projection to be
 /// more or less conservative.
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, HashStable, Encodable, Decodable)]
@@ -129,7 +127,7 @@ impl<'tcx> ObligationCause<'tcx> {
     }
 
     pub fn misc(span: Span, body_id: LocalDefId) -> ObligationCause<'tcx> {
-        ObligationCause::new(span, body_id, MiscObligation)
+        ObligationCause::new(span, body_id, ObligationCauseCode::MiscObligation)
     }
 
     #[inline(always)]
@@ -189,8 +187,8 @@ impl<'tcx> ObligationCause<'tcx> {
 
     pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> {
         match self.code() {
-            MatchImpl(cause, _) => cause.to_constraint_category(),
-            AscribeUserTypeProvePredicate(predicate_span) => {
+            ObligationCauseCode::MatchImpl(cause, _) => cause.to_constraint_category(),
+            ObligationCauseCode::AscribeUserTypeProvePredicate(predicate_span) => {
                 ConstraintCategory::Predicate(*predicate_span)
             }
             _ => ConstraintCategory::BoringNoLocation,
@@ -540,19 +538,22 @@ impl<'tcx> ObligationCauseCode<'tcx> {
 
     pub fn parent(&self) -> Option<(&Self, Option<ty::PolyTraitPredicate<'tcx>>)> {
         match self {
-            FunctionArgumentObligation { parent_code, .. } => Some((parent_code, None)),
-            BuiltinDerivedObligation(derived)
-            | WellFormedDerivedObligation(derived)
-            | ImplDerivedObligation(box ImplDerivedObligationCause { derived, .. }) => {
-                Some((&derived.parent_code, Some(derived.parent_trait_pred)))
+            ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => {
+                Some((parent_code, None))
             }
+            ObligationCauseCode::BuiltinDerivedObligation(derived)
+            | ObligationCauseCode::WellFormedDerivedObligation(derived)
+            | ObligationCauseCode::ImplDerivedObligation(box ImplDerivedObligationCause {
+                derived,
+                ..
+            }) => Some((&derived.parent_code, Some(derived.parent_trait_pred))),
             _ => None,
         }
     }
 
     pub fn peel_match_impls(&self) -> &Self {
         match self {
-            MatchImpl(cause, _) => cause.code(),
+            ObligationCauseCode::MatchImpl(cause, _) => cause.code(),
             _ => self,
         }
     }