Remove redundant ty fields from mir::Constant and hair::pattern::PatternRange.
This commit is contained in:
parent
5a6d801bf9
commit
b565ece5d8
26 changed files with 46 additions and 115 deletions
|
|
@ -2197,7 +2197,6 @@ impl<'tcx> Operand<'tcx> {
|
|||
let ty = tcx.type_of(def_id).subst(tcx, substs);
|
||||
Operand::Constant(box Constant {
|
||||
span,
|
||||
ty,
|
||||
user_ty: None,
|
||||
literal: ty::Const::zero_sized(tcx, ty),
|
||||
})
|
||||
|
|
@ -2476,7 +2475,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)]
|
||||
pub struct Constant<'tcx> {
|
||||
pub span: Span,
|
||||
pub ty: Ty<'tcx>,
|
||||
|
||||
/// Optional user-given type: for something like
|
||||
/// `collect::<Vec<_>>`, this would be present and would
|
||||
|
|
@ -3385,12 +3383,11 @@ impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx> {
|
|||
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
|
||||
Constant {
|
||||
span: self.span.clone(),
|
||||
ty: self.ty.fold_with(folder),
|
||||
user_ty: self.user_ty.fold_with(folder),
|
||||
literal: self.literal.fold_with(folder),
|
||||
}
|
||||
}
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
self.ty.visit_with(visitor) || self.literal.visit_with(visitor)
|
||||
self.literal.visit_with(visitor)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ impl<'tcx> Operand<'tcx> {
|
|||
match self {
|
||||
&Operand::Copy(ref l) |
|
||||
&Operand::Move(ref l) => l.ty(local_decls, tcx).ty,
|
||||
&Operand::Constant(ref c) => c.ty,
|
||||
&Operand::Constant(ref c) => c.literal.ty,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -782,13 +782,11 @@ macro_rules! make_mir_visitor {
|
|||
location: Location) {
|
||||
let Constant {
|
||||
span,
|
||||
ty,
|
||||
user_ty,
|
||||
literal,
|
||||
} = constant;
|
||||
|
||||
self.visit_span(span);
|
||||
self.visit_ty(ty, TyContext::Location(location));
|
||||
drop(user_ty); // no visit method for this
|
||||
self.visit_const(literal, location);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue