mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Pretty print raw pointers in consts as '{pointer}'.
This commit is contained in:
@@ -919,6 +919,7 @@ fn pretty_print_const(
|
||||
},
|
||||
(ConstValue::Scalar(Scalar::Raw { data, .. }), ty::Char) =>
|
||||
p!(write("{:?}", ::std::char::from_u32(data as u32).unwrap())),
|
||||
(ConstValue::Scalar(_), ty::RawPtr(_)) => p!(write("{{pointer}}")),
|
||||
(ConstValue::Scalar(Scalar::Ptr(ptr)), ty::FnPtr(_)) => {
|
||||
let instance = {
|
||||
let alloc_map = self.tcx().alloc_map.lock();
|
||||
|
||||
@@ -10,10 +10,10 @@ error[E0308]: mismatched types
|
||||
--> $DIR/raw-ptr-const-param.rs:7:38
|
||||
|
|
||||
LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Scalar(0x000000000000000f) : *const u32`, found `Scalar(0x000000000000000a) : *const u32`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{pointer}`, found `{pointer}`
|
||||
|
|
||||
= note: expected type `Const<Scalar(0x000000000000000f) : *const u32>`
|
||||
found type `Const<Scalar(0x000000000000000a) : *const u32>`
|
||||
= note: expected type `Const<{pointer}>`
|
||||
found type `Const<{pointer}>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user