simplify feature_err imports

This commit is contained in:
Mazdak Farrokhzad 2020-01-02 12:42:42 +01:00
parent 7c78090690
commit 1af8c10bd4
16 changed files with 22 additions and 25 deletions

View File

@ -13,8 +13,8 @@ use rustc_span::source_map::MultiSpan;
use rustc_span::symbol::{sym, Symbol};
use syntax::ast;
use syntax::attr;
use syntax::feature_gate;
use syntax::print::pprust;
use syntax::sess::feature_err;
use rustc_error_codes::*;
@ -223,7 +223,7 @@ impl<'a> LintLevelsBuilder<'a> {
// don't have any lint names (`#[level(reason = "foo")]`)
if let ast::LitKind::Str(rationale, _) = name_value.kind {
if !self.sess.features_untracked().lint_reasons {
feature_gate::feature_err(
feature_err(
&self.sess.parse_sess,
sym::lint_reasons,
item.span,

View File

@ -18,7 +18,7 @@ use rustc_span::symbol::{sym, Symbol};
use rustc_span::{MultiSpan, Span};
use syntax::ast::CRATE_NODE_ID;
use syntax::attr::{self, ConstStability, Deprecation, RustcDeprecation, Stability};
use syntax::feature_gate::feature_err_issue;
use syntax::sess::feature_err_issue;
use std::num::NonZeroU32;

View File

@ -18,11 +18,11 @@ use rustc_span::{FileName, Span, DUMMY_SP};
use syntax::ast::{self, AttrItem, Block, Ident, LitKind, NodeId, PatKind, Path};
use syntax::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind};
use syntax::attr::{self, is_builtin_attr, HasAttrs};
use syntax::feature_gate::{self, feature_err};
use syntax::feature_gate;
use syntax::mut_visit::*;
use syntax::print::pprust;
use syntax::ptr::P;
use syntax::sess::ParseSess;
use syntax::sess::{feature_err, ParseSess};
use syntax::token;
use syntax::tokenstream::{TokenStream, TokenTree};
use syntax::util::map_in_place::MapInPlace;

View File

@ -1,4 +1,5 @@
use rustc::middle::cstore::{self, NativeLibrary};
use rustc::session::parse::feature_err;
use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc_data_structures::fx::FxHashSet;
@ -10,7 +11,6 @@ use rustc_span::source_map::Span;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_target::spec::abi::Abi;
use syntax::attr;
use syntax::feature_gate::feature_err;
crate fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLibrary> {
let mut collector = Collector { tcx, libs: Vec::new() };

View File

@ -6,6 +6,7 @@ use super::{PatCtxt, PatKind, PatternError};
use rustc::hir::map::Map;
use rustc::lint;
use rustc::session::parse::feature_err;
use rustc::session::Session;
use rustc::ty::subst::{InternalSubsts, SubstsRef};
use rustc::ty::{self, Ty, TyCtxt};
@ -19,7 +20,6 @@ use rustc_hir::{HirId, Pat};
use rustc_span::symbol::sym;
use rustc_span::{MultiSpan, Span};
use syntax::ast::Mutability;
use syntax::feature_gate::feature_err;
use std::slice;

View File

@ -1,12 +1,12 @@
//! Concrete error types for all operations which may be invalid in a certain const context.
use rustc::session::config::nightly_options;
use rustc::session::parse::feature_err;
use rustc::ty::TyCtxt;
use rustc_errors::struct_span_err;
use rustc_hir::def_id::DefId;
use rustc_span::symbol::sym;
use rustc_span::{Span, Symbol};
use syntax::feature_gate::feature_err;
use super::{ConstKind, Item};

View File

@ -22,10 +22,9 @@ use rustc_span::{Span, DUMMY_SP};
use syntax::ast::{self, AttrItem, Attribute, MetaItem};
use syntax::attr;
use syntax::attr::HasAttrs;
use syntax::feature_gate::feature_err;
use syntax::mut_visit::*;
use syntax::ptr::P;
use syntax::sess::ParseSess;
use syntax::sess::{feature_err, ParseSess};
use syntax::util::map_in_place::MapInPlace;
use smallvec::SmallVec;

View File

@ -9,6 +9,7 @@
use rustc::hir::map::Map;
use rustc::session::config::nightly_options;
use rustc::session::parse::feature_err;
use rustc::ty::query::Providers;
use rustc::ty::TyCtxt;
use rustc_error_codes::*;
@ -18,7 +19,6 @@ use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_span::{sym, Span, Symbol};
use syntax::ast::Mutability;
use syntax::feature_gate::feature_err;
use std::fmt;

View File

@ -5,6 +5,7 @@ use rustc::hir::map::Map;
use rustc::lint;
use rustc::middle::privacy::AccessLevels;
use rustc::middle::stability::{DeprecationEntry, Index};
use rustc::session::parse::feature_err;
use rustc::session::Session;
use rustc::traits::misc::can_type_implement_copy;
use rustc::ty::query::Providers;
@ -20,7 +21,6 @@ use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use syntax::ast::Attribute;
use syntax::attr::{self, Stability};
use syntax::feature_gate::feature_err;
use std::cmp::Ordering;
use std::mem::replace;

View File

@ -7,6 +7,7 @@ use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy};
use crate::{CrateLint, ParentScope, ResolutionError, Resolver, Scope, ScopeSet, Weak};
use crate::{ModuleKind, ModuleOrUniformRoot, NameBinding, PathResult, Segment, ToNameBinding};
use rustc::middle::stability;
use rustc::session::parse::feature_err;
use rustc::session::Session;
use rustc::{lint, span_bug, ty};
use rustc_data_structures::fx::FxHashSet;
@ -23,7 +24,6 @@ use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{Span, DUMMY_SP};
use syntax::ast::{self, Ident, NodeId};
use syntax::attr::{self, StabilityLevel};
use syntax::feature_gate::feature_err;
use syntax::print::pprust;
use rustc_data_structures::sync::Lrc;

View File

@ -10,6 +10,7 @@ use crate::namespace::Namespace;
use crate::require_c_abi_if_c_variadic;
use crate::util::common::ErrorReported;
use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
use rustc::session::parse::feature_err;
use rustc::traits;
use rustc::traits::astconv_object_safety_violations;
use rustc::traits::error_reporting::report_object_safety_error;
@ -30,7 +31,6 @@ use rustc_span::{MultiSpan, Span, DUMMY_SP};
use rustc_target::spec::abi;
use smallvec::SmallVec;
use syntax::ast;
use syntax::feature_gate::feature_err;
use syntax::util::lev_distance::find_best_match_for_name;
use std::collections::BTreeSet;

View File

@ -53,6 +53,7 @@
use crate::check::{FnCtxt, Needs};
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc::infer::{Coercion, InferOk, InferResult};
use rustc::session::parse::feature_err;
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
use rustc::ty::adjustment::{
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, PointerCast,
@ -62,6 +63,7 @@ use rustc::ty::fold::TypeFoldable;
use rustc::ty::relate::RelateResult;
use rustc::ty::subst::SubstsRef;
use rustc::ty::{self, Ty, TypeAndMut};
use rustc_error_codes::*;
use rustc_errors::{struct_span_err, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
@ -70,9 +72,6 @@ use rustc_span::symbol::sym;
use rustc_target::spec::abi::Abi;
use smallvec::{smallvec, SmallVec};
use std::ops::Deref;
use syntax::feature_gate;
use rustc_error_codes::*;
struct Coerce<'a, 'tcx> {
fcx: &'a FnCtxt<'a, 'tcx>,
@ -627,7 +626,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
}
if has_unsized_tuple_coercion && !self.tcx.features().unsized_tuple_coercion {
feature_gate::feature_err(
feature_err(
&self.tcx.sess.parse_sess,
sym::unsized_tuple_coercion,
self.cause.span,

View File

@ -99,6 +99,7 @@ use rustc::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKind};
use rustc::infer::{self, InferCtxt, InferOk, InferResult};
use rustc::middle::region;
use rustc::mir::interpret::ConstValue;
use rustc::session::parse::feature_err;
use rustc::traits::error_reporting::recursive_type_with_infinite_size_error;
use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine};
use rustc::ty::adjustment::{
@ -130,7 +131,6 @@ use rustc_span::{self, BytePos, MultiSpan, Span};
use rustc_target::spec::abi::Abi;
use syntax::ast;
use syntax::attr;
use syntax::feature_gate::feature_err;
use syntax::util::parser::ExprPrecedence;
use rustc_error_codes::*;

View File

@ -3,6 +3,7 @@ use crate::constrained_generic_params::{identify_constrained_generic_params, Par
use rustc::infer::opaque_types::may_define_opaque_type;
use rustc::middle::lang_items;
use rustc::session::parse::feature_err;
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
use rustc::ty::subst::{InternalSubsts, Subst};
use rustc::ty::{self, AdtKind, GenericParamDefKind, ToPredicate, Ty, TyCtxt, TypeFoldable};
@ -13,7 +14,6 @@ use rustc_hir::ItemKind;
use rustc_span::symbol::sym;
use rustc_span::Span;
use syntax::ast;
use syntax::feature_gate;
use rustc_hir as hir;
use rustc_hir::itemlikevisit::ParItemLikeVisitor;
@ -821,7 +821,7 @@ fn check_method_receiver<'fcx, 'tcx>(
if !receiver_is_valid(fcx, span, receiver_ty, self_ty, false) {
if receiver_is_valid(fcx, span, receiver_ty, self_ty, true) {
// Report error; would have worked with `arbitrary_self_types`.
feature_gate::feature_err(
feature_err(
&fcx.tcx.sess.parse_sess,
sym::arbitrary_self_types,
span,

View File

@ -23,6 +23,7 @@ use crate::middle::weak_lang_items;
use rustc::hir::map::Map;
use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
use rustc::mir::mono::Linkage;
use rustc::session::parse::feature_err;
use rustc::traits;
use rustc::ty::query::Providers;
use rustc::ty::subst::GenericArgKind;
@ -45,7 +46,6 @@ use rustc_target::spec::abi;
use syntax::ast;
use syntax::ast::{Ident, MetaItemKind};
use syntax::attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr};
use syntax::feature_gate;
use rustc_error_codes::*;
@ -1537,7 +1537,7 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
_ => None,
};
if let Some(unsupported_type) = err {
feature_gate::feature_err(
feature_err(
&tcx.sess.parse_sess,
sym::const_compare_raw_pointers,
hir_ty.span,
@ -2633,7 +2633,7 @@ fn from_target_feature(
None => true,
};
if !allowed && id.is_local() {
feature_gate::feature_err(
feature_err(
&tcx.sess.parse_sess,
feature_gate.unwrap(),
item.span(),

View File

@ -78,7 +78,6 @@ pub mod expand;
pub mod feature_gate {
mod check;
pub use check::{check_attribute, check_crate};
pub use rustc_session::parse::{feature_err, feature_err_issue};
}
pub mod mut_visit;
pub mod ptr;