Skip to content

Commit 62e38a9

Browse files
committed
remove unnecessary code
1 parent cc115f8 commit 62e38a9

2 files changed

Lines changed: 7 additions & 76 deletions

File tree

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,26 +239,21 @@ fn compare_method_predicate_entailment<'tcx>(
239239
let hybrid_preds = hybrid_preds.into_iter().map(Unnormalized::skip_norm_wip);
240240
let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_def_id);
241241
let param_env = ty::ParamEnv::new(tcx.mk_clauses_from_iter(hybrid_preds));
242-
// FIXME(-Zhigher-ranked-assumptions): The `hybrid_preds`
242+
// NOTE(-Zhigher-ranked-assumptions): The `hybrid_preds`
243243
// should be well-formed. However, using them may result in
244244
// region errors as we currently don't track placeholder
245245
// assumptions.
246246
//
247-
// To avoid being backwards incompatible with the old solver,
248-
// we also eagerly normalize the where-bounds in the new solver
249-
// here while ignoring region constraints. This means we can then
250-
// use where-bounds whose normalization results in placeholder
251-
// errors further down without getting any errors.
247+
// We eagerly normalize the where-clauses here while ignoring
248+
// region constraints This means we can then use where-bounds
249+
// whose normalization results in placeholder errors further
250+
// down without getting any errors.
252251
//
253-
// It should be sound to do so as the only region errors here
252+
// This should be sound to do so as the only region errors here
254253
// should be due to missing implied bounds.
255254
//
256255
// cc trait-system-refactor-initiative/issues/166.
257-
let param_env = if tcx.next_trait_solver_globally() {
258-
traits::deeply_normalize_param_env_ignoring_regions(tcx, param_env, normalize_cause)
259-
} else {
260-
traits::normalize_param_env_or_error(tcx, param_env, normalize_cause)
261-
};
256+
let param_env = traits::normalize_param_env_or_error(tcx, param_env, normalize_cause);
262257
debug!(caller_bounds=?param_env.caller_bounds());
263258

264259
let infcx = &tcx.infer_ctxt().build(TypingMode::non_body_analysis());

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use rustc_hir::def::DefKind;
3131
pub use rustc_infer::traits::*;
3232
use rustc_macros::TypeVisitable;
3333
use rustc_middle::query::Providers;
34-
use rustc_middle::span_bug;
3534
use rustc_middle::ty::error::{ExpectedFound, TypeError};
3635
use rustc_middle::ty::{
3736
self, Clause, GenericArgs, GenericArgsRef, Ty, TyCtxt, TypeFoldable, TypeFolder,
@@ -473,69 +472,6 @@ pub fn normalize_param_env_or_error<'tcx>(
473472
ty::ParamEnv::new(tcx.mk_clauses(&predicates))
474473
}
475474

476-
/// Deeply normalize the param env using the next solver ignoring
477-
/// region errors.
478-
///
479-
/// FIXME(-Zhigher-ranked-assumptions): this is a hack to work around
480-
/// the fact that we don't support placeholder assumptions right now
481-
/// and is necessary for `compare_method_predicate_entailment`, see the
482-
/// use of this function for more info. We should remove this once we
483-
/// have proper support for implied bounds on binders.
484-
#[instrument(level = "debug", skip(tcx))]
485-
pub fn deeply_normalize_param_env_ignoring_regions<'tcx>(
486-
tcx: TyCtxt<'tcx>,
487-
unnormalized_env: ty::ParamEnv<'tcx>,
488-
cause: ObligationCause<'tcx>,
489-
) -> ty::ParamEnv<'tcx> {
490-
let predicates: Vec<_> =
491-
util::elaborate(tcx, unnormalized_env.caller_bounds().into_iter()).collect();
492-
493-
debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates);
494-
495-
let elaborated_env = ty::ParamEnv::new(tcx.mk_clauses(&predicates));
496-
if !elaborated_env.has_aliases() {
497-
return elaborated_env;
498-
}
499-
500-
let span = cause.span;
501-
let infcx = tcx
502-
.infer_ctxt()
503-
.with_next_trait_solver(true)
504-
.ignoring_regions()
505-
.build(TypingMode::non_body_analysis());
506-
let predicates = match crate::solve::deeply_normalize::<_, FulfillmentError<'tcx>>(
507-
infcx.at(&cause, elaborated_env),
508-
Unnormalized::new_wip(predicates),
509-
) {
510-
Ok(predicates) => predicates,
511-
Err(errors) => {
512-
infcx.err_ctxt().report_fulfillment_errors(errors);
513-
// An unnormalized env is better than nothing.
514-
debug!("normalize_param_env_or_error: errored resolving predicates");
515-
return elaborated_env;
516-
}
517-
};
518-
519-
debug!("do_normalize_predicates: normalized predicates = {:?}", predicates);
520-
// FIXME(-Zhigher-ranked-assumptions): We're ignoring region errors for now.
521-
// There're placeholder constraints `leaking` out.
522-
// See the fixme in the enclosing function's docs for more.
523-
let _errors = infcx.resolve_regions(cause.body_id, elaborated_env, []);
524-
525-
let predicates = match infcx.fully_resolve(predicates) {
526-
Ok(predicates) => predicates,
527-
Err(fixup_err) => {
528-
span_bug!(
529-
span,
530-
"inference variables in normalized parameter environment: {}",
531-
fixup_err
532-
)
533-
}
534-
};
535-
debug!("normalize_param_env_or_error: final predicates={:?}", predicates);
536-
ty::ParamEnv::new(tcx.mk_clauses(&predicates))
537-
}
538-
539475
#[derive(Debug)]
540476
pub enum EvaluateConstErr {
541477
/// The constant being evaluated was either a generic parameter or inference variable, *or*,

0 commit comments

Comments
 (0)