diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index 68b28a60fdff7..dcfcd74257e6f 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc_typeck" version = "0.0.0" +edition = "2018" [lib] name = "rustc_typeck" @@ -14,7 +15,7 @@ arena = { path = "../libarena" } log = "0.4" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } -rustc_errors = { path = "../librustc_errors" } +errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_target = { path = "../librustc_target" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 733b03df85704..ee3fd6e1601c2 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -3,13 +3,13 @@ //! instance of `AstConv`. use errors::{Applicability, DiagnosticId}; -use hir::{self, GenericArg, GenericArgs}; -use hir::def::Def; -use hir::def_id::DefId; -use hir::HirVec; -use lint; -use middle::resolve_lifetime as rl; -use namespace::Namespace; +use crate::hir::{self, GenericArg, GenericArgs}; +use crate::hir::def::Def; +use crate::hir::def_id::DefId; +use crate::hir::HirVec; +use crate::lint; +use crate::middle::resolve_lifetime as rl; +use crate::namespace::Namespace; use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable}; @@ -18,15 +18,15 @@ use rustc::ty::subst::{Kind, Subst, Substs}; use rustc::ty::wf::object_region_bounds; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; -use require_c_abi_if_variadic; +use crate::require_c_abi_if_variadic; use smallvec::SmallVec; use syntax::ast; use syntax::feature_gate::{GateIssue, emit_feature_err}; use syntax::ptr::P; use syntax::util::lev_distance::find_best_match_for_name; use syntax_pos::{DUMMY_SP, Span, MultiSpan}; -use util::common::ErrorReported; -use util::nodemap::FxHashMap; +use crate::util::common::ErrorReported; +use crate::util::nodemap::FxHashMap; use std::collections::BTreeSet; use std::iter; diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index a90d83f3f8be0..3a670c8e2f15e 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -1,5 +1,6 @@ -use check::{FnCtxt, Expectation, Diverges, Needs}; -use check::coercion::CoerceMany; +use crate::check::{FnCtxt, Expectation, Diverges, Needs}; +use crate::check::coercion::CoerceMany; +use crate::util::nodemap::FxHashMap; use errors::Applicability; use rustc::hir::{self, PatKind}; use rustc::hir::def::{Def, CtorKind}; @@ -13,7 +14,6 @@ use syntax::source_map::Spanned; use syntax::ptr::P; use syntax::util::lev_distance::find_best_match_for_name; use syntax_pos::Span; -use util::nodemap::FxHashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::cmp; diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 85cae17fd8524..be6d432a67f9e 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -31,8 +31,8 @@ use super::FnCtxt; use errors::{DiagnosticBuilder,Applicability}; -use hir::def_id::DefId; -use lint; +use crate::hir::def_id::DefId; +use crate::lint; use rustc::hir; use rustc::session::Session; use rustc::traits; @@ -43,7 +43,7 @@ use rustc::ty::subst::Substs; use rustc::middle::lang_items; use syntax::ast; use syntax_pos::Span; -use util::common::ErrorReported; +use crate::util::common::ErrorReported; /// Reifies a cast check to be checked once we have full type information for /// a function context. @@ -294,7 +294,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { .emit(); } CastError::SizedUnsizedCast => { - use structured_errors::{SizedUnsizedCastError, StructuredDiagnostic}; + use crate::structured_errors::{SizedUnsizedCastError, StructuredDiagnostic}; SizedUnsizedCastError::new(&fcx.tcx.sess, self.span, self.expr_ty, diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index df83c92fde5b4..24c300911b384 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -2,8 +2,8 @@ use super::{check_fn, Expectation, FnCtxt, GeneratorTypes}; -use astconv::AstConv; -use middle::region; +use crate::astconv::AstConv; +use crate::middle::region; use rustc::hir::def_id::DefId; use rustc::infer::{InferOk, InferResult}; use rustc::infer::LateBoundRegionConversionTime; diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index d1dfe9469fb77..8a91e425db7bf 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -50,7 +50,7 @@ //! sort of a minor point so I've opted to leave it for later---after all //! we may want to adjust precisely when coercions occur. -use check::{FnCtxt, Needs}; +use crate::check::{FnCtxt, Needs}; use errors::DiagnosticBuilder; use rustc::hir; use rustc::hir::def_id::DefId; diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 0d4690c83170a..82f00374521bd 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -1,4 +1,4 @@ -use check::FnCtxt; +use crate::check::FnCtxt; use rustc::infer::InferOk; use rustc::traits::{ObligationCause, ObligationCauseCode}; diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index e210909127b2a..0fc8241ef9d14 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -1,13 +1,13 @@ -use check::regionck::RegionCtxt; +use crate::check::regionck::RegionCtxt; -use hir::def_id::DefId; +use crate::hir::def_id::DefId; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, InferOk, SuppressRegionErrors}; use rustc::middle::region; use rustc::traits::{ObligationCause, TraitEngine, TraitEngineExt}; use rustc::ty::subst::{Subst, Substs, UnpackedKind}; use rustc::ty::{self, Ty, TyCtxt}; -use util::common::ErrorReported; +use crate::util::common::ErrorReported; use syntax::ast; use syntax_pos::Span; diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs index 225fa1dc4f45c..7f4b0a96a15ab 100644 --- a/src/librustc_typeck/check/generator_interior.rs +++ b/src/librustc_typeck/check/generator_interior.rs @@ -11,7 +11,7 @@ use rustc::ty::{self, Ty}; use rustc_data_structures::sync::Lrc; use syntax_pos::Span; use super::FnCtxt; -use util::nodemap::FxHashMap; +use crate::util::nodemap::FxHashMap; struct InteriorVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 82d4300d99687..912ea39dce3ce 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -4,7 +4,7 @@ use rustc::traits::{ObligationCause, ObligationCauseCode}; use rustc::ty::{self, TyCtxt, Ty}; use rustc::ty::subst::Subst; -use require_same_types; +use crate::require_same_types; use rustc_target::spec::abi::Abi; use syntax::symbol::Symbol; diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 2cf2974a45a1c..34b248a106cb0 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -1,9 +1,9 @@ use super::{probe, MethodCallee}; -use astconv::AstConv; -use check::{FnCtxt, PlaceOp, callee, Needs}; -use hir::GenericArg; -use hir::def_id::DefId; +use crate::astconv::AstConv; +use crate::check::{FnCtxt, PlaceOp, callee, Needs}; +use crate::hir::GenericArg; +use crate::hir::def_id::DefId; use rustc::ty::subst::Substs; use rustc::traits; use rustc::ty::{self, Ty, GenericParamDefKind}; diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index b7d015729b42d..02cd5b7985594 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -10,9 +10,9 @@ pub use self::MethodError::*; pub use self::CandidateSource::*; pub use self::suggest::{SelfSource, TraitInfo}; -use check::FnCtxt; +use crate::check::FnCtxt; +use crate::namespace::Namespace; use errors::{Applicability, DiagnosticBuilder}; -use namespace::Namespace; use rustc_data_structures::sync::Lrc; use rustc::hir; use rustc::hir::def::Def; @@ -29,7 +29,7 @@ use syntax_pos::Span; use crate::{check_type_alias_enum_variants_enabled}; use self::probe::{IsSuggestion, ProbeScope}; -pub fn provide(providers: &mut ty::query::Providers) { +pub fn provide(providers: &mut ty::query::Providers<'_>) { suggest::provide(providers); probe::provide(providers); } diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index ada4a95ed7a34..cf31a54a54b36 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -3,11 +3,11 @@ use super::NoMatchData; use super::{CandidateSource, ImplSource, TraitSource}; use super::suggest; -use check::autoderef::{self, Autoderef}; -use check::FnCtxt; -use hir::def_id::DefId; -use hir::def::Def; -use namespace::Namespace; +use crate::check::autoderef::{self, Autoderef}; +use crate::check::FnCtxt; +use crate::hir::def_id::DefId; +use crate::hir::def::Def; +use crate::namespace::Namespace; use rustc_data_structures::sync::Lrc; use rustc::hir; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 55b6e8f099ea9..8f98b347b4cc6 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -1,10 +1,11 @@ //! Give useful errors and suggestions to users when an item can't be //! found or is otherwise invalid. -use check::FnCtxt; +use crate::check::FnCtxt; +use crate::middle::lang_items::FnOnceTraitLangItem; +use crate::namespace::Namespace; +use crate::util::nodemap::FxHashSet; use errors::{Applicability, DiagnosticBuilder}; -use middle::lang_items::FnOnceTraitLangItem; -use namespace::Namespace; use rustc_data_structures::sync::Lrc; use rustc::hir::{self, ExprKind, Node, QPath}; use rustc::hir::def::Def; @@ -15,7 +16,6 @@ use rustc::infer::type_variable::TypeVariableOrigin; use rustc::traits::Obligation; use rustc::ty::{self, Adt, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable}; use rustc::ty::item_path::with_crate_prefix; -use util::nodemap::FxHashSet; use syntax_pos::{Span, FileName}; use syntax::ast; use syntax::util::lev_distance::find_best_match_for_name; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index f82c07e4c4e0a..467032f05d6a8 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -83,15 +83,15 @@ mod generator_interior; pub mod intrinsic; mod op; -use astconv::{AstConv, PathSeg}; +use crate::astconv::{AstConv, PathSeg}; use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use rustc::hir::{self, ExprKind, GenericArg, ItemKind, Node, PatKind, QPath}; use rustc::hir::def::{CtorKind, Def}; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::itemlikevisit::ItemLikeVisitor; -use middle::lang_items; -use namespace::Namespace; +use crate::middle::lang_items; +use crate::namespace::Namespace; use rustc::infer::{self, InferCtxt, InferOk, InferResult, RegionVariableOrigin}; use rustc::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse}; use rustc_data_structures::indexed_vec::Idx; @@ -130,14 +130,14 @@ use std::mem::replace; use std::ops::{self, Deref}; use std::slice; -use require_c_abi_if_variadic; -use session::{CompileIncomplete, Session}; -use session::config::EntryFnType; -use TypeAndSubsts; -use lint; -use util::captures::Captures; -use util::common::{ErrorReported, indenter}; -use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap}; +use crate::require_c_abi_if_variadic; +use crate::session::{CompileIncomplete, Session}; +use crate::session::config::EntryFnType; +use crate::TypeAndSubsts; +use crate::lint; +use crate::util::captures::Captures; +use crate::util::common::{ErrorReported, indenter}; +use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap}; pub use self::Expectation::*; use self::autoderef::Autoderef; @@ -3044,7 +3044,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // arguments which we skipped above. if variadic { fn variadic_error<'tcx>(s: &Session, span: Span, t: Ty<'tcx>, cast_ty: &str) { - use structured_errors::{VariadicError, StructuredDiagnostic}; + use crate::structured_errors::{VariadicError, StructuredDiagnostic}; VariadicError::new(s, span, t, cast_ty).diagnostic().emit(); } @@ -3685,8 +3685,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { display } - fn no_such_field_err(&self, span: Span, field: T, expr_t: &ty::TyS) - -> DiagnosticBuilder { + fn no_such_field_err(&self, span: Span, field: T, expr_t: &ty::TyS<'_>) + -> DiagnosticBuilder<'_> { type_error_struct!(self.tcx().sess, span, expr_t, E0609, "no field `{}` on type `{}`", field, expr_t) @@ -5257,7 +5257,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { &self, blk: &'gcx hir::Block, expected_ty: Ty<'tcx>, - err: &mut DiagnosticBuilder, + err: &mut DiagnosticBuilder<'_>, ) { if let Some(span_semi) = self.could_remove_semicolon(blk, expected_ty) { err.span_suggestion( @@ -5725,7 +5725,7 @@ fn fatally_break_rust(sess: &Session) { ); handler.note_without_error(&format!("rustc {} running on {}", option_env!("CFG_VERSION").unwrap_or("unknown_version"), - ::session::config::host_triple(), + crate::session::config::host_triple(), )); } diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index b90c18eb41cb5..c058977181c9b 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -72,11 +72,11 @@ //! relation, except that a borrowed pointer never owns its //! contents. -use check::dropck; -use check::FnCtxt; -use middle::mem_categorization as mc; -use middle::mem_categorization::Categorization; -use middle::region; +use crate::check::dropck; +use crate::check::FnCtxt; +use crate::middle::mem_categorization as mc; +use crate::middle::mem_categorization::Categorization; +use crate::middle::region; use rustc::hir::def_id::DefId; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, RegionObligation, SuppressRegionErrors}; diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 15ae0166b93cb..1816b7454dd2d 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -32,9 +32,9 @@ use super::FnCtxt; -use middle::expr_use_visitor as euv; -use middle::mem_categorization as mc; -use middle::mem_categorization::Categorization; +use crate::middle::expr_use_visitor as euv; +use crate::middle::mem_categorization as mc; +use crate::middle::mem_categorization::Categorization; use rustc::hir; use rustc::hir::def_id::DefId; use rustc::hir::def_id::LocalDefId; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 1206c8eb1eaa5..b51fd58b75c20 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1,7 +1,7 @@ -use check::{Inherited, FnCtxt}; -use constrained_type_params::{identify_constrained_type_params, Parameter}; +use crate::check::{Inherited, FnCtxt}; +use crate::constrained_type_params::{identify_constrained_type_params, Parameter}; -use hir::def_id::DefId; +use crate::hir::def_id::DefId; use rustc::traits::{self, ObligationCauseCode}; use rustc::ty::{self, Lift, Ty, TyCtxt, TyKind, GenericParamDefKind, TypeFoldable, ToPredicate}; use rustc::ty::subst::{Subst, Substs}; diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 29f531201e4d8..e02e70651d6c1 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -2,7 +2,7 @@ // unresolved type variables and replaces "ty_var" types with their // substitutions. -use check::FnCtxt; +use crate::check::FnCtxt; use errors::DiagnosticBuilder; use rustc::hir; use rustc::hir::def_id::{DefId, DefIndex}; diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index a7e19fc4237cc..18194eeba80a2 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -1,4 +1,4 @@ -use lint; +use crate::lint; use rustc::ty::TyCtxt; use errors::Applicability; diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index 52dee29294cb7..138c598a7bbf0 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -1,11 +1,11 @@ -use namespace::Namespace; +use crate::namespace::Namespace; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; -use lint; +use crate::lint; pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) { diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 853c4c85d3f3b..4eee68b99d968 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -5,7 +5,7 @@ // done by the orphan and overlap modules. Then we build up various // mappings. That mapping code resides here. -use hir::def_id::{DefId, LOCAL_CRATE}; +use crate::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::traits; use rustc::ty::{self, TyCtxt, TypeFoldable}; use rustc::ty::query::Providers; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index f5e50678040f6..bb4fba105f732 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -14,13 +14,13 @@ //! At present, however, we do run collection across all items in the //! crate as a kind of pass. This should eventually be factored away. -use astconv::{AstConv, Bounds}; -use constrained_type_params as ctp; -use check::intrinsic::intrisic_operation_unsafety; -use lint; -use middle::lang_items::SizedTraitLangItem; -use middle::resolve_lifetime as rl; -use middle::weak_lang_items; +use crate::astconv::{AstConv, Bounds}; +use crate::constrained_type_params as ctp; +use crate::check::intrinsic::intrisic_operation_unsafety; +use crate::lint; +use crate::middle::lang_items::SizedTraitLangItem; +use crate::middle::resolve_lifetime as rl; +use crate::middle::weak_lang_items; use rustc::mir::mono::Linkage; use rustc::ty::query::Providers; use rustc::ty::subst::Substs; @@ -68,7 +68,7 @@ fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefI ); } -pub fn provide(providers: &mut Providers) { +pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { type_of, generics_of, diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 199ea315896df..d1f33b65fc07a 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -124,7 +124,7 @@ pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, /// which is determined by 1, which requires `U`, that is determined /// by 0. I should probably pick a less tangled example, but I can't /// think of any. -pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt, +pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt<'_, '_, '_>, predicates: &mut [(ty::Predicate<'tcx>, Span)], impl_trait_ref: Option>, input_parameters: &mut FxHashSet) diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 07f5fca6fe68e..6de06b6481695 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -8,7 +8,7 @@ //! specialization errors. These things can (and probably should) be //! fixed, but for the moment it's easier to do these checks early. -use constrained_type_params as ctp; +use crate::constrained_type_params as ctp; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::def_id::DefId; @@ -162,7 +162,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // used elsewhere are not projected back out. } -fn report_unused_parameter(tcx: TyCtxt, +fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, span: Span, kind: &str, name: &str) diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 8d77310f3d427..e99ec539c7721 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -72,17 +72,15 @@ This API is completely unstable and subject to change. #![recursion_limit="256"] +#![deny(rust_2018_idioms)] +#![allow(explicit_outlives_requirements)] + +#![allow(elided_lifetimes_in_paths)] // WIP + #[macro_use] extern crate log; #[macro_use] extern crate syntax; -extern crate syntax_pos; - -extern crate arena; #[macro_use] extern crate rustc; -extern crate rustc_data_structures; -extern crate rustc_errors as errors; -extern crate rustc_target; -extern crate smallvec; // N.B., this module needs to be declared first so diagnostics are // registered before they are used. @@ -141,7 +139,7 @@ fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, } } -fn require_c_abi_if_variadic(tcx: TyCtxt, +fn require_c_abi_if_variadic(tcx: TyCtxt<'_, '_, '_>, decl: &hir::FnDecl, abi: Abi, span: Span) { @@ -310,7 +308,7 @@ fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } } -pub fn provide(providers: &mut Providers) { +pub fn provide(providers: &mut Providers<'_>) { collect::provide(providers); coherence::provide(providers); check::provide(providers); diff --git a/src/librustc_typeck/outlives/explicit.rs b/src/librustc_typeck/outlives/explicit.rs index 38f4b37b29289..574086f780a9d 100644 --- a/src/librustc_typeck/outlives/explicit.rs +++ b/src/librustc_typeck/outlives/explicit.rs @@ -1,6 +1,6 @@ use rustc::hir::def_id::DefId; use rustc::ty::{self, OutlivesPredicate, TyCtxt}; -use util::nodemap::FxHashMap; +use crate::util::nodemap::FxHashMap; use super::utils::*; diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index e388a3e0d0c2f..0ff884d72b19f 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -1,5 +1,4 @@ -use rustc::hir; -use hir::Node; +use rustc::hir::{self, Node}; use rustc::hir::def_id::DefId; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::subst::{Kind, Subst, UnpackedKind}; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index f0310f250a9bd..b3634d37cc2b8 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -12,7 +12,7 @@ mod implicit_infer; pub mod test; mod utils; -pub fn provide(providers: &mut Providers) { +pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { inferred_outlives_of, inferred_outlives_crate, diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index d53e2d2ad7883..ec0acfb63a89a 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -15,7 +15,7 @@ use std::fmt; use syntax::ast; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; -use util::nodemap::NodeMap; +use crate::util::nodemap::NodeMap; use self::VarianceTerm::*;