Skip to content

Commit 9a0af16

Browse files
committed
rustc: remove unused bounds field from RegionParameterDef.
1 parent 4eac052 commit 9a0af16

File tree

6 files changed

+12
-38
lines changed

6 files changed

+12
-38
lines changed

src/librustc/ty/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -606,20 +606,19 @@ pub struct TypeParameterDef<'tcx> {
606606
pub pure_wrt_drop: bool,
607607
}
608608

609-
#[derive(Clone, RustcEncodable, RustcDecodable)]
610-
pub struct RegionParameterDef<'tcx> {
609+
#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
610+
pub struct RegionParameterDef {
611611
pub name: Name,
612612
pub def_id: DefId,
613613
pub index: u32,
614-
pub bounds: Vec<&'tcx ty::Region>,
615614

616615
/// `pure_wrt_drop`, set by the (unsafe) `#[may_dangle]` attribute
617616
/// on generic parameter `'a`, asserts data of lifetime `'a`
618617
/// won't be accessed during the parent type's `Drop` impl.
619618
pub pure_wrt_drop: bool,
620619
}
621620

622-
impl<'tcx> RegionParameterDef<'tcx> {
621+
impl RegionParameterDef {
623622
pub fn to_early_bound_region_data(&self) -> ty::EarlyBoundRegion {
624623
ty::EarlyBoundRegion {
625624
index: self.index,
@@ -640,7 +639,7 @@ pub struct Generics<'tcx> {
640639
pub parent: Option<DefId>,
641640
pub parent_regions: u32,
642641
pub parent_types: u32,
643-
pub regions: Vec<RegionParameterDef<'tcx>>,
642+
pub regions: Vec<RegionParameterDef>,
644643
pub types: Vec<TypeParameterDef<'tcx>>,
645644
pub has_self: bool,
646645
}
@@ -658,7 +657,7 @@ impl<'tcx> Generics<'tcx> {
658657
self.parent_count() + self.own_count()
659658
}
660659

661-
pub fn region_param(&self, param: &EarlyBoundRegion) -> &RegionParameterDef<'tcx> {
660+
pub fn region_param(&self, param: &EarlyBoundRegion) -> &RegionParameterDef {
662661
&self.regions[param.index as usize - self.has_self as usize]
663662
}
664663

src/librustc/ty/structural_impls.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ macro_rules! CopyImpls {
353353
}
354354
}
355355

356-
CopyImpls! { (), hir::Unsafety, abi::Abi }
356+
CopyImpls! { (), hir::Unsafety, abi::Abi, ty::RegionParameterDef }
357357

358358
impl<'tcx, T:TypeFoldable<'tcx>, U:TypeFoldable<'tcx>> TypeFoldable<'tcx> for (T, U) {
359359
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> (T, U) {
@@ -735,22 +735,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::TypeParameterDef<'tcx> {
735735
}
736736
}
737737

738-
impl<'tcx> TypeFoldable<'tcx> for ty::RegionParameterDef<'tcx> {
739-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
740-
ty::RegionParameterDef {
741-
name: self.name,
742-
def_id: self.def_id,
743-
index: self.index,
744-
bounds: self.bounds.fold_with(folder),
745-
pure_wrt_drop: self.pure_wrt_drop,
746-
}
747-
}
748-
749-
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
750-
self.bounds.visit_with(visitor)
751-
}
752-
}
753-
754738
impl<'tcx> TypeFoldable<'tcx> for ty::Generics<'tcx> {
755739
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
756740
ty::Generics {

src/librustc/util/ppaux.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,12 @@ impl<'tcx> fmt::Debug for ty::TypeParameterDef<'tcx> {
336336
}
337337
}
338338

339-
impl<'tcx> fmt::Debug for ty::RegionParameterDef<'tcx> {
339+
impl fmt::Debug for ty::RegionParameterDef {
340340
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
341-
write!(f, "RegionParameterDef({}, {:?}, {}, {:?})",
341+
write!(f, "RegionParameterDef({}, {:?}, {})",
342342
self.name,
343343
self.def_id,
344-
self.index,
345-
self.bounds)
344+
self.index)
346345
}
347346
}
348347

src/librustc_metadata/schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub struct Generics<'tcx> {
256256
pub parent: Option<DefId>,
257257
pub parent_regions: u32,
258258
pub parent_types: u32,
259-
pub regions: LazySeq<ty::RegionParameterDef<'tcx>>,
259+
pub regions: LazySeq<ty::RegionParameterDef>,
260260
pub types: LazySeq<ty::TypeParameterDef<'tcx>>,
261261
pub has_self: bool,
262262
pub object_lifetime_defaults: LazySeq<ObjectLifetimeDefault>,

src/librustc_typeck/collect.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,6 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
14461446
name: l.lifetime.name,
14471447
index: own_start + i as u32,
14481448
def_id: tcx.hir.local_def_id(l.lifetime.id),
1449-
bounds: l.bounds.iter().map(|l| {
1450-
AstConv::ast_region_to_region(&ccx.icx(&()), l, None)
1451-
}).collect(),
14521449
pure_wrt_drop: l.pure_wrt_drop,
14531450
}
14541451
}).collect::<Vec<_>>();

src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ impl Clean<Lifetime> for hir::LifetimeDef {
794794
}
795795
}
796796

797-
impl<'tcx> Clean<Lifetime> for ty::RegionParameterDef<'tcx> {
797+
impl Clean<Lifetime> for ty::RegionParameterDef {
798798
fn clean(&self, _: &DocContext) -> Lifetime {
799799
Lifetime(self.name.to_string())
800800
}
@@ -970,11 +970,6 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>,
970970
Some(tp.clean(cx))
971971
}
972972
}).collect::<Vec<_>>();
973-
let stripped_lifetimes = gens.regions.iter().map(|rp| {
974-
let mut srp = rp.clone();
975-
srp.bounds = Vec::new();
976-
srp.clean(cx)
977-
}).collect::<Vec<_>>();
978973

979974
let mut where_predicates = preds.predicates.to_vec().clean(cx);
980975

@@ -1017,7 +1012,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>,
10171012

10181013
Generics {
10191014
type_params: simplify::ty_params(stripped_typarams),
1020-
lifetimes: stripped_lifetimes,
1015+
lifetimes: gens.regions.clean(cx),
10211016
where_predicates: simplify::where_clauses(cx, where_predicates),
10221017
}
10231018
}

0 commit comments

Comments
 (0)