diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index 6ca98b44bf8..e586ad1836c 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -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, diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 93c23e40d2e..4874d65b2b0 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -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; diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs index 8426391a2f3..f20de93bdeb 100644 --- a/src/librustc_expand/expand.rs +++ b/src/librustc_expand/expand.rs @@ -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; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index ae67efb966c..9426d5e26f5 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -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 { let mut collector = Collector { tcx, libs: Vec::new() }; diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index ce0c081bc16..0e9d16cfa56 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -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; diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index abef008a8ec..e69b580565e 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -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}; diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index df1e62d04d6..8467acc759c 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -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; diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index a2944918a47..39ba2fbc63b 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -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; diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index 588386e6f8d..af37d218d68 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -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; diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 1103d5b5b7c..85b5d8ef1cb 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -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; diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 851c2f76ada..c15bcd81443 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -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; diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index feab31523f2..1afb703ca15 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -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, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 32225cd417f..dea1be7641a 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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::*; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index df1eecdcfa8..a496a6e12ce 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -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, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 64e71cc42e0..ad750d5ab83 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -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(), diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index d266bf4bde0..c03e848b7a4 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -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;