Skip to content

Commit 9884ff1

Browse files
committed
Add Debug impl and erase region for TypedConstVal
1 parent d31027d commit 9884ff1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/librustc/mir/repr.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -891,13 +891,20 @@ pub struct Constant<'tcx> {
891891
pub literal: Literal<'tcx>,
892892
}
893893

894-
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
894+
#[derive(Clone, RustcEncodable, RustcDecodable)]
895895
pub struct TypedConstVal<'tcx> {
896896
pub ty: Ty<'tcx>,
897897
pub span: Span,
898898
pub value: ConstVal
899899
}
900900

901+
impl<'tcx> Debug for TypedConstVal<'tcx> {
902+
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
903+
try!(write!(fmt, "const "));
904+
fmt_const_val(fmt, &self.value)
905+
}
906+
}
907+
901908
#[derive(Clone, Copy, Debug, PartialEq, RustcEncodable, RustcDecodable)]
902909
pub enum ItemKind {
903910
Constant,

src/librustc_mir/transform/erase_regions.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ impl<'a, 'tcx> EraseRegions<'a, 'tcx> {
143143
Rvalue::Use(ref mut operand) => {
144144
self.erase_regions_operand(operand)
145145
}
146-
Rvalue::Repeat(ref mut operand, _) => {
146+
Rvalue::Repeat(ref mut operand, ref mut value) => {
147147
self.erase_regions_operand(operand);
148+
value.ty = self.tcx.erase_regions(&value.ty);
148149
}
149150
Rvalue::Ref(ref mut region, _, ref mut lvalue) => {
150151
*region = ty::ReStatic;

0 commit comments

Comments
 (0)