Turn features() into a query.
This commit is contained in:
parent
e2746d8700
commit
542bc75dea
49 changed files with 207 additions and 140 deletions
|
|
@ -415,7 +415,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
|
|||
|
||||
let trait_def = self.tcx().trait_def(trait_def_id);
|
||||
|
||||
if !self.tcx().sess.features.borrow().unboxed_closures &&
|
||||
if !self.tcx().features().unboxed_closures &&
|
||||
trait_segment.with_parameters(|p| p.parenthesized) != trait_def.paren_sugar {
|
||||
// For now, require that parenthetical notation be used only with `Fn()` etc.
|
||||
let msg = if trait_def.paren_sugar {
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
};
|
||||
if pat_adjustments.len() > 0 {
|
||||
if tcx.sess.features.borrow().match_default_bindings {
|
||||
if tcx.features().match_default_bindings {
|
||||
debug!("default binding mode is now {:?}", def_bm);
|
||||
self.inh.tables.borrow_mut()
|
||||
.pat_adjustments_mut()
|
||||
|
|
|
|||
|
|
@ -586,7 +586,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
if has_unsized_tuple_coercion && !self.tcx.sess.features.borrow().unsized_tuple_coercion {
|
||||
if has_unsized_tuple_coercion && !self.tcx.features().unsized_tuple_coercion {
|
||||
feature_gate::emit_feature_err(&self.tcx.sess.parse_sess,
|
||||
"unsized_tuple_coercion",
|
||||
self.cause.span,
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
// possible that there will be multiple applicable methods.
|
||||
if !is_suggestion.0 {
|
||||
if reached_raw_pointer
|
||||
&& !self.tcx.sess.features.borrow().arbitrary_self_types {
|
||||
&& !self.tcx.features().arbitrary_self_types {
|
||||
// this case used to be allowed by the compiler,
|
||||
// so we do a future-compat lint here for the 2015 epoch
|
||||
// (see https://github.com/rust-lang/rust/issues/46906)
|
||||
|
|
|
|||
|
|
@ -1105,7 +1105,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
|
|||
}
|
||||
fcx.demand_suptype(span, ret_ty, actual_return_ty);
|
||||
|
||||
if fcx.tcx.sess.features.borrow().termination_trait {
|
||||
if fcx.tcx.features().termination_trait {
|
||||
// If the termination trait language item is activated, check that the main return type
|
||||
// implements the termination trait.
|
||||
if let Some(term_id) = fcx.tcx.lang_items().termination() {
|
||||
|
|
@ -1616,7 +1616,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
let repr_type_ty = def.repr.discr_type().to_ty(tcx);
|
||||
if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 {
|
||||
if !tcx.sess.features.borrow().repr128 {
|
||||
if !tcx.features().repr128 {
|
||||
emit_feature_err(&tcx.sess.parse_sess,
|
||||
"repr128",
|
||||
sp,
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
|
|||
let is_self_ty = |ty| fcx.infcx.can_eq(fcx.param_env, self_ty, ty).is_ok();
|
||||
let self_kind = ExplicitSelf::determine(self_arg_ty, is_self_ty);
|
||||
|
||||
if !fcx.tcx.sess.features.borrow().arbitrary_self_types {
|
||||
if !fcx.tcx.features().arbitrary_self_types {
|
||||
match self_kind {
|
||||
ExplicitSelf::ByValue |
|
||||
ExplicitSelf::ByReference(_, _) |
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ fn enforce_trait_manually_implementable(tcx: TyCtxt, impl_def_id: DefId, trait_d
|
|||
return;
|
||||
}
|
||||
|
||||
if tcx.sess.features.borrow().unboxed_closures {
|
||||
if tcx.features().unboxed_closures {
|
||||
// the feature gate allows all Fn traits
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
};
|
||||
|
||||
let paren_sugar = tcx.has_attr(def_id, "rustc_paren_sugar");
|
||||
if paren_sugar && !tcx.sess.features.borrow().unboxed_closures {
|
||||
if paren_sugar && !tcx.features().unboxed_closures {
|
||||
let mut err = tcx.sess.struct_span_err(
|
||||
item.span,
|
||||
"the `#[rustc_paren_sugar]` attribute is a temporary means of controlling \
|
||||
|
|
@ -953,7 +953,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
|
||||
if !allow_defaults && p.default.is_some() {
|
||||
if !tcx.sess.features.borrow().default_type_parameter_fallback {
|
||||
if !tcx.features().default_type_parameter_fallback {
|
||||
tcx.lint_node(
|
||||
lint::builtin::INVALID_TYPE_PARAM_DEFAULT,
|
||||
p.id,
|
||||
|
|
@ -1692,7 +1692,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>(
|
|||
// feature gate SIMD types in FFI, since I (huonw) am not sure the
|
||||
// ABIs are handled at all correctly.
|
||||
if abi != abi::Abi::RustIntrinsic && abi != abi::Abi::PlatformIntrinsic
|
||||
&& !tcx.sess.features.borrow().simd_ffi {
|
||||
&& !tcx.features().simd_ffi {
|
||||
let check = |ast_ty: &hir::Ty, ty: Ty| {
|
||||
if ty.is_simd() {
|
||||
tcx.sess.struct_span_err(ast_ty.span,
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
let actual = tcx.fn_sig(main_def_id);
|
||||
let expected_return_type = if tcx.lang_items().termination().is_some()
|
||||
&& tcx.sess.features.borrow().termination_trait {
|
||||
&& tcx.features().termination_trait {
|
||||
// we take the return type of the given main function, the real check is done
|
||||
// in `check_fn`
|
||||
actual.output().skip_binder()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue