From e3021eb2452a28d9390542bf9a4fd618b431eceb Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 22 Feb 2024 14:05:01 +0000 Subject: Preserve the `Span` from `prove_predicate` all the way to registering opaque types --- compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_trait_selection/src') diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs index fb09f094d37..8cf8de4509f 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs @@ -98,6 +98,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable> + 't query_key: ParamEnvAnd<'tcx, Self>, infcx: &InferCtxt<'tcx>, output_query_region_constraints: &mut QueryRegionConstraints<'tcx>, + span: Span, ) -> Result< ( Self::QueryResponse, @@ -118,7 +119,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable> + 't let InferOk { value, obligations } = infcx .instantiate_nll_query_response_and_region_obligations( - &ObligationCause::dummy(), + &ObligationCause::dummy_with_span(span), old_param_env, &canonical_var_values, canonical_result, @@ -160,7 +161,7 @@ where let mut region_constraints = QueryRegionConstraints::default(); let (output, error_info, mut obligations, _) = - Q::fully_perform_into(self, infcx, &mut region_constraints).map_err(|_| { + Q::fully_perform_into(self, infcx, &mut region_constraints, span).map_err(|_| { infcx.dcx().span_delayed_bug(span, format!("error performing {self:?}")) })?; @@ -178,6 +179,7 @@ where obligation.param_env.and(ProvePredicate::new(obligation.predicate)), infcx, &mut region_constraints, + span, ) { Ok(((), _, new, certainty)) => { obligations.extend(new); -- cgit 1.4.1-3-g733a5