mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Add leading 0x to offset in Debug fmt of Pointer
This commit is contained in:
parent
b2e36e6c2d
commit
c16b6e0faa
@ -121,13 +121,13 @@ static_assert_size!(Pointer, 16);
|
||||
|
||||
impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for Pointer<Tag, Id> {
|
||||
default fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{:?}+{:x}[{:?}]", self.alloc_id, self.offset.bytes(), self.tag)
|
||||
write!(f, "{:?}+0x{:x}[{:?}]", self.alloc_id, self.offset.bytes(), self.tag)
|
||||
}
|
||||
}
|
||||
// Specialization for no tag
|
||||
impl<Id: fmt::Debug> fmt::Debug for Pointer<(), Id> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{:?}+{:x}", self.alloc_id, self.offset.bytes())
|
||||
write!(f, "{:?}+0x{:x}", self.alloc_id, self.offset.bytes())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,10 @@ fn main() -> () {
|
||||
_1 = const b"foo"; // bb0[1]: scope 0 at $DIR/byte_slice.rs:5:13: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u8; 3]
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/byte_slice.rs:5:13: 5:19
|
||||
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0+0x0)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/byte_slice.rs:6:9: 6:10
|
||||
_2 = [const 5u8, const 120u8]; // bb0[3]: scope 1 at $DIR/byte_slice.rs:6:13: 6:24
|
||||
// ty::Const
|
||||
|
@ -7,13 +7,13 @@ promoted[0] in BAR: &[&i32; 1] = {
|
||||
let mut _3: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
|
||||
bb0: {
|
||||
_3 = const {alloc0+0: &i32}; // bb0[0]: scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
_3 = const {alloc0+0x0: &i32}; // bb0[0]: scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0+0x0)) }
|
||||
_2 = _3; // bb0[1]: scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||
_1 = [move _2]; // bb0[2]: scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
_0 = &_1; // bb0[3]: scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
|
@ -16,16 +16,16 @@
|
||||
- StorageLive(_3); // bb0[2]: scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
- StorageLive(_4); // bb0[3]: scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||
- StorageLive(_5); // bb0[4]: scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- _5 = const {alloc0+0: &i32}; // bb0[5]: scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- _5 = const {alloc0+0x0: &i32}; // bb0[5]: scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
+ _6 = const BAR::promoted[0]; // bb0[2]: scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
// ty::Const
|
||||
- // + ty: &i32
|
||||
- // + val: Value(Scalar(alloc0+0))
|
||||
- // + val: Value(Scalar(alloc0+0x0))
|
||||
+ // + ty: &[&i32; 1]
|
||||
+ // + val: Unevaluated(DefId(0:6 ~ const_promotion_extern_static[317d]::BAR[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc0+0)) }
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc0+0x0)) }
|
||||
- _4 = &(*_5); // bb0[6]: scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||
- _3 = [move _4]; // bb0[7]: scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
- _2 = &_3; // bb0[8]: scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
|
@ -9,13 +9,13 @@ promoted[0] in FOO: &[&i32; 1] = {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_3 = const {alloc2+0: &i32}; // bb0[0]: scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
_3 = const {alloc2+0x0: &i32}; // bb0[0]: scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Value(Scalar(alloc2+0))
|
||||
// + val: Value(Scalar(alloc2+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc2+0)) }
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc2+0x0)) }
|
||||
_2 = _3; // bb0[1]: scope 0 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
||||
_1 = [move _2]; // bb0[2]: scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
_0 = &_1; // bb0[3]: scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
|
@ -18,16 +18,16 @@
|
||||
- StorageLive(_3); // bb0[2]: scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
- StorageLive(_4); // bb0[3]: scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
||||
- StorageLive(_5); // bb0[4]: scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- _5 = const {alloc2+0: &i32}; // bb0[5]: scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- _5 = const {alloc2+0x0: &i32}; // bb0[5]: scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
+ _6 = const FOO::promoted[0]; // bb0[2]: scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
// ty::Const
|
||||
- // + ty: &i32
|
||||
- // + val: Value(Scalar(alloc2+0))
|
||||
- // + val: Value(Scalar(alloc2+0x0))
|
||||
+ // + ty: &[&i32; 1]
|
||||
+ // + val: Unevaluated(DefId(0:7 ~ const_promotion_extern_static[317d]::FOO[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc2+0)) }
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc2+0x0)) }
|
||||
- _4 = &(*_5); // bb0[6]: scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
||||
- _3 = [move _4]; // bb0[7]: scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
- _2 = &_3; // bb0[8]: scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
|
@ -8,13 +8,13 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0+0: &&[(std::option::Option<i32>, &[&str])]}; // bb0[2]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&str])]}; // bb0[2]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&str])]
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation.rs:8:5: 8:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0+0x0)) }
|
||||
_1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
|
@ -8,13 +8,13 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0+0: &&[(std::option::Option<i32>, &[&str])]}; // bb0[2]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&str])]}; // bb0[2]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&str])]
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation.rs:8:5: 8:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0+0x0)) }
|
||||
_1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
|
@ -8,13 +8,13 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0: &&[(std::option::Option<i32>, &[&u8])]}; // bb0[2]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&u8])]}; // bb0[2]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&u8])]
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0+0x0)) }
|
||||
_1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
|
@ -8,13 +8,13 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0: &&[(std::option::Option<i32>, &[&u8])]}; // bb0[2]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&u8])]}; // bb0[2]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&u8])]
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0+0x0)) }
|
||||
_1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
|
@ -8,13 +8,13 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0: &&Packed}; // bb0[2]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&Packed}; // bb0[2]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&Packed
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0+0x0)) }
|
||||
_1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
|
@ -8,13 +8,13 @@ fn main() -> () {
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0: &&Packed}; // bb0[2]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&Packed}; // bb0[2]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&Packed
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0+0x0)) }
|
||||
_1 = (*_2); // bb0[3]: scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
StorageDead(_1); // bb0[5]: scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
|
@ -16,13 +16,13 @@
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/read_immutable_static.rs:7:9: 7:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
_3 = const {alloc0+0: &u8}; // bb0[3]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
_3 = const {alloc0+0x0: &u8}; // bb0[3]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// ty::Const
|
||||
// + ty: &u8
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0x0)) }
|
||||
- _2 = (*_3); // bb0[4]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ _2 = const 2u8; // bb0[4]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ // ty::Const
|
||||
@ -33,13 +33,13 @@
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
|
||||
StorageLive(_4); // bb0[5]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
StorageLive(_5); // bb0[6]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
_5 = const {alloc0+0: &u8}; // bb0[7]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
_5 = const {alloc0+0x0: &u8}; // bb0[7]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// ty::Const
|
||||
// + ty: &u8
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0)) }
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0x0)) }
|
||||
- _4 = (*_5); // bb0[8]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
- _1 = Add(move _2, move _4); // bb0[9]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:22
|
||||
+ _4 = const 2u8; // bb0[8]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
|
Loading…
Reference in New Issue
Block a user