Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/infer/traits.rs')
| -rw-r--r-- | crates/hir-ty/src/next_solver/infer/traits.rs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/crates/hir-ty/src/next_solver/infer/traits.rs b/crates/hir-ty/src/next_solver/infer/traits.rs index 5b875d2960..1edf256d01 100644 --- a/crates/hir-ty/src/next_solver/infer/traits.rs +++ b/crates/hir-ty/src/next_solver/infer/traits.rs @@ -16,9 +16,12 @@ use rustc_type_ir::{ }; use tracing::debug; -use crate::next_solver::{ - Clause, DbInterner, Goal, ParamEnv, PolyTraitPredicate, Predicate, Span, TraitPredicate, - TraitRef, Ty, +use crate::{ + Span, + next_solver::{ + Clause, DbInterner, Goal, ParamEnv, PolyTraitPredicate, Predicate, TraitPredicate, + TraitRef, Ty, + }, }; use super::InferCtxt; @@ -33,15 +36,18 @@ use super::InferCtxt; /// only live for a short period of time. #[derive(Clone, Debug, PartialEq, Eq)] pub struct ObligationCause { - // FIXME: This should contain an `ExprId`/`PatId` etc., and a cause code. But for now we - // don't report trait solving diagnostics, so this is irrelevant. - _private: (), + span: Span, } impl ObligationCause { #[inline] pub fn new() -> ObligationCause { - ObligationCause { _private: () } + ObligationCause { span: Span::Dummy } + } + + #[inline] + pub fn with_span(span: Span) -> ObligationCause { + ObligationCause { span } } #[inline] @@ -53,6 +59,11 @@ impl ObligationCause { pub fn misc() -> ObligationCause { ObligationCause::new() } + + #[inline] + pub(crate) fn span(&self) -> Span { + self.span + } } impl Default for ObligationCause { |