normalize_projection_ty is not used with next-solver

This commit is contained in:
lcnr 2024-02-05 13:12:53 +01:00
parent 399a258f46
commit df55f56283

View File

@ -25,10 +25,10 @@ fn normalize_projection_ty<'tcx>(
goal: CanonicalProjectionGoal<'tcx>, goal: CanonicalProjectionGoal<'tcx>,
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> { ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
debug!("normalize_provider(goal={:#?})", goal); debug!("normalize_provider(goal={:#?})", goal);
tcx.infer_ctxt().enter_canonical_trait_query( tcx.infer_ctxt().enter_canonical_trait_query(
&goal, &goal,
|ocx, ParamEnvAnd { param_env, value: goal }| { |ocx, ParamEnvAnd { param_env, value: goal }| {
debug_assert!(!ocx.infcx.next_trait_solver());
let selcx = &mut SelectionContext::new(ocx.infcx); let selcx = &mut SelectionContext::new(ocx.infcx);
let cause = ObligationCause::dummy(); let cause = ObligationCause::dummy();
let mut obligations = vec![]; let mut obligations = vec![];
@ -45,23 +45,22 @@ fn normalize_projection_ty<'tcx>(
// are recursive (given some generic parameters of the opaque's type variables). // are recursive (given some generic parameters of the opaque's type variables).
// In that case, we may only realize a cycle error when calling // In that case, we may only realize a cycle error when calling
// `normalize_erasing_regions` in mono. // `normalize_erasing_regions` in mono.
if !ocx.infcx.next_trait_solver() { let errors = ocx.select_where_possible();
let errors = ocx.select_where_possible(); if !errors.is_empty() {
if !errors.is_empty() { // Rustdoc may attempt to normalize type alias types which are not
// Rustdoc may attempt to normalize type alias types which are not // well-formed. Rustdoc also normalizes types that are just not
// well-formed. Rustdoc also normalizes types that are just not // well-formed, since we don't do as much HIR analysis (checking
// well-formed, since we don't do as much HIR analysis (checking // that impl vars are constrained by the signature, for example).
// that impl vars are constrained by the signature, for example). if !tcx.sess.opts.actually_rustdoc {
if !tcx.sess.opts.actually_rustdoc { for error in &errors {
for error in &errors { if let FulfillmentErrorCode::Cycle(cycle) = &error.code {
if let FulfillmentErrorCode::Cycle(cycle) = &error.code { ocx.infcx.err_ctxt().report_overflow_obligation_cycle(cycle);
ocx.infcx.err_ctxt().report_overflow_obligation_cycle(cycle);
}
} }
} }
return Err(NoSolution);
} }
return Err(NoSolution);
} }
// FIXME(associated_const_equality): All users of normalize_projection_ty expected // FIXME(associated_const_equality): All users of normalize_projection_ty expected
// a type, but there is the possibility it could've been a const now. Maybe change // a type, but there is the possibility it could've been a const now. Maybe change
// it to a Term later? // it to a Term later?