Skip to content

Commit

Permalink
Rollup merge of rust-lang#58300 - taiki-e:librustc_typeck-2018, r=pet…
Browse files Browse the repository at this point in the history
…rochenkov

librustc_typeck => 2018

Transitions `librustc_typeck` to Rust 2018; cc rust-lang#58099

TODO: elided_lifetimes_in_paths

r? @Centril
  • Loading branch information
pietroalbini committed Feb 10, 2019
2 parents 7c5257b + fe27623 commit 14bd021
Show file tree
Hide file tree
Showing 30 changed files with 98 additions and 100 deletions.
3 changes: 2 additions & 1 deletion src/librustc_typeck/Cargo.toml
Expand Up @@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"]
name = "rustc_typeck"
version = "0.0.0"
edition = "2018"

[lib]
name = "rustc_typeck"
Expand All @@ -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" }
Expand Down
20 changes: 10 additions & 10 deletions src/librustc_typeck/astconv.rs
Expand Up @@ -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};
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions 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};
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_typeck/check/cast.rs
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/closure.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/coercion.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion 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};

Expand Down
6 changes: 3 additions & 3 deletions 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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/generator_interior.rs
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/intrinsic.rs
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions 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};
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/method/mod.rs
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_typeck/check/method/probe.rs
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions 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;
Expand All @@ -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;
Expand Down
32 changes: 16 additions & 16 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -3685,8 +3685,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
display
}

fn no_such_field_err<T: Display>(&self, span: Span, field: T, expr_t: &ty::TyS)
-> DiagnosticBuilder {
fn no_such_field_err<T: Display>(&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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(),
));
}

Expand Down
10 changes: 5 additions & 5 deletions src/librustc_typeck/check/regionck.rs
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/upvar.rs
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions 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};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/writeback.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check_unused.rs
@@ -1,4 +1,4 @@
use lint;
use crate::lint;
use rustc::ty::TyCtxt;

use errors::Applicability;
Expand Down
4 changes: 2 additions & 2 deletions 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) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/coherence/mod.rs
Expand Up @@ -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;
Expand Down

0 comments on commit 14bd021

Please sign in to comment.