nightly feature tracking: get rid of the per-feature bool fields

This commit is contained in:
Ralf Jung
2024-10-09 09:01:57 +02:00
parent e1f3068995
commit ad3991d303
108 changed files with 299 additions and 331 deletions

View File

@@ -40,7 +40,7 @@ pub fn is_const_evaluatable<'tcx>(
ty::ConstKind::Infer(_) => return Err(NotConstEvaluatable::MentionsInfer),
};
if tcx.features().generic_const_exprs {
if tcx.features().generic_const_exprs() {
let ct = tcx.expand_abstract_consts(unexpanded_ct);
let is_anon_ct = if let ty::ConstKind::Unevaluated(uv) = ct.kind() {

View File

@@ -254,7 +254,7 @@ fn super_predicates_have_non_lifetime_binders(
trait_def_id: DefId,
) -> SmallVec<[Span; 1]> {
// If non_lifetime_binders is disabled, then exit early
if !tcx.features().non_lifetime_binders {
if !tcx.features().non_lifetime_binders() {
return SmallVec::new();
}
tcx.explicit_super_predicates_of(trait_def_id)
@@ -327,7 +327,7 @@ pub fn dyn_compatibility_violations_for_assoc_item(
.collect(),
// Associated types can only be dyn-compatible if they have `Self: Sized` bounds.
ty::AssocKind::Type => {
if !tcx.features().generic_associated_types_extended
if !tcx.features().generic_associated_types_extended()
&& !tcx.generics_of(item.def_id).is_own_empty()
&& !item.is_impl_trait_in_trait()
{

View File

@@ -598,7 +598,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
ty::PredicateKind::ConstEquate(c1, c2) => {
let tcx = self.selcx.tcx();
assert!(
tcx.features().generic_const_exprs,
tcx.features().generic_const_exprs(),
"`ConstEquate` without a feature gate: {c1:?} {c2:?}",
);
// FIXME: we probably should only try to unify abstract constants

View File

@@ -346,7 +346,7 @@ pub fn normalize_param_env_or_error<'tcx>(
let mut predicates: Vec<_> = util::elaborate(
tcx,
unnormalized_env.caller_bounds().into_iter().map(|predicate| {
if tcx.features().generic_const_exprs {
if tcx.features().generic_const_exprs() {
return predicate;
}

View File

@@ -402,7 +402,7 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
#[instrument(skip(self), level = "debug")]
fn fold_const(&mut self, constant: ty::Const<'tcx>) -> ty::Const<'tcx> {
let tcx = self.selcx.tcx();
if tcx.features().generic_const_exprs
if tcx.features().generic_const_exprs()
|| !needs_normalization(&constant, self.param_env.reveal())
{
constant

View File

@@ -189,7 +189,7 @@ pub(super) fn poly_project_and_unify_term<'cx, 'tcx>(
ProjectAndUnifyResult::MismatchedProjectionTypes(e) => Err(e),
ProjectAndUnifyResult::Holds(obligations)
if old_universe != new_universe
&& selcx.tcx().features().generic_associated_types_extended =>
&& selcx.tcx().features().generic_associated_types_extended() =>
{
// If the `generic_associated_types_extended` feature is active, then we ignore any
// obligations references lifetimes from any universe greater than or equal to the

View File

@@ -876,7 +876,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
if let Some(principal) = data.principal() {
if !self.infcx.tcx.features().dyn_compatible_for_dispatch {
if !self.infcx.tcx.features().dyn_compatible_for_dispatch() {
principal.with_self_ty(self.tcx(), self_ty)
} else if self.tcx().is_dyn_compatible(principal.def_id()) {
principal.with_self_ty(self.tcx(), self_ty)
@@ -936,7 +936,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
let tcx = self.tcx();
if tcx.features().trait_upcasting {
if tcx.features().trait_upcasting() {
return None;
}

View File

@@ -402,7 +402,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let mut assume = predicate.trait_ref.args.const_at(2);
// FIXME(min_generic_const_exprs): We should shallowly normalize this.
if self.tcx().features().generic_const_exprs {
if self.tcx().features().generic_const_exprs() {
assume = assume.normalize_internal(self.tcx(), obligation.param_env);
}
let Some(assume) =
@@ -626,7 +626,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
for assoc_type in assoc_types {
let defs: &ty::Generics = tcx.generics_of(assoc_type);
if !defs.own_params.is_empty() && !tcx.features().generic_associated_types_extended {
if !defs.own_params.is_empty() && !tcx.features().generic_associated_types_extended() {
tcx.dcx().span_delayed_bug(
obligation.cause.span,
"GATs in trait object shouldn't have been considered",

View File

@@ -865,7 +865,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::PredicateKind::ConstEquate(c1, c2) => {
let tcx = self.tcx();
assert!(
tcx.features().generic_const_exprs,
tcx.features().generic_const_exprs(),
"`ConstEquate` without a feature gate: {c1:?} {c2:?}",
);
@@ -2195,7 +2195,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
match self.tcx().coroutine_movability(coroutine_def_id) {
hir::Movability::Static => None,
hir::Movability::Movable => {
if self.tcx().features().coroutine_clone {
if self.tcx().features().coroutine_clone() {
let resolved_upvars =
self.infcx.shallow_resolve(args.as_coroutine().tupled_upvars_ty());
let resolved_witness =

View File

@@ -136,7 +136,7 @@ pub fn translate_args_with_cause<'tcx>(
}
pub(super) fn specialization_enabled_in(tcx: TyCtxt<'_>, _: LocalCrate) -> bool {
tcx.features().specialization || tcx.features().min_specialization
tcx.features().specialization() || tcx.features().min_specialization()
}
/// Is `impl1` a specialization of `impl2`?

View File

@@ -82,7 +82,7 @@ impl<'tcx> At<'_, 'tcx> {
}
Ok(self.infcx.resolve_vars_if_possible(new_infer_ct))
} else if self.infcx.tcx.features().generic_const_exprs {
} else if self.infcx.tcx.features().generic_const_exprs() {
Ok(ct.normalize_internal(self.infcx.tcx, self.param_env))
} else {
Ok(self.normalize(ct).into_value_registering_obligations(self.infcx, fulfill_cx))

View File

@@ -836,7 +836,7 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
// obligations that don't refer to Self and
// checking those
let defer_to_coercion = tcx.features().dyn_compatible_for_dispatch;
let defer_to_coercion = tcx.features().dyn_compatible_for_dispatch();
if !defer_to_coercion {
if let Some(principal) = data.principal_def_id() {