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

std::path::Path does not implement Show #13009

Closed
wycats opened this issue Mar 18, 2014 · 5 comments
Closed

std::path::Path does not implement Show #13009

wycats opened this issue Mar 18, 2014 · 5 comments

Comments

@wycats
Copy link
Contributor

wycats commented Mar 18, 2014

A Show implementation could use the string representation.

@alexcrichton
Copy link
Member

Closing as working as intended.

This was done in an attempt to make let path: ~str = format!("{}", path) difficult to emphasize that paths are not strings. Paths can be displayed as strings (with utf-8 replacement characters) with this code:

let p: Path = ...;
println!("{}", p.display());

@wycats
Copy link
Contributor Author

wycats commented Mar 18, 2014

I really think we should consider converting some of these cases (especially in paths) into UTF-8, instead of treating them as binary and therefore unrepresentable as Rust strings.

As far as I know, the main case of lossy round-tripping through Unicode is in SHIFT-JIS, and I don't even know if that lossy scenario affects real-world paths that happen to be encoded in SHIFT-JIS (the lossiness is because a MS extension created duplicates of conceptually the same character, which were then unified in Unicode. I don't know if that problem will end up mattering for paths).

@thestinger
Copy link
Contributor

Paths aren't Unicode though. Most *nix filesystems allow any bytes other than / and \0. NTFS allows any UCS2, even if it's invalid UTF-16.

@huonw
Copy link
Member

huonw commented Mar 18, 2014

(e.g. touch $(echo -e '\xFF') creates an invalid-UTF8 filename on linux.)

@thestinger
Copy link
Contributor

@huonw: depends on the file system if it's valid of course :)

flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 11, 2024
…blyxyas

[`missing_const_for_fn`]: fix FP when arg ty is impl trait alias ty

closes: rust-lang#13009

---

changelog: [`missing_const_for_fn`]: fix FP when arg ty is impl trait alias ty
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

No branches or pull requests

4 participants