Skip to content
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

first attempt at implementing %p for fmt! #8085

Closed
wants to merge 1 commit into from
Closed

first attempt at implementing %p for fmt! #8085

wants to merge 1 commit into from

Conversation

minhnhdo
Copy link
Contributor

pull request for #8011

@minhnhdo
Copy link
Contributor Author

I don't know how to add a test for pointer address printing. Could you give me an example?

I have a program to try out the new functionality. The outputs are in the 0x7fxxxxxxx7a0 range, so I think it's sensible.

fn main() {
    let a = &1;
    println(fmt!("%p", a));
}

@huonw
Copy link
Member

huonw commented Jul 28, 2013

@mrordinaire maybe something like:

for 10.times {
    let x: uint = std::rand::random();
    assert_eq!(fmt!("%p", x as *uint), fmt!("%x", x));
}

@minhnhdo
Copy link
Contributor Author

@huonw Thanks a bunch

@jdm
Copy link
Contributor

jdm commented Jul 28, 2013

Great! Would you mind rebasing and squashing all of these into one commit with a commit message that describes the overall change now? See http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html if you've never done this before.

@minhnhdo
Copy link
Contributor Author

@alexcrichton hi, I don't think the failures are caused by my changes (except for the test code, whose cause is missing stdlib on windows). What should I do next?

@huonw
Copy link
Member

huonw commented Jul 29, 2013

@mrordinaire #6330, you either need ::std::rand::random(), or (preferably) just use std::rand; at the top of the file and then rand::random().

@minhnhdo
Copy link
Contributor Author

@alexcrichton r?

bors added a commit that referenced this pull request Jul 29, 2013
@bors bors closed this Jul 29, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 17, 2021
…po, r=giraffate

`needless_lifetimes` Known problems typo

fixes rust-lang#8084

[needless_lifetimes]

changelog: none
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 this pull request may close these issues.

4 participants