diff options
| author | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-09-16 17:00:11 -0400 |
|---|---|---|
| committer | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-09-16 17:00:11 -0400 |
| commit | 67653292beccfd3b88d13d9060d4e84c4a261f63 (patch) | |
| tree | 6282b07518ef1ef9179fff2451b751e8236c2cc6 /compiler/rustc_middle | |
| parent | 6075877c897e1f6d2580ecd02a345b964b63d20d (diff) | |
| download | rust-67653292beccfd3b88d13d9060d4e84c4a261f63.tar.gz rust-67653292beccfd3b88d13d9060d4e84c4a261f63.zip | |
Add to_constraint_category to ObligationCause and SubregionOrigin
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index a95e6a61854..4cdcb40ba11 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -10,6 +10,7 @@ mod structural_impls; pub mod util; use crate::infer::canonical::Canonical; +use crate::mir::ConstraintCategory; use crate::ty::abstract_const::NotConstEvaluatable; use crate::ty::subst::SubstsRef; use crate::ty::{self, AdtKind, Ty, TyCtxt}; @@ -183,6 +184,13 @@ impl<'tcx> ObligationCause<'tcx> { variant(DerivedObligationCause { parent_trait_pred, parent_code: self.code }).into(); self } + + pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> { + match self.code() { + MatchImpl(cause, _) => cause.to_constraint_category(), + _ => ConstraintCategory::BoringNoLocation, + } + } } #[derive(Clone, Debug, PartialEq, Eq, Hash, Lift)] |
