From 35437c7cf6182b64b53d079367d8ca9822db9a33 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Tue, 8 Mar 2016 16:09:39 -0800 Subject: [PATCH] Fixes after a rebase --- src/librustc/middle/traits/project.rs | 3 +-- src/librustc/middle/traits/specialize/mod.rs | 4 ++-- .../traits/specialize/specialization_graph.rs | 14 +++++++------- src/librustc/middle/ty/trait_def.rs | 2 +- src/librustc_metadata/decoder.rs | 1 - src/librustc_metadata/encoder.rs | 1 + src/librustc_mir/mir_map.rs | 1 + src/librustc_trans/trans/meth.rs | 2 +- src/librustc_typeck/check/mod.rs | 4 ++-- src/librustc_typeck/coherence/overlap.rs | 1 - src/libsyntax/feature_gate.rs | 5 ++--- 11 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/librustc/middle/traits/project.rs b/src/librustc/middle/traits/project.rs index e1d811d450d..0c857692ad1 100644 --- a/src/librustc/middle/traits/project.rs +++ b/src/librustc/middle/traits/project.rs @@ -26,9 +26,8 @@ use super::util; use middle::def_id::DefId; use middle::infer::{self, TypeOrigin}; use middle::subst::Subst; -use middle::ty::{self, ToPredicate, RegionEscape, HasTypeFlags, ToPolyTraitRef, Ty, TyCtxt}; +use middle::ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt}; use middle::ty::fold::{TypeFoldable, TypeFolder}; -use rustc_front::hir; use syntax::parse::token; use syntax::ast; use util::common::FN_OUTPUT_NAME; diff --git a/src/librustc/middle/traits/specialize/mod.rs b/src/librustc/middle/traits/specialize/mod.rs index b557db9a8b2..a5b3c667fc0 100644 --- a/src/librustc/middle/traits/specialize/mod.rs +++ b/src/librustc/middle/traits/specialize/mod.rs @@ -26,7 +26,7 @@ use middle::infer::{self, InferCtxt, TypeOrigin}; use middle::region; use middle::subst::{Subst, Substs}; use middle::traits::ProjectionMode; -use middle::ty; +use middle::ty::{self, TyCtxt}; use syntax::codemap::DUMMY_SP; pub mod specialization_graph; @@ -119,7 +119,7 @@ pub fn translate_substs<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, /// Specialization is determined by the sets of types to which the impls apply; /// impl1 specializes impl2 if it applies to a subset of the types impl2 applies /// to. -pub fn specializes(tcx: &ty::ctxt, impl1_def_id: DefId, impl2_def_id: DefId) -> bool { +pub fn specializes(tcx: &TyCtxt, impl1_def_id: DefId, impl2_def_id: DefId) -> bool { // The feature gate should prevent introducing new specializations, but not // taking advantage of upstream ones. if !tcx.sess.features.borrow().specialization && diff --git a/src/librustc/middle/traits/specialize/specialization_graph.rs b/src/librustc/middle/traits/specialize/specialization_graph.rs index 77588a3e070..4af8e1fe0a8 100644 --- a/src/librustc/middle/traits/specialize/specialization_graph.rs +++ b/src/librustc/middle/traits/specialize/specialization_graph.rs @@ -17,7 +17,7 @@ use middle::cstore::CrateStore; use middle::def_id::DefId; use middle::infer; use middle::traits::{self, ProjectionMode}; -use middle::ty::{self, ImplOrTraitItem, TraitDef, TypeFoldable}; +use middle::ty::{self, TyCtxt, ImplOrTraitItem, TraitDef, TypeFoldable}; use syntax::ast::Name; use util::nodemap::DefIdMap; @@ -57,7 +57,7 @@ impl Graph { /// conflicts with it (has overlap, but neither specializes the other), /// information about the area of overlap is returned in the `Err`. pub fn insert<'a, 'tcx>(&mut self, - tcx: &'a ty::ctxt<'tcx>, + tcx: &'a TyCtxt<'tcx>, impl_def_id: DefId) -> Result<(), Overlap<'a, 'tcx>> { assert!(impl_def_id.is_local()); @@ -177,7 +177,7 @@ impl Node { } /// Iterate over the items defined directly by the given (impl or trait) node. - pub fn items<'a, 'tcx>(&self, tcx: &'a ty::ctxt<'tcx>) -> NodeItems<'a, 'tcx> { + pub fn items<'a, 'tcx>(&self, tcx: &'a TyCtxt<'tcx>) -> NodeItems<'a, 'tcx> { match *self { Node::Impl(impl_def_id) => { NodeItems::Impl { @@ -207,7 +207,7 @@ impl Node { /// An iterator over the items defined within a trait or impl. pub enum NodeItems<'a, 'tcx: 'a> { Impl { - tcx: &'a ty::ctxt<'tcx>, + tcx: &'a TyCtxt<'tcx>, items: cell::Ref<'a, Vec>, idx: usize, }, @@ -319,7 +319,7 @@ impl<'a, 'tcx> Iterator for ConstDefs<'a, 'tcx> { impl<'a, 'tcx> Ancestors<'a, 'tcx> { /// Search the items from the given ancestors, returning each type definition /// with the given name. - pub fn type_defs(self, tcx: &'a ty::ctxt<'tcx>, name: Name) -> TypeDefs<'a, 'tcx> { + pub fn type_defs(self, tcx: &'a TyCtxt<'tcx>, name: Name) -> TypeDefs<'a, 'tcx> { let iter = self.flat_map(move |node| { node.items(tcx) .filter_map(move |item| { @@ -340,7 +340,7 @@ impl<'a, 'tcx> Ancestors<'a, 'tcx> { /// Search the items from the given ancestors, returning each fn definition /// with the given name. - pub fn fn_defs(self, tcx: &'a ty::ctxt<'tcx>, name: Name) -> FnDefs<'a, 'tcx> { + pub fn fn_defs(self, tcx: &'a TyCtxt<'tcx>, name: Name) -> FnDefs<'a, 'tcx> { let iter = self.flat_map(move |node| { node.items(tcx) .filter_map(move |item| { @@ -361,7 +361,7 @@ impl<'a, 'tcx> Ancestors<'a, 'tcx> { /// Search the items from the given ancestors, returning each const /// definition with the given name. - pub fn const_defs(self, tcx: &'a ty::ctxt<'tcx>, name: Name) -> ConstDefs<'a, 'tcx> { + pub fn const_defs(self, tcx: &'a TyCtxt<'tcx>, name: Name) -> ConstDefs<'a, 'tcx> { let iter = self.flat_map(move |node| { node.items(tcx) .filter_map(move |item| { diff --git a/src/librustc/middle/ty/trait_def.rs b/src/librustc/middle/ty/trait_def.rs index c4e820bde8f..3d7b3bf2634 100644 --- a/src/librustc/middle/ty/trait_def.rs +++ b/src/librustc/middle/ty/trait_def.rs @@ -192,7 +192,7 @@ impl<'tcx> TraitDef<'tcx> { /// overlap information if the impl overlaps but does not specialize an /// existing impl. pub fn add_impl_for_specialization<'a>(&self, - tcx: &'a ctxt<'tcx>, + tcx: &'a TyCtxt<'tcx>, impl_def_id: DefId) -> Result<(), traits::Overlap<'a, 'tcx>> { assert!(impl_def_id.is_local()); diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index cf65d7a522a..38a2a7794bc 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -34,7 +34,6 @@ use middle::lang_items; use middle::subst; use middle::ty::{ImplContainer, TraitContainer}; use middle::ty::{self, Ty, TyCtxt, TypeFoldable, VariantKind}; -use middle::traits; use rustc_const_eval::ConstInt; diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 707657cfa26..41baa0b1591 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -25,6 +25,7 @@ use middle::def_id::{CRATE_DEF_INDEX, DefId}; use middle::dependency_format::Linkage; use middle::stability; use middle::subst; +use middle::traits::specialization_graph; use middle::ty::{self, Ty, TyCtxt}; use middle::ty::util::IntTypeExt; diff --git a/src/librustc_mir/mir_map.rs b/src/librustc_mir/mir_map.rs index 4aa8b82ec54..13521de78af 100644 --- a/src/librustc_mir/mir_map.rs +++ b/src/librustc_mir/mir_map.rs @@ -28,6 +28,7 @@ use rustc::mir::mir_map::MirMap; use rustc::middle::infer; use rustc::middle::region::CodeExtentData; use rustc::middle::traits::ProjectionMode; +use rustc::middle::ty::{self, Ty, TyCtxt}; use rustc::util::common::ErrorReported; use rustc::util::nodemap::NodeMap; use rustc_front::hir; diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs index 0f5c1cf87f1..2965e44bc17 100644 --- a/src/librustc_trans/trans/meth.rs +++ b/src/librustc_trans/trans/meth.rs @@ -478,7 +478,7 @@ pub struct ImplMethod<'tcx> { } /// Locates the applicable definition of a method, given its name. -pub fn get_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>, +pub fn get_impl_method<'tcx>(tcx: &TyCtxt<'tcx>, impl_def_id: DefId, substs: Substs<'tcx>, name: Name) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 534f10103b5..0d5e25efd68 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -864,7 +864,7 @@ fn check_method_body<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, check_bare_fn(ccx, &sig.decl, body, id, span, fty, param_env); } -fn report_forbidden_specialization(tcx: &ty::ctxt, +fn report_forbidden_specialization(tcx: &TyCtxt, impl_item: &hir::ImplItem, parent_impl: DefId) { @@ -887,7 +887,7 @@ fn report_forbidden_specialization(tcx: &ty::ctxt, err.emit(); } -fn check_specialization_validity<'tcx>(tcx: &ty::ctxt<'tcx>, trait_def: &ty::TraitDef<'tcx>, +fn check_specialization_validity<'tcx>(tcx: &TyCtxt<'tcx>, trait_def: &ty::TraitDef<'tcx>, impl_id: DefId, impl_item: &hir::ImplItem) { let ancestors = trait_def.ancestors(impl_id); diff --git a/src/librustc_typeck/coherence/overlap.rs b/src/librustc_typeck/coherence/overlap.rs index 4a5dbe20b78..e4994eaa255 100644 --- a/src/librustc_typeck/coherence/overlap.rs +++ b/src/librustc_typeck/coherence/overlap.rs @@ -15,7 +15,6 @@ use middle::cstore::CrateStore; use middle::traits; use middle::ty::{self, TyCtxt}; -use middle::infer; use syntax::ast; use rustc::dep_graph::DepNode; use rustc_front::hir; diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index a5f0fbbd094..fbaf28332c4 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -247,11 +247,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option, Status ("inclusive_range_syntax", "1.7.0", Some(28237), Active), // `expr?` - ("question_mark", "1.9.0", Some(31436), Active) + ("question_mark", "1.9.0", Some(31436), Active), // impl specialization (RFC 1210) - // TODO: update with issue number (once it exists), before landing - ("specialization", "1.7.0", None, Active), + ("specialization", "1.7.0", Some(31844), Active), ]; // (changing above list without updating src/doc/reference.md makes @cmr sad)