Skip to content

Commit

Permalink
Document futility of printing temporary pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Jul 17, 2024
1 parent 8a9cccb commit ee9a38e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,14 @@ pub trait UpperHex {
/// `p` formatting.
///
/// The `Pointer` trait should format its output as a memory location. This is commonly presented
/// as hexadecimal.
/// as hexadecimal. For more information on formatters, see [the module-level documentation][module].
///
/// For more information on formatters, see [the module-level documentation][module].
/// Printing of pointers is not a reliable way to discover how Rust programs are implemented,
/// because the act of reading an address of a value may change how the value is stored in memory,
/// and prevent some code optimizations.
///
/// Rust may move values in memory, and reuse the same memory locations for different values, so
/// the printed pointer values are not guaranteed to be stable nor unique identifiers of objects.
///
/// [module]: ../../std/fmt/index.html
///
Expand Down

0 comments on commit ee9a38e

Please sign in to comment.