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

@ -606,7 +606,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
Scope::BuiltinTypes => match this.builtin_types_bindings.get(&ident.name) {
Some(binding) => {
if matches!(ident.name, sym::f16)
&& !this.tcx.features().f16
&& !this.tcx.features().f16()
&& !ident.span.allows_unstable(sym::f16)
&& finalize.is_some()
&& innermost_result.is_none()
@ -620,7 +620,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
.emit();
}
if matches!(ident.name, sym::f128)
&& !this.tcx.features().f128
&& !this.tcx.features().f128()
&& !ident.span.allows_unstable(sym::f128)
&& finalize.is_some()
&& innermost_result.is_none()

View file

@ -2683,7 +2683,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
self.with_generic_param_rib(
&generics.params,
RibKind::Item(
if self.r.tcx.features().generic_const_items {
if self.r.tcx.features().generic_const_items() {
HasGenericParams::Yes(generics.span)
} else {
HasGenericParams::No
@ -2888,7 +2888,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
RibKind::Normal => {
// FIXME(non_lifetime_binders): Stop special-casing
// const params to error out here.
if self.r.tcx.features().non_lifetime_binders
if self.r.tcx.features().non_lifetime_binders()
&& matches!(param.kind, GenericParamKind::Type { .. })
{
Res::Def(def_kind, def_id.to_def_id())
@ -4411,10 +4411,10 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
let tcx = self.r.tcx();
let gate_err_sym_msg = match prim {
PrimTy::Float(FloatTy::F16) if !tcx.features().f16 => {
PrimTy::Float(FloatTy::F16) if !tcx.features().f16() => {
Some((sym::f16, "the type `f16` is unstable"))
}
PrimTy::Float(FloatTy::F128) if !tcx.features().f128 => {
PrimTy::Float(FloatTy::F128) if !tcx.features().f128() => {
Some((sym::f128, "the type `f128` is unstable"))
}
_ => None,
@ -4565,7 +4565,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
}
AnonConstKind::InlineConst => ConstantHasGenerics::Yes,
AnonConstKind::ConstArg(_) => {
if self.r.tcx.features().generic_const_exprs || is_trivial_const_arg {
if self.r.tcx.features().generic_const_exprs() || is_trivial_const_arg {
ConstantHasGenerics::Yes
} else {
ConstantHasGenerics::No(NoConstantGenericsReason::NonTrivialConstArg)

View file

@ -1198,7 +1198,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
// const generics. Of course, `Struct` and `Enum` may contain ty params, too, but the
// benefits of including them here outweighs the small number of false positives.
Some(Res::Def(DefKind::Struct | DefKind::Enum, _))
if self.r.tcx.features().adt_const_params =>
if self.r.tcx.features().adt_const_params() =>
{
Applicability::MaybeIncorrect
}
@ -2773,7 +2773,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
// Avoid suggesting placing lifetime parameters on constant items unless the relevant
// feature is enabled. Suggest the parent item as a possible location if applicable.
if let LifetimeBinderKind::ConstItem = kind
&& !self.r.tcx().features().generic_const_items
&& !self.r.tcx().features().generic_const_items()
{
continue;
}
@ -2934,7 +2934,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
.emit();
}
NoConstantGenericsReason::NonTrivialConstArg => {
assert!(!self.r.tcx.features().generic_const_exprs);
assert!(!self.r.tcx.features().generic_const_exprs());
self.r
.dcx()
.create_err(errors::ParamInNonTrivialAnonConst {

View file

@ -661,7 +661,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
}
// We are trying to avoid reporting this error if other related errors were reported.
if res != Res::Err && inner_attr && !self.tcx.features().custom_inner_attributes {
if res != Res::Err && inner_attr && !self.tcx.features().custom_inner_attributes() {
let is_macro = match res {
Res::Def(..) => true,
Res::NonMacroAttr(..) => false,
@ -690,7 +690,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
&& namespace.ident.name == sym::diagnostic
&& !(attribute.ident.name == sym::on_unimplemented
|| (attribute.ident.name == sym::do_not_recommend
&& self.tcx.features().do_not_recommend))
&& self.tcx.features().do_not_recommend()))
{
let distance =
edit_distance(attribute.ident.name.as_str(), sym::on_unimplemented.as_str(), 5);