Prepare mir::Constant for ty::Const only supporting valtrees
This commit is contained in:
@@ -439,7 +439,7 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
|
||||
fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) {
|
||||
self.super_constant(constant, location);
|
||||
let Constant { span, user_ty, literal } = constant;
|
||||
match literal.ty.kind() {
|
||||
match literal.ty().kind() {
|
||||
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char => {}
|
||||
// Unit type
|
||||
ty::Tuple(tys) if tys.is_empty() => {}
|
||||
@@ -449,7 +449,12 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
|
||||
if let Some(user_ty) = user_ty {
|
||||
self.push(&format!("+ user_ty: {:?}", user_ty));
|
||||
}
|
||||
self.push(&format!("+ literal: {:?}", literal));
|
||||
match literal {
|
||||
ConstantSource::Ty(literal) => self.push(&format!("+ literal: {:?}", literal)),
|
||||
ConstantSource::Val(val, ty) => {
|
||||
self.push(&format!("+ literal: {:?}, {}", val, ty))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user