about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-16 13:19:51 +0800
committerGitHub <noreply@github.com>2025-03-16 13:19:51 +0800
commita23a93cb4e848c75d6cf2ddb9ca418a0e501af90 (patch)
treef03275adb8cf505e3e2710b3c205fa7260382723 /compiler/rustc_hir_analysis/src
parent66678e68227913a42438afc7320a2849dffd4d51 (diff)
parent697737a8b18b685270f197ccdd1211e8a010b98b (diff)
downloadrust-a23a93cb4e848c75d6cf2ddb9ca418a0e501af90.tar.gz
rust-a23a93cb4e848c75d6cf2ddb9ca418a0e501af90.zip
Rollup merge of #135080 - Enselic:debug-ptr-metadata, r=thomcc
core: Make `Debug` impl of raw pointers print metadata if present

Make Rust pointers appear less magic by including metadata information in their `Debug` output.

This does not break Rust stability guarantees because `Debug` impl are explicitly exempted from stability:
https://doc.rust-lang.org/std/fmt/trait.Debug.html#stability

> ## Stability
>
> Derived `Debug` formats are not stable, and so may change with future Rust versions. Additionally, `Debug` implementations of types provided by the standard library (`std`, `core`, `alloc`, etc.) are not stable, and may also change with future Rust versions.

Note that a regression test is added as a separate commit to make it clear what impact the last commit has on the output.

Closes #128684 because the output of that code now becomes:

```
thread 'main' panicked at src/main.rs:5:5:
assertion `left == right` failed
  left: Pointer { addr: 0x7ffd45c6fc6b, metadata: 5 }
 right: Pointer { addr: 0x7ffd45c6fc6b, metadata: 3 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
0 files changed, 0 insertions, 0 deletions