Skip to content

Commit c5a7e57

Browse files
committed
Remove Projection and impl stablehash for Place with macro
1 parent b1dbe6f commit c5a7e57

File tree

2 files changed

+1
-65
lines changed

2 files changed

+1
-65
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -309,37 +309,7 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::PlaceBase<'gcx> {
309309
}
310310
}
311311

312-
impl<'a, 'tcx> HashStable<StableHashingContext<'a>>
313-
for mir::Place<'tcx>
314-
{
315-
fn hash_stable<W: StableHasherResult>(
316-
&self,
317-
hcx: &mut StableHashingContext<'a>,
318-
hasher: &mut StableHasher<W>,
319-
) {
320-
self.base.hash_stable(hcx, hasher);
321-
self.elems.hash_stable(hcx, hasher);
322-
}
323-
}
324-
325-
impl<'a, 'gcx, B, V, T> HashStable<StableHashingContext<'a>>
326-
for mir::Projection<'gcx, B, V, T>
327-
where B: HashStable<StableHashingContext<'a>>,
328-
V: HashStable<StableHashingContext<'a>>,
329-
T: HashStable<StableHashingContext<'a>>
330-
{
331-
fn hash_stable<W: StableHasherResult>(&self,
332-
hcx: &mut StableHashingContext<'a>,
333-
hasher: &mut StableHasher<W>) {
334-
let mir::Projection {
335-
ref base,
336-
ref elem,
337-
} = *self;
338-
339-
base.hash_stable(hcx, hasher);
340-
elem.hash_stable(hcx, hasher);
341-
}
342-
}
312+
impl_stable_hash_for!(struct mir::Place<'tcx> { base, elems} );
343313

344314
impl<'a, 'gcx, V, T> HashStable<StableHashingContext<'a>>
345315
for mir::ProjectionElem<'gcx, V, T>

src/librustc/mir/mod.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,16 +1727,6 @@ impl_stable_hash_for!(struct Static<'tcx> {
17271727
ty
17281728
});
17291729

1730-
/// The `Projection` data structure defines things of the form `B.x`
1731-
/// or `*B` or `B[index]`. Note that it is parameterized because it is
1732-
/// shared between `Constant` and `Place`. See the aliases
1733-
/// `PlaceProjection` etc below.
1734-
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
1735-
pub struct Projection<'tcx, B, V, T> {
1736-
pub base: B,
1737-
pub elem: ProjectionElem<'tcx, V, T>,
1738-
}
1739-
17401730
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
17411731
pub enum ProjectionElem<'tcx, V, T> {
17421732
Deref,
@@ -1775,10 +1765,6 @@ pub enum ProjectionElem<'tcx, V, T> {
17751765
Downcast(&'tcx AdtDef, usize),
17761766
}
17771767

1778-
/// Alias for projections as they appear in places, where the base is a place
1779-
/// and the index is a local.
1780-
pub type PlaceProjection<'tcx> = Projection<'tcx, Place<'tcx>, Local, Ty<'tcx>>;
1781-
17821768
/// Alias for projections as they appear in places, where the base is a place
17831769
/// and the index is a local.
17841770
pub type PlaceElem<'tcx> = ProjectionElem<'tcx, Local, Ty<'tcx>>;
@@ -2950,26 +2936,6 @@ impl<'tcx, V, T> TypeFoldable<'tcx> for ProjectionElem<'tcx, V, T>
29502936
}
29512937
}
29522938

2953-
impl<'tcx, B, V, T> TypeFoldable<'tcx> for Projection<'tcx, B, V, T>
2954-
where
2955-
B: TypeFoldable<'tcx>,
2956-
V: TypeFoldable<'tcx>,
2957-
T: TypeFoldable<'tcx>,
2958-
{
2959-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
2960-
2961-
let base = self.base.fold_with(folder);
2962-
let elem = self.elem.fold_with(folder);
2963-
Projection { base, elem }
2964-
}
2965-
2966-
fn super_visit_with<Vs: TypeVisitor<'tcx>>(&self, visitor: &mut Vs) -> bool {
2967-
2968-
self.base.visit_with(visitor) ||
2969-
self.elem.visit_with(visitor)
2970-
}
2971-
}
2972-
29732939
impl<'tcx> TypeFoldable<'tcx> for Field {
29742940
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, _: &mut F) -> Self {
29752941
*self

0 commit comments

Comments
 (0)