Skip to content

Add a Repr trait that's distinct from ToStr (or a repr() method on ToStr) #3437

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
jesse99 opened this issue Sep 10, 2012 · 2 comments
Closed
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@jesse99
Copy link
Contributor

jesse99 commented Sep 10, 2012

This simple unit test fails:

#[test]
fn test_int()
{
   let x = ~10;
   assert x.to_str() == ~"10";
}

because the returned string is actually ~"~10". That's rather surprising.

Same sort of thing occurs with path::Path.

@pcwalton
Copy link
Contributor

Yeah, we should have ToStr distinct from Repr, the latter of which returns a more low-level representation, and the former of which returns a string suitable for displaying to users.

@graydon
Copy link
Contributor

graydon commented Mar 20, 2013

this is fixed, repr is a separate trait now

@graydon graydon closed this as completed Mar 20, 2013
RalfJung pushed a commit to RalfJung/rust that referenced this issue Mar 31, 2024
extern-so: give the version script a better name; show errors from failing to build the C lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants