Skip to content

Commit 299a722

Browse files
committed
rustc: combine ty::{ParamTy, EarlyBoundRegion} into GenericParam.
1 parent d337a3b commit 299a722

35 files changed

+71
-85
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ for ty::RegionKind {
114114
ty::ReLateBound(db, ty::BrEnv) => {
115115
db.hash_stable(hcx, hasher);
116116
}
117-
ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index }) => {
117+
ty::ReEarlyBound(ty::GenericParam { def_id, index }) => {
118118
def_id.hash_stable(hcx, hasher);
119119
index.hash_stable(hcx, hasher);
120120
}
@@ -935,8 +935,8 @@ for ty::FloatVid
935935
}
936936
}
937937

938-
impl_stable_hash_for!(struct ty::ParamTy {
939-
idx,
938+
impl_stable_hash_for!(struct ty::GenericParam {
939+
index,
940940
def_id
941941
});
942942

src/librustc/infer/outlives/obligations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ where
330330
&mut self,
331331
origin: infer::SubregionOrigin<'tcx>,
332332
region: ty::Region<'tcx>,
333-
param_ty: ty::ParamTy,
333+
param_ty: ty::GenericParam,
334334
) {
335335
debug!(
336336
"param_ty_must_outlive(region={:?}, param_ty={:?}, origin={:?})",
@@ -459,7 +459,7 @@ where
459459
}
460460
}
461461

462-
fn param_bound(&self, param_ty: ty::ParamTy) -> VerifyBound<'tcx> {
462+
fn param_bound(&self, param_ty: ty::GenericParam) -> VerifyBound<'tcx> {
463463
debug!("param_bound(param_ty={:?})", param_ty);
464464

465465
let mut param_bounds = self.declared_generic_bounds_from_env(GenericKind::Param(param_ty));

src/librustc/infer/region_constraints/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub struct Verify<'tcx> {
151151

152152
#[derive(Copy, Clone, PartialEq, Eq)]
153153
pub enum GenericKind<'tcx> {
154-
Param(ty::ParamTy),
154+
Param(ty::GenericParam),
155155
Projection(ty::ProjectionTy<'tcx>),
156156
}
157157

src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl<'tcx> ScopeTree {
720720
/// Assuming that the provided region was defined within this `ScopeTree`,
721721
/// returns the outermost `Scope` that the region outlives.
722722
pub fn early_free_scope<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
723-
br: &ty::EarlyBoundRegion)
723+
br: &ty::GenericParam)
724724
-> Scope {
725725
let param_owner = tcx.parent_def_id(br.def_id).unwrap();
726726

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
13481348
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx }
13491349

13501350
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
1351-
if let ty::Param(ty::ParamTy {def_id, ..}) = ty.sty {
1351+
if let ty::Param(ty::GenericParam {def_id, ..}) = ty.sty {
13521352
let infcx = self.infcx;
13531353
self.var_map.entry(ty).or_insert_with(||
13541354
infcx.next_ty_var(

src/librustc/traits/query/outlives_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use std::mem;
3131
#[derive(Clone, Debug)]
3232
pub enum OutlivesBound<'tcx> {
3333
RegionSubRegion(ty::Region<'tcx>, ty::Region<'tcx>),
34-
RegionSubParam(ty::Region<'tcx>, ty::ParamTy),
34+
RegionSubParam(ty::Region<'tcx>, ty::GenericParam),
3535
RegionSubProjection(ty::Region<'tcx>, ty::ProjectionTy<'tcx>),
3636
}
3737

src/librustc/traits/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3073,7 +3073,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
30733073
let mut found = false;
30743074
for ty in field.walk() {
30753075
if let ty::Param(p) = ty.sty {
3076-
ty_params.insert(p.idx as usize);
3076+
ty_params.insert(p.index as usize);
30773077
found = true;
30783078
}
30793079
}

src/librustc/ty/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,15 +2557,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
25572557
}
25582558

25592559
pub fn mk_ty_param(self, def: &ty::GenericParamDef) -> Ty<'tcx> {
2560-
self.mk_ty(ty::Param(ty::ParamTy {
2561-
idx: def.index,
2560+
self.mk_ty(ty::Param(ty::GenericParam {
2561+
index: def.index,
25622562
def_id: def.def_id,
25632563
}))
25642564
}
25652565

25662566
pub fn mk_self_type(self, trait_def_id: DefId) -> Ty<'tcx> {
2567-
self.mk_ty(ty::Param(ty::ParamTy {
2568-
idx: 0,
2567+
self.mk_ty(ty::Param(ty::GenericParam {
2568+
index: 0,
25692569
def_id: trait_def_id,
25702570
}))
25712571
}

src/librustc/ty/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ use hir;
6363

6464
pub use self::sty::{Binder, CanonicalVar, DebruijnIndex, INNERMOST};
6565
pub use self::sty::{FnSig, GenSig, PolyFnSig, PolyGenSig};
66-
pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate};
66+
pub use self::sty::{InferTy, GenericParam, ProjectionTy, ExistentialPredicate};
6767
pub use self::sty::{ClosureSubsts, GeneratorSubsts, UpvarSubsts, TypeAndMut};
6868
pub use self::sty::{TraitRef, TyKind, PolyTraitRef};
6969
pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef};
7070
pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const};
71-
pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region};
71+
pub use self::sty::{BoundRegion, FreeRegion, Region};
7272
pub use self::sty::RegionKind;
7373
pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid};
7474
pub use self::sty::BoundRegion::*;
@@ -819,7 +819,7 @@ pub enum IntVarValue {
819819
#[derive(Clone, Copy, PartialEq, Eq)]
820820
pub struct FloatVarValue(pub ast::FloatTy);
821821

822-
impl ty::EarlyBoundRegion {
822+
impl ty::GenericParam {
823823
pub fn to_bound_region(&self) -> ty::BoundRegion {
824824
ty::BoundRegion::BrNamed(self.def_id)
825825
}
@@ -856,10 +856,10 @@ pub struct GenericParamDef {
856856
}
857857

858858
impl GenericParamDef {
859-
pub fn to_early_bound_region_data(&self) -> ty::EarlyBoundRegion {
859+
pub fn to_early_bound_region_data(&self) -> ty::GenericParam {
860860
match self.kind {
861861
GenericParamDefKind::Lifetime => {
862-
ty::EarlyBoundRegion {
862+
ty::GenericParam {
863863
def_id: self.def_id,
864864
index: self.index,
865865
}
@@ -2657,7 +2657,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
26572657
if let Some(trait_ref) = predicate.to_opt_poly_trait_ref() {
26582658
// Ignore bounds other than those on this parameter.
26592659
match trait_ref.self_ty().sty {
2660-
ty::TyParam(p) if p.def_id == id => {}
2660+
ty::Param(p) if p.def_id == id => {}
26612661
_ => continue,
26622662
}
26632663

src/librustc/ty/outlives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ty::{self, Ty, TyCtxt, TypeFoldable};
1717
#[derive(Debug)]
1818
pub enum Component<'tcx> {
1919
Region(ty::Region<'tcx>),
20-
Param(ty::ParamTy),
20+
Param(ty::GenericParam),
2121
UnresolvedInferenceVariable(ty::InferTy),
2222

2323
// Projections like `T::Foo` are tricky because a constraint like

0 commit comments

Comments
 (0)