Closed
Description
We sometimes have super verbose things in MIR like
assert(const true, "index out of bounds: the len is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
// ty::Const
// + ty: bool
// + val: Value(Scalar(0x01))
// mir::Constant
// + span: $DIR/array_index.rs:5:18: 5:33
// + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000004))
// mir::Constant
// + span: $DIR/array_index.rs:5:18: 5:33
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000004)) }
// ty::Const
// + ty: usize
// + val: Value(Scalar(0x0000000000000002))
// mir::Constant
// + span: $DIR/array_index.rs:5:18: 5:33
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
These constants give no useful additional information, as everything is already contained in the mir terminator. I think we could start out with just not printing these statements if the type is an integer, bool or char, which should cover most use cases. A more complex analysis could later look at constant in more detail and decide whether the verbose printing could be helpful.