Skip to content

Debug formatting for pointers is truncated #22854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SSheldon opened this issue Feb 27, 2015 · 2 comments
Closed

Debug formatting for pointers is truncated #22854

SSheldon opened this issue Feb 27, 2015 · 2 comments

Comments

@SSheldon
Copy link
Contributor

fn main() {
    let x = 0;
    let p = &x as *const i32;
    println!("{:?}, {:x}", p, p as usize);
}

This sample code prints 0x5a83172c, 7fff5a83172c, where the pointer's debug doesn't include the first 4 characters of its address.

My rustc version:

$ rustc --version --verbose
rustc 1.0.0-nightly (4db0b3246 2015-02-25) (built 2015-02-25)
binary: rustc
commit-hash: 4db0b32467535d718d6474de7ae8d1007d900818
commit-date: 2015-02-25
build-date: 2015-02-25
host: x86_64-apple-darwin
release: 1.0.0-nightly
@SSheldon
Copy link
Contributor Author

Possibly related to #22700, the most recent change to the fmt module? cc @nrc

The formatting is what we'd see if the pointer were cast to a u32 instead of a usize.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 27, 2015
Just a mistaken u32 cast instead of usize

Closes rust-lang#22854
@SSheldon
Copy link
Contributor Author

SSheldon commented Mar 1, 2015

Fixed in #22901

@SSheldon SSheldon closed this as completed Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants