Fixes after a rebase

This commit is contained in:
Aaron Turon 2016-03-08 16:09:39 -08:00
parent 8f0e73ef55
commit 35437c7cf6
11 changed files with 18 additions and 20 deletions

View File

@ -26,9 +26,8 @@ use super::util;
use middle::def_id::DefId; use middle::def_id::DefId;
use middle::infer::{self, TypeOrigin}; use middle::infer::{self, TypeOrigin};
use middle::subst::Subst; 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 middle::ty::fold::{TypeFoldable, TypeFolder};
use rustc_front::hir;
use syntax::parse::token; use syntax::parse::token;
use syntax::ast; use syntax::ast;
use util::common::FN_OUTPUT_NAME; use util::common::FN_OUTPUT_NAME;

View File

@ -26,7 +26,7 @@ use middle::infer::{self, InferCtxt, TypeOrigin};
use middle::region; use middle::region;
use middle::subst::{Subst, Substs}; use middle::subst::{Subst, Substs};
use middle::traits::ProjectionMode; use middle::traits::ProjectionMode;
use middle::ty; use middle::ty::{self, TyCtxt};
use syntax::codemap::DUMMY_SP; use syntax::codemap::DUMMY_SP;
pub mod specialization_graph; 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; /// 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 /// impl1 specializes impl2 if it applies to a subset of the types impl2 applies
/// to. /// 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 // The feature gate should prevent introducing new specializations, but not
// taking advantage of upstream ones. // taking advantage of upstream ones.
if !tcx.sess.features.borrow().specialization && if !tcx.sess.features.borrow().specialization &&

View File

@ -17,7 +17,7 @@ use middle::cstore::CrateStore;
use middle::def_id::DefId; use middle::def_id::DefId;
use middle::infer; use middle::infer;
use middle::traits::{self, ProjectionMode}; 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 syntax::ast::Name;
use util::nodemap::DefIdMap; use util::nodemap::DefIdMap;
@ -57,7 +57,7 @@ impl Graph {
/// conflicts with it (has overlap, but neither specializes the other), /// conflicts with it (has overlap, but neither specializes the other),
/// information about the area of overlap is returned in the `Err`. /// information about the area of overlap is returned in the `Err`.
pub fn insert<'a, 'tcx>(&mut self, pub fn insert<'a, 'tcx>(&mut self,
tcx: &'a ty::ctxt<'tcx>, tcx: &'a TyCtxt<'tcx>,
impl_def_id: DefId) impl_def_id: DefId)
-> Result<(), Overlap<'a, 'tcx>> { -> Result<(), Overlap<'a, 'tcx>> {
assert!(impl_def_id.is_local()); 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. /// 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 { match *self {
Node::Impl(impl_def_id) => { Node::Impl(impl_def_id) => {
NodeItems::Impl { NodeItems::Impl {
@ -207,7 +207,7 @@ impl Node {
/// An iterator over the items defined within a trait or impl. /// An iterator over the items defined within a trait or impl.
pub enum NodeItems<'a, 'tcx: 'a> { pub enum NodeItems<'a, 'tcx: 'a> {
Impl { Impl {
tcx: &'a ty::ctxt<'tcx>, tcx: &'a TyCtxt<'tcx>,
items: cell::Ref<'a, Vec<ty::ImplOrTraitItemId>>, items: cell::Ref<'a, Vec<ty::ImplOrTraitItemId>>,
idx: usize, idx: usize,
}, },
@ -319,7 +319,7 @@ impl<'a, 'tcx> Iterator for ConstDefs<'a, 'tcx> {
impl<'a, 'tcx> Ancestors<'a, 'tcx> { impl<'a, 'tcx> Ancestors<'a, 'tcx> {
/// Search the items from the given ancestors, returning each type definition /// Search the items from the given ancestors, returning each type definition
/// with the given name. /// 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| { let iter = self.flat_map(move |node| {
node.items(tcx) node.items(tcx)
.filter_map(move |item| { .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 /// Search the items from the given ancestors, returning each fn definition
/// with the given name. /// 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| { let iter = self.flat_map(move |node| {
node.items(tcx) node.items(tcx)
.filter_map(move |item| { .filter_map(move |item| {
@ -361,7 +361,7 @@ impl<'a, 'tcx> Ancestors<'a, 'tcx> {
/// Search the items from the given ancestors, returning each const /// Search the items from the given ancestors, returning each const
/// definition with the given name. /// 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| { let iter = self.flat_map(move |node| {
node.items(tcx) node.items(tcx)
.filter_map(move |item| { .filter_map(move |item| {

View File

@ -192,7 +192,7 @@ impl<'tcx> TraitDef<'tcx> {
/// overlap information if the impl overlaps but does not specialize an /// overlap information if the impl overlaps but does not specialize an
/// existing impl. /// existing impl.
pub fn add_impl_for_specialization<'a>(&self, pub fn add_impl_for_specialization<'a>(&self,
tcx: &'a ctxt<'tcx>, tcx: &'a TyCtxt<'tcx>,
impl_def_id: DefId) impl_def_id: DefId)
-> Result<(), traits::Overlap<'a, 'tcx>> { -> Result<(), traits::Overlap<'a, 'tcx>> {
assert!(impl_def_id.is_local()); assert!(impl_def_id.is_local());

View File

@ -34,7 +34,6 @@ use middle::lang_items;
use middle::subst; use middle::subst;
use middle::ty::{ImplContainer, TraitContainer}; use middle::ty::{ImplContainer, TraitContainer};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable, VariantKind}; use middle::ty::{self, Ty, TyCtxt, TypeFoldable, VariantKind};
use middle::traits;
use rustc_const_eval::ConstInt; use rustc_const_eval::ConstInt;

View File

@ -25,6 +25,7 @@ use middle::def_id::{CRATE_DEF_INDEX, DefId};
use middle::dependency_format::Linkage; use middle::dependency_format::Linkage;
use middle::stability; use middle::stability;
use middle::subst; use middle::subst;
use middle::traits::specialization_graph;
use middle::ty::{self, Ty, TyCtxt}; use middle::ty::{self, Ty, TyCtxt};
use middle::ty::util::IntTypeExt; use middle::ty::util::IntTypeExt;

View File

@ -28,6 +28,7 @@ use rustc::mir::mir_map::MirMap;
use rustc::middle::infer; use rustc::middle::infer;
use rustc::middle::region::CodeExtentData; use rustc::middle::region::CodeExtentData;
use rustc::middle::traits::ProjectionMode; use rustc::middle::traits::ProjectionMode;
use rustc::middle::ty::{self, Ty, TyCtxt};
use rustc::util::common::ErrorReported; use rustc::util::common::ErrorReported;
use rustc::util::nodemap::NodeMap; use rustc::util::nodemap::NodeMap;
use rustc_front::hir; use rustc_front::hir;

View File

@ -478,7 +478,7 @@ pub struct ImplMethod<'tcx> {
} }
/// Locates the applicable definition of a method, given its name. /// 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, impl_def_id: DefId,
substs: Substs<'tcx>, substs: Substs<'tcx>,
name: Name) name: Name)

View File

@ -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); 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, impl_item: &hir::ImplItem,
parent_impl: DefId) parent_impl: DefId)
{ {
@ -887,7 +887,7 @@ fn report_forbidden_specialization(tcx: &ty::ctxt,
err.emit(); 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) impl_id: DefId, impl_item: &hir::ImplItem)
{ {
let ancestors = trait_def.ancestors(impl_id); let ancestors = trait_def.ancestors(impl_id);

View File

@ -15,7 +15,6 @@
use middle::cstore::CrateStore; use middle::cstore::CrateStore;
use middle::traits; use middle::traits;
use middle::ty::{self, TyCtxt}; use middle::ty::{self, TyCtxt};
use middle::infer;
use syntax::ast; use syntax::ast;
use rustc::dep_graph::DepNode; use rustc::dep_graph::DepNode;
use rustc_front::hir; use rustc_front::hir;

View File

@ -247,11 +247,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
("inclusive_range_syntax", "1.7.0", Some(28237), Active), ("inclusive_range_syntax", "1.7.0", Some(28237), Active),
// `expr?` // `expr?`
("question_mark", "1.9.0", Some(31436), Active) ("question_mark", "1.9.0", Some(31436), Active),
// impl specialization (RFC 1210) // impl specialization (RFC 1210)
// TODO: update with issue number (once it exists), before landing ("specialization", "1.7.0", Some(31844), Active),
("specialization", "1.7.0", None, Active),
]; ];
// (changing above list without updating src/doc/reference.md makes @cmr sad) // (changing above list without updating src/doc/reference.md makes @cmr sad)