More rebase fixes.

This commit is contained in:
Huon Wilson 2014-12-26 22:33:56 +11:00
parent 7c21a0ff69
commit 91db254c81
19 changed files with 60 additions and 52 deletions

View File

@ -83,7 +83,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
ast::TyF64 => mywrite!(w, "MF"),
}
}
ty::ty_enum(def, ref substs) => {
ty::ty_enum(def, substs) => {
mywrite!(w, "t[{}|", (cx.ds)(def));
enc_substs(w, cx, substs);
mywrite!(w, "]");
@ -104,7 +104,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
ty::ty_ptr(mt) => { mywrite!(w, "*"); enc_mt(w, cx, mt); }
ty::ty_rptr(r, mt) => {
mywrite!(w, "&");
enc_region(w, cx, r);
enc_region(w, cx, *r);
enc_mt(w, cx, mt);
}
ty::ty_vec(t, sz) => {
@ -123,12 +123,12 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
mywrite!(w, "f");
enc_closure_ty(w, cx, &**f);
}
ty::ty_bare_fn(Some(def_id), ref f) => {
ty::ty_bare_fn(Some(def_id), f) => {
mywrite!(w, "F");
mywrite!(w, "{}|", (cx.ds)(def_id));
enc_bare_fn_ty(w, cx, f);
}
ty::ty_bare_fn(None, ref f) => {
ty::ty_bare_fn(None, f) => {
mywrite!(w, "G");
enc_bare_fn_ty(w, cx, f);
}
@ -138,14 +138,14 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
ty::ty_param(ParamTy {space, idx: id, def_id: did}) => {
mywrite!(w, "p{}|{}|{}|", (cx.ds)(did), id, space.to_uint())
}
ty::ty_struct(def, ref substs) => {
ty::ty_struct(def, substs) => {
mywrite!(w, "a[{}|", (cx.ds)(def));
enc_substs(w, cx, substs);
mywrite!(w, "]");
}
ty::ty_unboxed_closure(def, region, ref substs) => {
ty::ty_unboxed_closure(def, region, substs) => {
mywrite!(w, "k[{}|", (cx.ds)(def));
enc_region(w, cx, region);
enc_region(w, cx, *region);
enc_substs(w, cx, substs);
mywrite!(w, "]");
}

View File

@ -499,7 +499,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
fn coerce_from_fn_item(&self,
a: Ty<'tcx>,
fn_def_id_a: ast::DefId,
fn_ty_a: &ty::BareFnTy<'tcx>,
fn_ty_a: &'tcx ty::BareFnTy<'tcx>,
b: Ty<'tcx>)
-> CoerceResult<'tcx> {
/*!
@ -528,7 +528,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
Ok(Some(adj))
}
ty::ty_bare_fn(None, _) => {
let a_fn_pointer = ty::mk_bare_fn(self.tcx(), None, (*fn_ty_a).clone());
let a_fn_pointer = ty::mk_bare_fn(self.tcx(), None, fn_ty_a);
try!(self.subtype(a_fn_pointer, b));
Ok(Some(ty::AdjustReifyFnPointer(fn_def_id_a)))
}

View File

@ -343,8 +343,8 @@ pub trait Combine<'tcx> {
if a.def_id != b.def_id {
Err(ty::terr_traits(expected_found(self, a.def_id, b.def_id)))
} else {
let substs = try!(self.substs(a.def_id, &a.substs, &b.substs));
Ok(ty::TraitRef { def_id: a.def_id, substs: substs })
let substs = try!(self.substs(a.def_id, a.substs, b.substs));
Ok(ty::TraitRef { def_id: a.def_id, substs: self.tcx().mk_substs(substs) })
}
}
@ -572,7 +572,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
if a_opt_def_id == b_opt_def_id =>
{
let fty = try!(this.bare_fn_tys(a_fty, b_fty));
Ok(ty::mk_bare_fn(tcx, a_opt_def_id, fty))
Ok(ty::mk_bare_fn(tcx, a_opt_def_id, tcx.mk_bare_fn(fty)))
}
(&ty::ty_closure(ref a_fty), &ty::ty_closure(ref b_fty)) => {

View File

@ -219,7 +219,7 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> {
#[allow(missing_copy_implementations)]
pub struct RegionSnapshot {
length: uint,
skolemization_count: uint,
skolemization_count: u32,
}
impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {

View File

@ -15,7 +15,7 @@ use self::UndoEntry::*;
use middle::ty::{mod, Ty};
use std::cmp::min;
use std::mem;
use std::uint;
use std::u32;
use util::snapshot_vec as sv;
pub struct TypeVariableTable<'tcx> {
@ -161,7 +161,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
* unified `V1` with `T1`, this function would return `{T0}`.
*/
let mut new_elem_threshold = uint::MAX;
let mut new_elem_threshold = u32::MAX;
let mut escaping_types = Vec::new();
let actions_since_snapshot = self.values.actions_since_snapshot(&s.snapshot);
debug!("actions_since_snapshot.len() = {}", actions_since_snapshot.len());
@ -173,7 +173,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
// always be the first one we see). Note that this
// action must precede those variables being
// specified.
new_elem_threshold = min(new_elem_threshold, index);
new_elem_threshold = min(new_elem_threshold, index as u32);
debug!("NewElem({}) new_elem_threshold={}", index, new_elem_threshold);
}

View File

@ -1100,7 +1100,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} else {
// Recursively check all supertraits to find out if any further
// bounds are required and thus we must fulfill.
let tmp_tr = data.principal_trait_ref_with_self_ty(ty::mk_err());
let tmp_tr = data.principal_trait_ref_with_self_ty(self.tcx(),
ty::mk_err());
for tr in util::supertraits(self.tcx(), tmp_tr) {
let td = ty::lookup_trait_def(self.tcx(), tr.def_id());

View File

@ -1383,12 +1383,13 @@ impl<'tcx> TyTrait<'tcx> {
/// we convert the principal trait-ref into a normal trait-ref,
/// you must give *some* self-type. A common choice is `mk_err()`
/// or some skolemized type.
pub fn principal_trait_ref_with_self_ty(&self, self_ty: Ty<'tcx>)
pub fn principal_trait_ref_with_self_ty(&self,
tcx: &ctxt<'tcx>, self_ty: Ty<'tcx>)
-> Rc<ty::PolyTraitRef<'tcx>>
{
Rc::new(ty::Binder(ty::TraitRef {
def_id: self.principal.def_id(),
substs: self.principal.substs().with_self_ty(self_ty),
substs: tcx.mk_substs(self.principal.substs().with_self_ty(self_ty)),
}))
}
}
@ -1425,8 +1426,8 @@ impl<'tcx> PolyTraitRef<'tcx> {
self.0.def_id
}
pub fn substs(&self) -> &Substs<'tcx> {
&self.0.substs
pub fn substs(&self) -> &'tcx Substs<'tcx> {
self.0.substs
}
pub fn input_types(&self) -> &[Ty<'tcx>] {
@ -4159,8 +4160,8 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
AdjustReifyFnPointer(_) => {
match unadjusted_ty.sty {
ty::ty_bare_fn(Some(_), ref b) => {
ty::mk_bare_fn(cx, None, (*b).clone())
ty::ty_bare_fn(Some(_), b) => {
ty::mk_bare_fn(cx, None, b)
}
ref b => {
cx.sess.bug(
@ -6727,42 +6728,42 @@ pub trait RegionEscape {
self.has_regions_escaping_depth(0)
}
fn has_regions_escaping_depth(&self, depth: uint) -> bool;
fn has_regions_escaping_depth(&self, depth: u32) -> bool;
}
impl<'tcx> RegionEscape for Ty<'tcx> {
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
ty::type_escapes_depth(*self, depth)
}
}
impl RegionEscape for Region {
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.escapes_depth(depth)
}
}
impl<'tcx> RegionEscape for TraitRef<'tcx> {
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.substs.types.iter().any(|t| t.has_regions_escaping_depth(depth)) &&
self.substs.regions().iter().any(|t| t.has_regions_escaping_depth(depth))
}
}
impl<'tcx,T:RegionEscape> RegionEscape for Binder<T> {
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.0.has_regions_escaping_depth(depth + 1)
}
}
impl<'tcx> RegionEscape for EquatePredicate<'tcx> {
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.0.has_regions_escaping_depth(depth) || self.1.has_regions_escaping_depth(depth)
}
}
impl<T:RegionEscape,U:RegionEscape> RegionEscape for OutlivesPredicate<T,U> {
fn has_regions_escaping_depth(&self, depth: uint) -> bool {
fn has_regions_escaping_depth(&self, depth: u32) -> bool {
self.0.has_regions_escaping_depth(depth) || self.1.has_regions_escaping_depth(depth)
}
}

View File

@ -527,7 +527,8 @@ pub fn super_fold_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
ty::ty_open(typ.fold_with(this))
}
ty::ty_enum(tid, ref substs) => {
ty::ty_enum(tid, substs.fold_with(this))
let substs = substs.fold_with(this);
ty::ty_enum(tid, this.tcx().mk_substs(substs))
}
ty::ty_trait(box ty::TyTrait { ref principal, bounds }) => {
ty::ty_trait(box ty::TyTrait {
@ -539,19 +540,24 @@ pub fn super_fold_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
ty::ty_tup(ts.fold_with(this))
}
ty::ty_bare_fn(opt_def_id, ref f) => {
ty::ty_bare_fn(opt_def_id, f.fold_with(this))
let bfn = f.fold_with(this);
ty::ty_bare_fn(opt_def_id, this.tcx().mk_bare_fn(bfn))
}
ty::ty_closure(ref f) => {
ty::ty_closure(box f.fold_with(this))
}
ty::ty_rptr(r, ref tm) => {
ty::ty_rptr(r.fold_with(this), tm.fold_with(this))
let r = r.fold_with(this);
ty::ty_rptr(this.tcx().mk_region(r), tm.fold_with(this))
}
ty::ty_struct(did, ref substs) => {
ty::ty_struct(did, substs.fold_with(this))
let substs = substs.fold_with(this);
ty::ty_struct(did, this.tcx().mk_substs(substs))
}
ty::ty_unboxed_closure(did, ref region, ref substs) => {
ty::ty_unboxed_closure(did, region.fold_with(this), substs.fold_with(this))
let r = region.fold_with(this);
let s = substs.fold_with(this);
ty::ty_unboxed_closure(did, this.tcx().mk_region(r), this.tcx().mk_substs(s))
}
ty::ty_bool | ty::ty_char | ty::ty_str |
ty::ty_int(_) | ty::ty_uint(_) | ty::ty_float(_) |
@ -624,6 +630,7 @@ pub fn super_fold_trait_ref<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
t: &ty::TraitRef<'tcx>)
-> ty::TraitRef<'tcx>
{
let substs = t.substs.fold_with(this);
ty::TraitRef {
def_id: t.def_id,
substs: this.tcx().mk_substs(substs),
@ -745,7 +752,7 @@ pub fn fold_regions<'tcx,T,F>(tcx: &ty::ctxt<'tcx>,
value: &T,
mut f: F)
-> T
where F : FnMut(ty::Region, uint) -> ty::Region,
where F : FnMut(ty::Region, u32) -> ty::Region,
T : TypeFoldable<'tcx>,
{
value.fold_with(&mut RegionFolder::new(tcx, &mut f))

View File

@ -1211,8 +1211,6 @@ impl<'tcx> UserString<'tcx> for ty::TraitRef<'tcx> {
let trait_def = ty::lookup_trait_def(tcx, self.def_id);
parameterized(tcx, path_str.as_slice(), self.substs,
&trait_def.generics, self.def_id)
let did = trait_def.trait_ref.def_id;
parameterized(tcx, base.as_slice(), trait_ref.substs, &trait_def.generics, did)
}
}

View File

@ -256,7 +256,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
let input_args = input_tys.iter().map(|ty| *ty).collect();
ty::mk_bare_fn(self.infcx.tcx,
None,
ty::BareFnTy {
self.infcx.tcx.mk_bare_fn(ty::BareFnTy {
unsafety: ast::Unsafety::Normal,
abi: abi::Rust,
sig: ty::Binder(ty::FnSig {
@ -264,7 +264,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
output: ty::FnConverging(output_ty),
variadic: false
})
})
}))
}
pub fn t_nil(&self) -> Ty<'tcx> {

View File

@ -361,7 +361,7 @@ fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
},
// Is this the NonZero lang item wrapping a pointer or integer type?
ty::ty_struct(did, ref substs) if Some(did) == tcx.lang_items.non_zero() => {
ty::ty_struct(did, substs) if Some(did) == tcx.lang_items.non_zero() => {
let nonzero_fields = ty::lookup_struct_fields(tcx, did);
assert_eq!(nonzero_fields.len(), 1);
let nonzero_field = ty::lookup_field_type(tcx, did, nonzero_fields[0].id, substs);
@ -376,7 +376,7 @@ fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
// Perhaps one of the fields of this struct is non-zero
// let's recurse and find out
ty::ty_struct(def_id, ref substs) => {
ty::ty_struct(def_id, substs) => {
let fields = ty::lookup_struct_fields(tcx, def_id);
for (j, field) in fields.iter().enumerate() {
let field_ty = ty::lookup_field_type(tcx, def_id, field.id, substs);

View File

@ -299,12 +299,12 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
tcx.mk_bare_fn(ty::BareFnTy {
unsafety: ast::Unsafety::Normal,
abi: synabi::RustCall,
sig: ty::FnSig {
sig: ty::Binder(ty::FnSig {
inputs: vec![bare_fn_ty_ref,
tuple_input_ty],
output: output_ty,
variadic: false
}}));
})}));
debug!("tuple_fn_ty: {}", tuple_fn_ty.repr(tcx));
//

View File

@ -1085,7 +1085,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
None,
expr.span,
expr.id,
ty::mk_struct(tcx, did, substs),
ty::mk_struct(tcx, did, tcx.mk_substs(substs)),
dest)
} else {
tcx.sess.span_bug(expr.span,

View File

@ -223,7 +223,7 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
// been ruled out when we deemed the trait to be
// "object safe".
let original_poly_trait_ref =
data.principal_trait_ref_with_self_ty(object_ty);
data.principal_trait_ref_with_self_ty(this.tcx(), object_ty);
let upcast_poly_trait_ref =
this.upcast(original_poly_trait_ref.clone(), trait_def_id);
let upcast_trait_ref =

View File

@ -200,6 +200,7 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>,
&fn_sig).0;
let transformed_self_ty = fn_sig.inputs[0];
let fty = ty::mk_bare_fn(tcx, None, tcx.mk_bare_fn(ty::BareFnTy {
sig: ty::Binder(fn_sig),
unsafety: bare_fn_ty.unsafety,
abi: bare_fn_ty.abi.clone(),
}));

View File

@ -305,7 +305,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
// a substitution that replaces `Self` with the object type
// itself. Hence, a `&self` method will wind up with an
// argument type like `&Trait`.
let trait_ref = data.principal_trait_ref_with_self_ty(self_ty);
let trait_ref = data.principal_trait_ref_with_self_ty(self.tcx(), self_ty);
self.elaborate_bounds(&[trait_ref.clone()], false, |this, new_trait_ref, m, method_num| {
let vtable_index =
get_method_index(tcx, &*new_trait_ref, trait_ref.clone(), method_num);

View File

@ -4355,7 +4355,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
traits::ItemObligation(did)),
&bounds);
ty::mk_struct(tcx, did, substs)
ty::mk_struct(tcx, did, tcx.mk_substs(substs))
} else {
ty::mk_err()
}

View File

@ -133,7 +133,7 @@ pub fn check_object_safety<'tcx>(tcx: &ty::ctxt<'tcx>,
object_trait: &ty::TyTrait<'tcx>,
span: Span)
{
let object_trait_ref = object_trait.principal_trait_ref_with_self_ty(ty::mk_err());
let object_trait_ref = object_trait.principal_trait_ref_with_self_ty(tcx, ty::mk_err());
for tr in traits::supertraits(tcx, object_trait_ref) {
check_object_safety_inner(tcx, &*tr, span);
}
@ -251,7 +251,7 @@ pub fn register_object_cast_obligations<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
// Create the obligation for casting from T to Trait.
let object_trait_ref =
object_trait.principal_trait_ref_with_self_ty(referent_ty);
object_trait.principal_trait_ref_with_self_ty(fcx.tcx(), referent_ty);
let object_obligation =
Obligation::new(
ObligationCause::new(span,

View File

@ -620,7 +620,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
let fqn = fqn.into_iter().map(|i| i.to_string())
.collect::<Vec<String>>();
let path = external_path(cx, fqn.last().unwrap().as_slice(),
Some(self.def_id), &self.substs);
Some(self.def_id), self.substs);
cx.external_paths.borrow_mut().as_mut().unwrap().insert(self.def_id,
(fqn, TypeTrait));
@ -634,7 +634,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
if let sty::ty_tup(ref ts) = ty_s.sty {
for &ty_s in ts.iter() {
if let sty::ty_rptr(ref reg, _) = ty_s.sty {
if let &Region::ReLateBound(_, _) = reg {
if let &Region::ReLateBound(_, _) = *reg {
debug!(" hit an ReLateBound {}", reg);
if let Some(lt) = reg.clean(cx) {
late_bounds.push(lt)