mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rustc: remove unused bounds
field from RegionParameterDef
.
This commit is contained in:
parent
4eac052a33
commit
9a0af1638a
@ -606,12 +606,11 @@ pub struct TypeParameterDef<'tcx> {
|
|||||||
pub pure_wrt_drop: bool,
|
pub pure_wrt_drop: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct RegionParameterDef<'tcx> {
|
pub struct RegionParameterDef {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
pub bounds: Vec<&'tcx ty::Region>,
|
|
||||||
|
|
||||||
/// `pure_wrt_drop`, set by the (unsafe) `#[may_dangle]` attribute
|
/// `pure_wrt_drop`, set by the (unsafe) `#[may_dangle]` attribute
|
||||||
/// on generic parameter `'a`, asserts data of lifetime `'a`
|
/// on generic parameter `'a`, asserts data of lifetime `'a`
|
||||||
@ -619,7 +618,7 @@ pub struct RegionParameterDef<'tcx> {
|
|||||||
pub pure_wrt_drop: bool,
|
pub pure_wrt_drop: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> RegionParameterDef<'tcx> {
|
impl RegionParameterDef {
|
||||||
pub fn to_early_bound_region_data(&self) -> ty::EarlyBoundRegion {
|
pub fn to_early_bound_region_data(&self) -> ty::EarlyBoundRegion {
|
||||||
ty::EarlyBoundRegion {
|
ty::EarlyBoundRegion {
|
||||||
index: self.index,
|
index: self.index,
|
||||||
@ -640,7 +639,7 @@ pub struct Generics<'tcx> {
|
|||||||
pub parent: Option<DefId>,
|
pub parent: Option<DefId>,
|
||||||
pub parent_regions: u32,
|
pub parent_regions: u32,
|
||||||
pub parent_types: u32,
|
pub parent_types: u32,
|
||||||
pub regions: Vec<RegionParameterDef<'tcx>>,
|
pub regions: Vec<RegionParameterDef>,
|
||||||
pub types: Vec<TypeParameterDef<'tcx>>,
|
pub types: Vec<TypeParameterDef<'tcx>>,
|
||||||
pub has_self: bool,
|
pub has_self: bool,
|
||||||
}
|
}
|
||||||
@ -658,7 +657,7 @@ impl<'tcx> Generics<'tcx> {
|
|||||||
self.parent_count() + self.own_count()
|
self.parent_count() + self.own_count()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn region_param(&self, param: &EarlyBoundRegion) -> &RegionParameterDef<'tcx> {
|
pub fn region_param(&self, param: &EarlyBoundRegion) -> &RegionParameterDef {
|
||||||
&self.regions[param.index as usize - self.has_self as usize]
|
&self.regions[param.index as usize - self.has_self as usize]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ macro_rules! CopyImpls {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyImpls! { (), hir::Unsafety, abi::Abi }
|
CopyImpls! { (), hir::Unsafety, abi::Abi, ty::RegionParameterDef }
|
||||||
|
|
||||||
impl<'tcx, T:TypeFoldable<'tcx>, U:TypeFoldable<'tcx>> TypeFoldable<'tcx> for (T, U) {
|
impl<'tcx, T:TypeFoldable<'tcx>, U:TypeFoldable<'tcx>> TypeFoldable<'tcx> for (T, U) {
|
||||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> (T, U) {
|
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> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<'tcx> for ty::RegionParameterDef<'tcx> {
|
|
||||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
|
||||||
ty::RegionParameterDef {
|
|
||||||
name: self.name,
|
|
||||||
def_id: self.def_id,
|
|
||||||
index: self.index,
|
|
||||||
bounds: self.bounds.fold_with(folder),
|
|
||||||
pure_wrt_drop: self.pure_wrt_drop,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
|
||||||
self.bounds.visit_with(visitor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<'tcx> for ty::Generics<'tcx> {
|
impl<'tcx> TypeFoldable<'tcx> for ty::Generics<'tcx> {
|
||||||
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
|
||||||
ty::Generics {
|
ty::Generics {
|
||||||
|
@ -336,13 +336,12 @@ impl<'tcx> fmt::Debug for ty::TypeParameterDef<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> fmt::Debug for ty::RegionParameterDef<'tcx> {
|
impl fmt::Debug for ty::RegionParameterDef {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "RegionParameterDef({}, {:?}, {}, {:?})",
|
write!(f, "RegionParameterDef({}, {:?}, {})",
|
||||||
self.name,
|
self.name,
|
||||||
self.def_id,
|
self.def_id,
|
||||||
self.index,
|
self.index)
|
||||||
self.bounds)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ pub struct Generics<'tcx> {
|
|||||||
pub parent: Option<DefId>,
|
pub parent: Option<DefId>,
|
||||||
pub parent_regions: u32,
|
pub parent_regions: u32,
|
||||||
pub parent_types: u32,
|
pub parent_types: u32,
|
||||||
pub regions: LazySeq<ty::RegionParameterDef<'tcx>>,
|
pub regions: LazySeq<ty::RegionParameterDef>,
|
||||||
pub types: LazySeq<ty::TypeParameterDef<'tcx>>,
|
pub types: LazySeq<ty::TypeParameterDef<'tcx>>,
|
||||||
pub has_self: bool,
|
pub has_self: bool,
|
||||||
pub object_lifetime_defaults: LazySeq<ObjectLifetimeDefault>,
|
pub object_lifetime_defaults: LazySeq<ObjectLifetimeDefault>,
|
||||||
|
@ -1446,9 +1446,6 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
|||||||
name: l.lifetime.name,
|
name: l.lifetime.name,
|
||||||
index: own_start + i as u32,
|
index: own_start + i as u32,
|
||||||
def_id: tcx.hir.local_def_id(l.lifetime.id),
|
def_id: tcx.hir.local_def_id(l.lifetime.id),
|
||||||
bounds: l.bounds.iter().map(|l| {
|
|
||||||
AstConv::ast_region_to_region(&ccx.icx(&()), l, None)
|
|
||||||
}).collect(),
|
|
||||||
pure_wrt_drop: l.pure_wrt_drop,
|
pure_wrt_drop: l.pure_wrt_drop,
|
||||||
}
|
}
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
|
@ -794,7 +794,7 @@ impl Clean<Lifetime> for hir::LifetimeDef {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Clean<Lifetime> for ty::RegionParameterDef<'tcx> {
|
impl Clean<Lifetime> for ty::RegionParameterDef {
|
||||||
fn clean(&self, _: &DocContext) -> Lifetime {
|
fn clean(&self, _: &DocContext) -> Lifetime {
|
||||||
Lifetime(self.name.to_string())
|
Lifetime(self.name.to_string())
|
||||||
}
|
}
|
||||||
@ -970,11 +970,6 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>,
|
|||||||
Some(tp.clean(cx))
|
Some(tp.clean(cx))
|
||||||
}
|
}
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
let stripped_lifetimes = gens.regions.iter().map(|rp| {
|
|
||||||
let mut srp = rp.clone();
|
|
||||||
srp.bounds = Vec::new();
|
|
||||||
srp.clean(cx)
|
|
||||||
}).collect::<Vec<_>>();
|
|
||||||
|
|
||||||
let mut where_predicates = preds.predicates.to_vec().clean(cx);
|
let mut where_predicates = preds.predicates.to_vec().clean(cx);
|
||||||
|
|
||||||
@ -1017,7 +1012,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics<'tcx>,
|
|||||||
|
|
||||||
Generics {
|
Generics {
|
||||||
type_params: simplify::ty_params(stripped_typarams),
|
type_params: simplify::ty_params(stripped_typarams),
|
||||||
lifetimes: stripped_lifetimes,
|
lifetimes: gens.regions.clean(cx),
|
||||||
where_predicates: simplify::where_clauses(cx, where_predicates),
|
where_predicates: simplify::where_clauses(cx, where_predicates),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user