diff options
| author | lcnr <rust@lcnr.de> | 2024-02-05 13:12:53 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-02-19 09:06:34 +0100 |
| commit | df55f56283d3e92a2fb1710b12cd891ca6a4e863 (patch) | |
| tree | 9eeffd922fe1be0004cd79e569282121956f92d1 /compiler/rustc_traits/src/normalize_projection_ty.rs | |
| parent | 399a258f46074740862568b124c02f7b7d04638c (diff) | |
| download | rust-df55f56283d3e92a2fb1710b12cd891ca6a4e863.tar.gz rust-df55f56283d3e92a2fb1710b12cd891ca6a4e863.zip | |
`normalize_projection_ty` is not used with next-solver
Diffstat (limited to 'compiler/rustc_traits/src/normalize_projection_ty.rs')
| -rw-r--r-- | compiler/rustc_traits/src/normalize_projection_ty.rs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/compiler/rustc_traits/src/normalize_projection_ty.rs b/compiler/rustc_traits/src/normalize_projection_ty.rs index 07089d5f19e..94df28a1454 100644 --- a/compiler/rustc_traits/src/normalize_projection_ty.rs +++ b/compiler/rustc_traits/src/normalize_projection_ty.rs @@ -25,10 +25,10 @@ fn normalize_projection_ty<'tcx>( goal: CanonicalProjectionGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> { debug!("normalize_provider(goal={:#?})", goal); - tcx.infer_ctxt().enter_canonical_trait_query( &goal, |ocx, ParamEnvAnd { param_env, value: goal }| { + debug_assert!(!ocx.infcx.next_trait_solver()); let selcx = &mut SelectionContext::new(ocx.infcx); let cause = ObligationCause::dummy(); 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). // In that case, we may only realize a cycle error when calling // `normalize_erasing_regions` in mono. - if !ocx.infcx.next_trait_solver() { - let errors = ocx.select_where_possible(); - if !errors.is_empty() { - // Rustdoc may attempt to normalize type alias types which are not - // well-formed. Rustdoc also normalizes types that are just not - // well-formed, since we don't do as much HIR analysis (checking - // that impl vars are constrained by the signature, for example). - if !tcx.sess.opts.actually_rustdoc { - for error in &errors { - if let FulfillmentErrorCode::Cycle(cycle) = &error.code { - ocx.infcx.err_ctxt().report_overflow_obligation_cycle(cycle); - } + let errors = ocx.select_where_possible(); + if !errors.is_empty() { + // Rustdoc may attempt to normalize type alias types which are not + // well-formed. Rustdoc also normalizes types that are just not + // well-formed, since we don't do as much HIR analysis (checking + // that impl vars are constrained by the signature, for example). + if !tcx.sess.opts.actually_rustdoc { + for error in &errors { + if let FulfillmentErrorCode::Cycle(cycle) = &error.code { + 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 // a type, but there is the possibility it could've been a const now. Maybe change // it to a Term later? |
