diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index e60fdd62deb..a8e5db26ead 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -9,7 +9,6 @@ use crate::session::Session; use std::cmp::Ord; use std::hash as std_hash; -use std::collections::HashMap; use std::cell::RefCell; use syntax::ast; @@ -394,13 +393,12 @@ impl<'a> HashStable> for DelimSpan { } } -pub fn hash_stable_trait_impls<'a, 'gcx, W, R>( +pub fn hash_stable_trait_impls<'a, 'gcx, W>( hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher, blanket_impls: &[DefId], - non_blanket_impls: &HashMap, R>) - where W: StableHasherResult, - R: std_hash::BuildHasher, + non_blanket_impls: &FxHashMap>) + where W: StableHasherResult { { let mut blanket_impls: SmallVec<[_; 8]> = blanket_impls diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 2810b5a8e6a..19663161fe3 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -56,7 +56,7 @@ use crate::hir::Node; use crate::middle::region; use crate::traits::{ObligationCause, ObligationCauseCode}; use crate::ty::error::TypeError; -use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TyKind, TypeFoldable}; +use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TypeFoldable}; use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; use std::{cmp, fmt}; use syntax_pos::{Pos, Span}; @@ -1094,14 +1094,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { (_, false, _) => { if let Some(exp_found) = exp_found { let (def_id, ret_ty) = match exp_found.found.sty { - TyKind::FnDef(def, _) => { + ty::FnDef(def, _) => { (Some(def), Some(self.tcx.fn_sig(def).output())) } _ => (None, None), }; let exp_is_struct = match exp_found.expected.sty { - TyKind::Adt(def, _) => def.is_struct(), + ty::Adt(def, _) => def.is_struct(), _ => false, }; @@ -1140,8 +1140,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { diag: &mut DiagnosticBuilder<'tcx>, ) { match (&exp_found.expected.sty, &exp_found.found.sty) { - (TyKind::Adt(exp_def, exp_substs), TyKind::Ref(_, found_ty, _)) => { - if let TyKind::Adt(found_def, found_substs) = found_ty.sty { + (ty::Adt(exp_def, exp_substs), ty::Ref(_, found_ty, _)) => { + if let ty::Adt(found_def, found_substs) = found_ty.sty { let path_str = format!("{:?}", exp_def); if exp_def == &found_def { let opt_msg = "you can convert from `&Option` to `Option<&T>` using \ @@ -1164,17 +1164,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let mut show_suggestion = true; for (exp_ty, found_ty) in exp_substs.types().zip(found_substs.types()) { match exp_ty.sty { - TyKind::Ref(_, exp_ty, _) => { + ty::Ref(_, exp_ty, _) => { match (&exp_ty.sty, &found_ty.sty) { - (_, TyKind::Param(_)) | - (_, TyKind::Infer(_)) | - (TyKind::Param(_), _) | - (TyKind::Infer(_), _) => {} + (_, ty::Param(_)) | + (_, ty::Infer(_)) | + (ty::Param(_), _) | + (ty::Infer(_), _) => {} _ if ty::TyS::same_type(exp_ty, found_ty) => {} _ => show_suggestion = false, }; } - TyKind::Param(_) | TyKind::Infer(_) => {} + ty::Param(_) | ty::Infer(_) => {} _ => show_suggestion = false, } } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b87343b43c9..0b75cb6c8a3 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -29,6 +29,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(rust_2018_idioms)] +#![cfg_attr(not(stage0), deny(internal))] #![allow(explicit_outlives_requirements)] #![feature(arbitrary_self_types)] diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 0eb37f0ac9e..23be1bbf6c6 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -36,7 +36,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { pub fn field_ty(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx> { let answer = match self.ty.sty { - ty::TyKind::Adt(adt_def, substs) => { + ty::Adt(adt_def, substs) => { let variant_def = match self.variant_index { None => adt_def.non_enum_variant(), Some(variant_index) => { diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 102057c1380..7d47867cea1 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(stage0), allow(usage_of_ty_tykind))] + pub use self::Variance::*; pub use self::AssociatedItemContainer::*; pub use self::BorrowKind::*; diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 5622fe43436..26194176350 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -1,11 +1,10 @@ #![allow(non_camel_case_types)] -use rustc_data_structures::sync::Lock; +use rustc_data_structures::{fx::FxHashMap, sync::Lock}; use std::cell::{RefCell, Cell}; -use std::collections::HashMap; use std::fmt::Debug; -use std::hash::{Hash, BuildHasher}; +use std::hash::Hash; use std::panic; use std::env; use std::time::{Duration, Instant}; @@ -341,8 +340,8 @@ pub trait MemoizationMap { where OP: FnOnce() -> Self::Value; } -impl MemoizationMap for RefCell> - where K: Hash+Eq+Clone, V: Clone, S: BuildHasher +impl MemoizationMap for RefCell> + where K: Hash+Eq+Clone, V: Clone { type Key = K; type Value = V;