diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 46f4ed4ec478b1b7ba1eed0182eae1cb3b11cb4a..a64d8c2967f636d05ab80fd2e5b114705fd58698 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -25,7 +25,7 @@ use mir; impl<'a, 'gcx, T> HashStable> -for &'gcx ty::Slice +for &'gcx ty::List where T: HashStable> { fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, @@ -53,7 +53,7 @@ fn hash_stable(&self, } } -impl<'a, 'gcx, T> ToStableHashKey> for &'gcx ty::Slice +impl<'a, 'gcx, T> ToStableHashKey> for &'gcx ty::List where T: HashStable> { type KeyType = Fingerprint; diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index c4de95c60bff5f624178305e29d14cc76c1424aa..7d5b0a8de8b87c52ace03a5dd3bce01ac4b5b71f 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -23,7 +23,7 @@ use std::sync::atomic::Ordering; use ty::fold::{TypeFoldable, TypeFolder}; use ty::subst::Kind; -use ty::{self, CanonicalVar, Lift, Slice, Ty, TyCtxt, TypeFlags}; +use ty::{self, CanonicalVar, Lift, List, Ty, TyCtxt, TypeFlags}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; @@ -327,7 +327,7 @@ fn canonicalize( if !value.has_type_flags(needs_canonical_flags) { let out_value = gcx.lift(value).unwrap(); let canon_value = Canonical { - variables: Slice::empty(), + variables: List::empty(), value: out_value, }; return canon_value; diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index b56da8f63042474469299bdbefae614dc1aad0eb..cb1e39bb9f7428d033f52306b761ec2d84835fe1 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -40,7 +40,7 @@ use syntax::source_map::Span; use ty::fold::TypeFoldable; use ty::subst::Kind; -use ty::{self, CanonicalVar, Lift, Region, Slice, TyCtxt}; +use ty::{self, CanonicalVar, Lift, Region, List, TyCtxt}; mod canonicalizer; @@ -57,7 +57,7 @@ pub struct Canonical<'gcx, V> { pub value: V, } -pub type CanonicalVarInfos<'gcx> = &'gcx Slice; +pub type CanonicalVarInfos<'gcx> = &'gcx List; impl<'gcx> UseSpecializedDecodable for CanonicalVarInfos<'gcx> {} @@ -221,7 +221,7 @@ pub fn instantiate_canonical_with_fresh_inference_vars( fn fresh_inference_vars_for_canonical_vars( &self, span: Span, - variables: &Slice, + variables: &List, ) -> CanonicalVarValues<'tcx> { let var_values: IndexVec> = variables .iter() diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 0ba94b5275cb2e1f90f9ebd5507a52b7e93b7b76..e2dbe88354060b2221957de9398ed8696e392ecd 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -24,7 +24,7 @@ use middle::region; use mir::interpret::ConstEvalErr; use ty::subst::Substs; -use ty::{self, AdtKind, Slice, Ty, TyCtxt, GenericParamDefKind, ToPredicate}; +use ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate}; use ty::error::{ExpectedFound, TypeError}; use ty::fold::{TypeFolder, TypeFoldable, TypeVisitor}; use infer::{InferCtxt}; @@ -325,7 +325,7 @@ pub enum Goal<'tcx> { CannotProve, } -pub type Goals<'tcx> = &'tcx Slice>; +pub type Goals<'tcx> = &'tcx List>; impl<'tcx> DomainGoal<'tcx> { pub fn into_goal(self) -> Goal<'tcx> { @@ -357,7 +357,7 @@ pub enum Clause<'tcx> { } /// Multiple clauses. -pub type Clauses<'tcx> = &'tcx Slice>; +pub type Clauses<'tcx> = &'tcx List>; /// A "program clause" has the form `D :- G1, ..., Gn`. It is saying /// that the domain goal `D` is true if `G1...Gn` are provable. This diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index 9292b42eb525e751a8308c6eb348a9aa4537621e..87535a6ae8d1466d53f908d4b6e08f7ed26ee596 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -620,7 +620,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Goal<'a> { } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Slice> { +impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let v = self.iter() .map(|t| t.fold_with(folder)) @@ -658,7 +658,7 @@ impl<'tcx> TypeFoldable<'tcx> for traits::Clause<'tcx> { } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Slice> { +impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let v = self.iter() .map(|t| t.fold_with(folder)) diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 967a3324cfb2a92113d202133085d0b80df2d9bb..c343ded76578629921ab12052ec3ded2a8a60dd6 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -212,7 +212,7 @@ pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result, D #[inline] pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx ty::Slice>, D::Error> + -> Result<&'tcx ty::List>, D::Error> where D: TyDecoder<'a, 'tcx>, 'tcx: 'a, { @@ -232,7 +232,7 @@ pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx ty::Slice>, D::Error> + -> Result<&'tcx ty::List>, D::Error> where D: TyDecoder<'a, 'tcx>, 'tcx: 'a, { @@ -366,10 +366,10 @@ fn specialized_decode(&mut self) -> Result, Self::Error> { } } - impl<$($typaram),*> SpecializedDecoder<&'tcx ty::Slice>> + impl<$($typaram),*> SpecializedDecoder<&'tcx ty::List>> for $DecoderName<$($typaram),*> { fn specialized_decode(&mut self) - -> Result<&'tcx ty::Slice>, Self::Error> { + -> Result<&'tcx ty::List>, Self::Error> { decode_ty_slice(self) } } @@ -381,10 +381,10 @@ fn specialized_decode(&mut self) -> Result<&'tcx ty::AdtDef, Self::Error> { } } - impl<$($typaram),*> SpecializedDecoder<&'tcx ty::Slice>> + impl<$($typaram),*> SpecializedDecoder<&'tcx ty::List>> for $DecoderName<$($typaram),*> { fn specialized_decode(&mut self) - -> Result<&'tcx ty::Slice>, Self::Error> { + -> Result<&'tcx ty::List>, Self::Error> { decode_existential_predicate_slice(self) } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index ee0543f53ba6928cc01bf5a53241639c56e20fcf..ba274236eb90393434040921aa2d7355c394a1d9 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -38,7 +38,7 @@ use traits; use traits::{Clause, Clauses, Goal, Goals}; use ty::{self, Ty, TypeAndMut}; -use ty::{TyS, TypeVariants, Slice}; +use ty::{TyS, TypeVariants, List}; use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const}; use ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate}; use ty::RegionKind; @@ -135,15 +135,15 @@ pub struct CtxtInterners<'tcx> { /// Specifically use a speedy hash algorithm for these hash sets, /// they're accessed quite often. type_: InternedSet<'tcx, TyS<'tcx>>, - type_list: InternedSet<'tcx, Slice>>, + type_list: InternedSet<'tcx, List>>, substs: InternedSet<'tcx, Substs<'tcx>>, - canonical_var_infos: InternedSet<'tcx, Slice>, + canonical_var_infos: InternedSet<'tcx, List>, region: InternedSet<'tcx, RegionKind>, - existential_predicates: InternedSet<'tcx, Slice>>, - predicates: InternedSet<'tcx, Slice>>, + existential_predicates: InternedSet<'tcx, List>>, + predicates: InternedSet<'tcx, List>>, const_: InternedSet<'tcx, Const<'tcx>>, - clauses: InternedSet<'tcx, Slice>>, - goals: InternedSet<'tcx, Slice>>, + clauses: InternedSet<'tcx, List>>, + goals: InternedSet<'tcx, List>>, } impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { @@ -1593,12 +1593,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Goa } } -impl<'a, 'tcx> Lift<'tcx> for &'a Slice> { - type Lifted = &'tcx Slice>; +impl<'a, 'tcx> Lift<'tcx> for &'a List> { + type Lifted = &'tcx List>; fn lift_to_tcx<'b, 'gcx>( &self, tcx: TyCtxt<'b, 'gcx, 'tcx>, - ) -> Option<&'tcx Slice>> { + ) -> Option<&'tcx List>> { if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1611,12 +1611,12 @@ fn lift_to_tcx<'b, 'gcx>( } } -impl<'a, 'tcx> Lift<'tcx> for &'a Slice> { - type Lifted = &'tcx Slice>; +impl<'a, 'tcx> Lift<'tcx> for &'a List> { + type Lifted = &'tcx List>; fn lift_to_tcx<'b, 'gcx>( &self, tcx: TyCtxt<'b, 'gcx, 'tcx>, - ) -> Option<&'tcx Slice>> { + ) -> Option<&'tcx List>> { if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1648,7 +1648,7 @@ impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> { type Lifted = &'tcx Substs<'tcx>; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Substs<'tcx>> { if self.len() == 0 { - return Some(Slice::empty()); + return Some(List::empty()); } if tcx.interners.arena.in_arena(&self[..] as *const _) { return Some(unsafe { mem::transmute(*self) }); @@ -1662,12 +1662,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Sub } } -impl<'a, 'tcx> Lift<'tcx> for &'a Slice> { - type Lifted = &'tcx Slice>; +impl<'a, 'tcx> Lift<'tcx> for &'a List> { + type Lifted = &'tcx List>; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) - -> Option<&'tcx Slice>> { + -> Option<&'tcx List>> { if self.len() == 0 { - return Some(Slice::empty()); + return Some(List::empty()); } if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); @@ -1681,12 +1681,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) } } -impl<'a, 'tcx> Lift<'tcx> for &'a Slice> { - type Lifted = &'tcx Slice>; +impl<'a, 'tcx> Lift<'tcx> for &'a List> { + type Lifted = &'tcx List>; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) - -> Option<&'tcx Slice>> { + -> Option<&'tcx List>> { if self.is_empty() { - return Some(Slice::empty()); + return Some(List::empty()); } if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); @@ -1700,12 +1700,12 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) } } -impl<'a, 'tcx> Lift<'tcx> for &'a Slice> { - type Lifted = &'tcx Slice>; +impl<'a, 'tcx> Lift<'tcx> for &'a List> { + type Lifted = &'tcx List>; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) - -> Option<&'tcx Slice>> { + -> Option<&'tcx List>> { if self.is_empty() { - return Some(Slice::empty()); + return Some(List::empty()); } if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); @@ -1719,11 +1719,11 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) } } -impl<'a, 'tcx> Lift<'tcx> for &'a Slice { - type Lifted = &'tcx Slice; +impl<'a, 'tcx> Lift<'tcx> for &'a List { + type Lifted = &'tcx List; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { if self.len() == 0 { - return Some(Slice::empty()); + return Some(List::empty()); } if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); @@ -2113,28 +2113,28 @@ fn borrow<'a>(&'a self) -> &'a TypeVariants<'lcx> { } } -// NB: An Interned> compares and hashes as its elements. -impl<'tcx, T: PartialEq> PartialEq for Interned<'tcx, Slice> { - fn eq(&self, other: &Interned<'tcx, Slice>) -> bool { +// NB: An Interned> compares and hashes as its elements. +impl<'tcx, T: PartialEq> PartialEq for Interned<'tcx, List> { + fn eq(&self, other: &Interned<'tcx, List>) -> bool { self.0[..] == other.0[..] } } -impl<'tcx, T: Eq> Eq for Interned<'tcx, Slice> {} +impl<'tcx, T: Eq> Eq for Interned<'tcx, List> {} -impl<'tcx, T: Hash> Hash for Interned<'tcx, Slice> { +impl<'tcx, T: Hash> Hash for Interned<'tcx, List> { fn hash(&self, s: &mut H) { self.0[..].hash(s) } } -impl<'tcx: 'lcx, 'lcx> Borrow<[Ty<'lcx>]> for Interned<'tcx, Slice>> { +impl<'tcx: 'lcx, 'lcx> Borrow<[Ty<'lcx>]> for Interned<'tcx, List>> { fn borrow<'a>(&'a self) -> &'a [Ty<'lcx>] { &self.0[..] } } -impl<'tcx: 'lcx, 'lcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, Slice> { +impl<'tcx: 'lcx, 'lcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, List> { fn borrow<'a>(&'a self) -> &'a [CanonicalVarInfo] { &self.0[..] } @@ -2153,14 +2153,14 @@ fn borrow<'a>(&'a self) -> &'a RegionKind { } impl<'tcx: 'lcx, 'lcx> Borrow<[ExistentialPredicate<'lcx>]> - for Interned<'tcx, Slice>> { + for Interned<'tcx, List>> { fn borrow<'a>(&'a self) -> &'a [ExistentialPredicate<'lcx>] { &self.0[..] } } impl<'tcx: 'lcx, 'lcx> Borrow<[Predicate<'lcx>]> - for Interned<'tcx, Slice>> { + for Interned<'tcx, List>> { fn borrow<'a>(&'a self) -> &'a [Predicate<'lcx>] { &self.0[..] } @@ -2173,14 +2173,14 @@ fn borrow<'a>(&'a self) -> &'a Const<'lcx> { } impl<'tcx: 'lcx, 'lcx> Borrow<[Clause<'lcx>]> -for Interned<'tcx, Slice>> { +for Interned<'tcx, List>> { fn borrow<'a>(&'a self) -> &'a [Clause<'lcx>] { &self.0[..] } } impl<'tcx: 'lcx, 'lcx> Borrow<[Goal<'lcx>]> -for Interned<'tcx, Slice>> { +for Interned<'tcx, List>> { fn borrow<'a>(&'a self) -> &'a [Goal<'lcx>] { &self.0[..] } @@ -2274,9 +2274,9 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool { ($($field:ident: $method:ident($ty:ident)),+) => ( $(intern_method!( 'tcx, $field: $method( &[$ty<'tcx>], - |a, v| Slice::from_arena(a, v), + |a, v| List::from_arena(a, v), Deref::deref, - |xs: &[$ty]| xs.iter().any(keep_local)) -> Slice<$ty<'tcx>>);)+ + |xs: &[$ty]| xs.iter().any(keep_local)) -> List<$ty<'tcx>>);)+ ) } @@ -2298,10 +2298,10 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool { 'tcx, canonical_var_infos: _intern_canonical_var_infos( &[CanonicalVarInfo], - |a, v| Slice::from_arena(a, v), + |a, v| List::from_arena(a, v), Deref::deref, |_xs: &[CanonicalVarInfo]| -> bool { false } - ) -> Slice + ) -> List } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { @@ -2480,7 +2480,7 @@ pub fn mk_fn_ptr(self, fty: PolyFnSig<'tcx>) -> Ty<'tcx> { pub fn mk_dynamic( self, - obj: ty::Binder<&'tcx Slice>>, + obj: ty::Binder<&'tcx List>>, reg: ty::Region<'tcx> ) -> Ty<'tcx> { self.mk_ty(TyDynamic(obj, reg)) @@ -2509,7 +2509,7 @@ pub fn mk_generator(self, self.mk_ty(TyGenerator(id, generator_substs, movability)) } - pub fn mk_generator_witness(self, types: ty::Binder<&'tcx Slice>>) -> Ty<'tcx> { + pub fn mk_generator_witness(self, types: ty::Binder<&'tcx List>>) -> Ty<'tcx> { self.mk_ty(TyGeneratorWitness(types)) } @@ -2553,36 +2553,36 @@ pub fn mk_anon(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { } pub fn intern_existential_predicates(self, eps: &[ExistentialPredicate<'tcx>]) - -> &'tcx Slice> { + -> &'tcx List> { assert!(!eps.is_empty()); assert!(eps.windows(2).all(|w| w[0].stable_cmp(self, &w[1]) != Ordering::Greater)); self._intern_existential_predicates(eps) } pub fn intern_predicates(self, preds: &[Predicate<'tcx>]) - -> &'tcx Slice> { + -> &'tcx List> { // FIXME consider asking the input slice to be sorted to avoid // re-interning permutations, in which case that would be asserted // here. if preds.len() == 0 { // The macro-generated method below asserts we don't intern an empty slice. - Slice::empty() + List::empty() } else { self._intern_predicates(preds) } } - pub fn intern_type_list(self, ts: &[Ty<'tcx>]) -> &'tcx Slice> { + pub fn intern_type_list(self, ts: &[Ty<'tcx>]) -> &'tcx List> { if ts.len() == 0 { - Slice::empty() + List::empty() } else { self._intern_type_list(ts) } } - pub fn intern_substs(self, ts: &[Kind<'tcx>]) -> &'tcx Slice> { + pub fn intern_substs(self, ts: &[Kind<'tcx>]) -> &'tcx List> { if ts.len() == 0 { - Slice::empty() + List::empty() } else { self._intern_substs(ts) } @@ -2590,7 +2590,7 @@ pub fn intern_substs(self, ts: &[Kind<'tcx>]) -> &'tcx Slice> { pub fn intern_canonical_var_infos(self, ts: &[CanonicalVarInfo]) -> CanonicalVarInfos<'gcx> { if ts.len() == 0 { - Slice::empty() + List::empty() } else { self.global_tcx()._intern_canonical_var_infos(ts) } @@ -2598,7 +2598,7 @@ pub fn intern_canonical_var_infos(self, ts: &[CanonicalVarInfo]) -> CanonicalVar pub fn intern_clauses(self, ts: &[Clause<'tcx>]) -> Clauses<'tcx> { if ts.len() == 0 { - Slice::empty() + List::empty() } else { self._intern_clauses(ts) } @@ -2606,7 +2606,7 @@ pub fn intern_clauses(self, ts: &[Clause<'tcx>]) -> Clauses<'tcx> { pub fn intern_goals(self, ts: &[Goal<'tcx>]) -> Goals<'tcx> { if ts.len() == 0 { - Slice::empty() + List::empty() } else { self._intern_goals(ts) } @@ -2629,24 +2629,24 @@ pub fn mk_fn_sig(self, } pub fn mk_existential_predicates], - &'tcx Slice>>>(self, iter: I) + &'tcx List>>>(self, iter: I) -> I::Output { iter.intern_with(|xs| self.intern_existential_predicates(xs)) } pub fn mk_predicates], - &'tcx Slice>>>(self, iter: I) + &'tcx List>>>(self, iter: I) -> I::Output { iter.intern_with(|xs| self.intern_predicates(xs)) } pub fn mk_type_list], - &'tcx Slice>>>(self, iter: I) -> I::Output { + &'tcx List>>>(self, iter: I) -> I::Output { iter.intern_with(|xs| self.intern_type_list(xs)) } pub fn mk_substs], - &'tcx Slice>>>(self, iter: I) -> I::Output { + &'tcx List>>>(self, iter: I) -> I::Output { iter.intern_with(|xs| self.intern_substs(xs)) } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index e23034bde7672ff9d1e5260de0c52feb6744c336..5ba697ee79532716331694c5e0fb4e12de3575f1 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -51,7 +51,7 @@ pub enum TypeError<'tcx> { CyclicTy(Ty<'tcx>), ProjectionMismatched(ExpectedFound), ProjectionBoundsLength(ExpectedFound), - ExistentialMismatch(ExpectedFound<&'tcx ty::Slice>>), + ExistentialMismatch(ExpectedFound<&'tcx ty::List>>), OldStyleLUB(Box>), } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 486ed85843cd96eaaa9613f862a3ab74f5e07b16..46fbedb5a2641ae07e3a9224461cd3780a2af80d 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -596,8 +596,8 @@ impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {} pub type CanonicalTy<'gcx> = Canonical<'gcx, Ty<'gcx>>; extern { - /// A dummy type used to force Slice to by unsized without requiring fat pointers - type OpaqueSliceContents; + /// A dummy type used to force List to by unsized without requiring fat pointers + type OpaqueListContents; } /// A wrapper for slices with the additional invariant @@ -605,18 +605,19 @@ impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {} /// the same contents can exist in the same context. /// This means we can use pointer for both /// equality comparisons and hashing. +/// Note: `Slice` was already taken by the `Ty`. #[repr(C)] -pub struct Slice { +pub struct List { len: usize, data: [T; 0], - opaque: OpaqueSliceContents, + opaque: OpaqueListContents, } -unsafe impl Sync for Slice {} +unsafe impl Sync for List {} -impl Slice { +impl List { #[inline] - fn from_arena<'tcx>(arena: &'tcx SyncDroplessArena, slice: &[T]) -> &'tcx Slice { + fn from_arena<'tcx>(arena: &'tcx SyncDroplessArena, slice: &[T]) -> &'tcx List { assert!(!mem::needs_drop::()); assert!(mem::size_of::() != 0); assert!(slice.len() != 0); @@ -633,7 +634,7 @@ fn from_arena<'tcx>(arena: &'tcx SyncDroplessArena, slice: &[T]) -> &'tcx Slice< size, cmp::max(mem::align_of::(), mem::align_of::())); unsafe { - let result = &mut *(mem.as_mut_ptr() as *mut Slice); + let result = &mut *(mem.as_mut_ptr() as *mut List); // Write the length result.len = slice.len(); @@ -646,51 +647,51 @@ fn from_arena<'tcx>(arena: &'tcx SyncDroplessArena, slice: &[T]) -> &'tcx Slice< } } -impl fmt::Debug for Slice { +impl fmt::Debug for List { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) } } -impl Encodable for Slice { +impl Encodable for List { #[inline] fn encode(&self, s: &mut S) -> Result<(), S::Error> { (**self).encode(s) } } -impl Ord for Slice where T: Ord { - fn cmp(&self, other: &Slice) -> Ordering { +impl Ord for List where T: Ord { + fn cmp(&self, other: &List) -> Ordering { if self == other { Ordering::Equal } else { <[T] as Ord>::cmp(&**self, &**other) } } } -impl PartialOrd for Slice where T: PartialOrd { - fn partial_cmp(&self, other: &Slice) -> Option { +impl PartialOrd for List where T: PartialOrd { + fn partial_cmp(&self, other: &List) -> Option { if self == other { Some(Ordering::Equal) } else { <[T] as PartialOrd>::partial_cmp(&**self, &**other) } } } -impl PartialEq for Slice { +impl PartialEq for List { #[inline] - fn eq(&self, other: &Slice) -> bool { + fn eq(&self, other: &List) -> bool { ptr::eq(self, other) } } -impl Eq for Slice {} +impl Eq for List {} -impl Hash for Slice { +impl Hash for List { #[inline] fn hash(&self, s: &mut H) { - (self as *const Slice).hash(s) + (self as *const List).hash(s) } } -impl Deref for Slice { +impl Deref for List { type Target = [T]; #[inline(always)] fn deref(&self) -> &[T] { @@ -700,7 +701,7 @@ fn deref(&self) -> &[T] { } } -impl<'a, T> IntoIterator for &'a Slice { +impl<'a, T> IntoIterator for &'a List { type Item = &'a T; type IntoIter = <&'a [T] as IntoIterator>::IntoIter; #[inline(always)] @@ -709,17 +710,17 @@ fn into_iter(self) -> Self::IntoIter { } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Slice> {} +impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List> {} -impl Slice { +impl List { #[inline(always)] - pub fn empty<'a>() -> &'a Slice { + pub fn empty<'a>() -> &'a List { #[repr(align(64), C)] struct EmptySlice([u8; 64]); static EMPTY_SLICE: EmptySlice = EmptySlice([0; 64]); assert!(mem::align_of::() <= 64); unsafe { - &*(&EMPTY_SLICE as *const _ as *const Slice) + &*(&EMPTY_SLICE as *const _ as *const List) } } } @@ -1556,7 +1557,7 @@ pub struct ParamEnv<'tcx> { /// Obligations that the caller must satisfy. This is basically /// the set of bounds on the in-scope type parameters, translated /// into Obligations, and elaborated and normalized. - pub caller_bounds: &'tcx Slice>, + pub caller_bounds: &'tcx List>, /// Typically, this is `Reveal::UserFacing`, but during codegen we /// want `Reveal::All` -- note that this is always paired with an @@ -1570,7 +1571,7 @@ impl<'tcx> ParamEnv<'tcx> { /// Trait`) are left hidden, so this is suitable for ordinary /// type-checking. pub fn empty() -> Self { - Self::new(ty::Slice::empty(), Reveal::UserFacing) + Self::new(List::empty(), Reveal::UserFacing) } /// Construct a trait environment with no where clauses in scope @@ -1581,11 +1582,11 @@ pub fn empty() -> Self { /// NB. If you want to have predicates in scope, use `ParamEnv::new`, /// or invoke `param_env.with_reveal_all()`. pub fn reveal_all() -> Self { - Self::new(ty::Slice::empty(), Reveal::All) + Self::new(List::empty(), Reveal::All) } /// Construct a trait environment with the given set of predicates. - pub fn new(caller_bounds: &'tcx ty::Slice>, + pub fn new(caller_bounds: &'tcx List>, reveal: Reveal) -> Self { ty::ParamEnv { caller_bounds, reveal } @@ -1603,7 +1604,7 @@ pub fn with_reveal_all(self) -> Self { /// Returns this same environment but with no caller bounds. pub fn without_caller_bounds(self) -> Self { - ty::ParamEnv { caller_bounds: ty::Slice::empty(), ..self } + ty::ParamEnv { caller_bounds: List::empty(), ..self } } /// Creates a suitable environment in which to perform trait diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 4e8f33d6a4a0324ded1ee685a1392138c057dc3b..85f72203da81765de51f50ffd9c8f5212c4e760d 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -316,7 +316,7 @@ fn relate<'a, 'gcx, R>(relation: &mut R, } #[derive(Debug, Clone)] -struct GeneratorWitness<'tcx>(&'tcx ty::Slice>); +struct GeneratorWitness<'tcx>(&'tcx ty::List>); TupleStructTypeFoldableImpl! { impl<'tcx> TypeFoldable<'tcx> for GeneratorWitness<'tcx> { @@ -578,7 +578,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, } } -impl<'tcx> Relate<'tcx> for &'tcx ty::Slice> { +impl<'tcx> Relate<'tcx> for &'tcx ty::List> { fn relate<'a, 'gcx, R>(relation: &mut R, a: &Self, b: &Self) diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index ad29f808285b1ae99d9b6cf3f993b546830e57b1..9fad583050f3b6eec33f81f8df3acdf7e90f7457 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -735,7 +735,7 @@ fn visit_with>(&self, visitor: &mut V) -> bool { impl<'tcx> TypeFoldable<'tcx> for ty::ParamEnv<'tcx> { reveal, caller_bounds } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Slice> { +impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let v = self.iter().map(|p| p.fold_with(folder)).collect::>(); folder.tcx().intern_existential_predicates(&v) @@ -754,7 +754,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::ExistentialPredicate<'tcx> { } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Slice> { +impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let v = self.iter().map(|t| t.fold_with(folder)).collect::>(); folder.tcx().intern_type_list(&v) @@ -1010,7 +1010,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::GenericPredicates<'tcx> { } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Slice> { +impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let v = self.iter().map(|p| p.fold_with(folder)).collect::>(); folder.tcx().intern_predicates(&v) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 7c0857cd2f99885d8d2e0ab1956400a6a9e702db..c0c435ae80a068446d3cf2eb2d529eb322645a1c 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -18,7 +18,7 @@ use rustc_data_structures::indexed_vec::Idx; use ty::subst::{Substs, Subst, Kind, UnpackedKind}; use ty::{self, AdtDef, TypeFlags, Ty, TyCtxt, TypeFoldable}; -use ty::{Slice, TyS, ParamEnvAnd, ParamEnv}; +use ty::{List, TyS, ParamEnvAnd, ParamEnv}; use util::captures::Captures; use mir::interpret::{Scalar, Pointer}; @@ -133,7 +133,7 @@ pub enum TypeVariants<'tcx> { TyFnPtr(PolyFnSig<'tcx>), /// A trait, defined with `trait`. - TyDynamic(Binder<&'tcx Slice>>, ty::Region<'tcx>), + TyDynamic(Binder<&'tcx List>>, ty::Region<'tcx>), /// The anonymous type of a closure. Used to represent the type of /// `|a| a`. @@ -145,13 +145,13 @@ pub enum TypeVariants<'tcx> { /// A type representin the types stored inside a generator. /// This should only appear in GeneratorInteriors. - TyGeneratorWitness(Binder<&'tcx Slice>>), + TyGeneratorWitness(Binder<&'tcx List>>), /// The never type `!` TyNever, /// A tuple type. For example, `(i32, bool)`. - TyTuple(&'tcx Slice>), + TyTuple(&'tcx List>), /// The projection of an associated type. For example, /// `>::N`. @@ -536,9 +536,9 @@ pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>) } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Slice> {} +impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List> {} -impl<'tcx> Slice> { +impl<'tcx> List> { pub fn principal(&self) -> Option> { match self.get(0) { Some(&ExistentialPredicate::Trait(tr)) => Some(tr), @@ -568,7 +568,7 @@ pub fn auto_traits<'a>(&'a self) -> impl Iterator + 'a { } } -impl<'tcx> Binder<&'tcx Slice>> { +impl<'tcx> Binder<&'tcx List>> { pub fn principal(&self) -> Option> { self.skip_binder().principal().map(Binder::bind) } @@ -918,7 +918,7 @@ pub fn return_ty(&self) -> ty::Binder> { /// - `variadic` indicates whether this is a variadic function. (only true for foreign fns) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub struct FnSig<'tcx> { - pub inputs_and_output: &'tcx Slice>, + pub inputs_and_output: &'tcx List>, pub variadic: bool, pub unsafety: hir::Unsafety, pub abi: abi::Abi, @@ -943,7 +943,7 @@ pub fn inputs(&self) -> Binder<&'tcx [Ty<'tcx>]> { pub fn input(&self, index: usize) -> ty::Binder> { self.map_bound_ref(|fn_sig| fn_sig.inputs()[index]) } - pub fn inputs_and_output(&self) -> ty::Binder<&'tcx Slice>> { + pub fn inputs_and_output(&self) -> ty::Binder<&'tcx List>> { self.map_bound_ref(|fn_sig| fn_sig.inputs_and_output) } pub fn output(&self) -> ty::Binder> { diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index a6ff979f472af46bd7b4ee1c677e7237510237a0..f76411da4581684fe7592c3a4c5130119c5b6c74 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -11,7 +11,7 @@ // Type substitutions. use hir::def_id::DefId; -use ty::{self, Lift, Slice, Ty, TyCtxt}; +use ty::{self, Lift, List, Ty, TyCtxt}; use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use serialize::{self, Encodable, Encoder, Decodable, Decoder}; @@ -177,7 +177,7 @@ fn decode(d: &mut D) -> Result, D::Error> { } /// A substitution mapping generic parameters to new values. -pub type Substs<'tcx> = Slice>; +pub type Substs<'tcx> = List>; impl<'a, 'gcx, 'tcx> Substs<'tcx> { /// Creates a Substs that maps each generic parameter to itself. diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index b99cdd59773aa71f18dfbf97332e4eed4c11a8a8..d97553d62515e66342116c10319701bd0d989a81 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -453,7 +453,7 @@ fn nominal_obligations(&mut self, } fn from_object_ty(&mut self, ty: Ty<'tcx>, - data: ty::Binder<&'tcx ty::Slice>>, + data: ty::Binder<&'tcx ty::List>>, region: ty::Region<'tcx>) { // Imagine a type like this: // @@ -513,7 +513,7 @@ fn from_object_ty(&mut self, ty: Ty<'tcx>, /// `ty::required_region_bounds`, see that for more information. pub fn object_region_bounds<'a, 'gcx, 'tcx>( tcx: TyCtxt<'a, 'gcx, 'tcx>, - existential_predicates: ty::Binder<&'tcx ty::Slice>>) + existential_predicates: ty::Binder<&'tcx ty::List>>) -> Vec> { // Since we don't actually *know* the self type for an object, diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 9513086667b28abf082a8a7c2f531baaff057fa0..964a65065bc2c2da33cf3281efef5ae2cad3d6bb 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -586,7 +586,7 @@ fn print(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result } define_print! { - ('tcx) &'tcx ty::Slice>, (self, f, cx) { + ('tcx) &'tcx ty::List>, (self, f, cx) { display { // Generate the main trait ref, including associated types. ty::tls::with(|tcx| { @@ -672,7 +672,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } define_print! { - ('tcx) &'tcx ty::Slice>, (self, f, cx) { + ('tcx) &'tcx ty::List>, (self, f, cx) { display { write!(f, "{{")?; let mut tys = self.iter(); @@ -993,7 +993,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { define_print_multi! { [ - ('tcx) ty::Binder<&'tcx ty::Slice>>, + ('tcx) ty::Binder<&'tcx ty::List>>, ('tcx) ty::Binder>, ('tcx) ty::Binder>, ('tcx) ty::Binder>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs index ac9bf65b61b0fb9b80dc43d1ba2ddac73226c9cc..2509ad5c906b3db0c57a34f6fe6cadfe884242ce 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs @@ -36,7 +36,7 @@ pub(super) fn sub_types<'tcx>( ty::Variance::Covariant, locations, borrowck_context, - ty::Slice::empty(), + ty::List::empty(), ).relate(&a, &b)?; Ok(()) } @@ -54,7 +54,7 @@ pub(super) fn eq_types<'tcx>( ty::Variance::Invariant, locations, borrowck_context, - ty::Slice::empty(), + ty::List::empty(), ).relate(&a, &b)?; Ok(()) } diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 765c4cf906e68a4c4a89ba524e52317df654d88d..cd75cf549572b8ed81f2f868d11c2d9c6f4a3ce6 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -506,7 +506,7 @@ fn compute_inputs_and_output( &self, indices: &UniversalRegionIndices<'tcx>, defining_ty: DefiningTy<'tcx>, - ) -> ty::Binder<&'tcx ty::Slice>> { + ) -> ty::Binder<&'tcx ty::List>> { let tcx = self.infcx.tcx; match defining_ty { DefiningTy::Closure(def_id, substs) => { diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 83cd7bf549d5536904e82bdc31cd01c16dcc3a53..acad0a1fa2c4ec522766309dbc51b6c98bb6036b 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -13,7 +13,7 @@ use rustc::hir::def_id::DefId; use rustc::middle::lang_items::LangItem; use rustc::mir::*; -use rustc::ty::{Slice, Ty, TyCtxt, TypeVariants}; +use rustc::ty::{List, Ty, TyCtxt, TypeVariants}; use rustc_data_structures::indexed_vec::{Idx}; use transform::{MirPass, MirSource}; use syntax; @@ -114,7 +114,7 @@ fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir< source_info, kind: TerminatorKind::Call { func: Operand::function_handle(tcx, call_did, - Slice::empty(), source_info.span), + List::empty(), source_info.span), args: vec![lhs, rhs], destination: Some((place, bb)), cleanup: None, diff --git a/src/librustc_traits/lowering.rs b/src/librustc_traits/lowering.rs index a3c24f8af22fc5b3ae72c5a9aa363e400b98749a..9fd3b318ec14038ef7ff1bf9c5b81b5badcc1125 100644 --- a/src/librustc_traits/lowering.rs +++ b/src/librustc_traits/lowering.rs @@ -17,7 +17,7 @@ WhereClause, }; use rustc::ty::query::Providers; -use rustc::ty::{self, Slice, TyCtxt}; +use rustc::ty::{self, List, TyCtxt}; use rustc_data_structures::fx::FxHashSet; use std::mem; use syntax::ast; @@ -162,7 +162,7 @@ fn into_well_formed_goal(self) -> DomainGoal<'tcx> { DefPathData::AssocTypeInImpl(..) => program_clauses_for_associated_type_value(tcx, def_id), DefPathData::AssocTypeInTrait(..) => program_clauses_for_associated_type_def(tcx, def_id), DefPathData::TypeNs(..) => program_clauses_for_type_def(tcx, def_id), - _ => Slice::empty(), + _ => List::empty(), } } @@ -319,7 +319,7 @@ fn program_clauses_for_trait<'a, 'tcx>( fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { if let ImplPolarity::Negative = tcx.impl_polarity(def_id) { - return Slice::empty(); + return List::empty(); } // Rule Implemented-From-Impl (see rustc guide) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index ccdb751bc4eeda4eb743283bd6104768313f215b..9624fc36e0eada9d06d78ebdc994ef6b5ec98834 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1666,7 +1666,7 @@ pub fn ty_of_fn(&self, /// we return `None`. fn compute_object_lifetime_bound(&self, span: Span, - existential_predicates: ty::Binder<&'tcx ty::Slice>>) + existential_predicates: ty::Binder<&'tcx ty::List>>) -> Option> // if None, use the default { let tcx = self.tcx();