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

Add fmt::Show trait implementation to posix and windows Path's #17534

Closed
wants to merge 1 commit into from

Conversation

wickerwaka
Copy link

Implement the Show trait for both Path implementations.

@wickerwaka
Copy link
Author

@vks not if I want to use #[deriving(Show)] on a struct that contains a Path. Doesn't it seem reasonable that Path would implement show? Its a pretty common thing people want to do.

@vks
Copy link
Contributor

vks commented Sep 25, 2014

I meant: Couldn't your implementation of Show use display?
(Or does this prevent using #[deriving(Show)]?)

@sfackler
Copy link
Member

cc @kballard

@wickerwaka
Copy link
Author

@vks ah yes, good point

@aturon
Copy link
Member

aturon commented Sep 25, 2014

See the discussion thread here about some of the tradeoffs.

@lilyball
Copy link
Contributor

This has been proposed multiple times before. It's always been considered too risky to have Path implement Show, because it's extremely common for people to assume file paths can be represented as strings, and therefore that producing a string from a Path will yield a value that accurately represents the path and can be used to re-create an identical Path object. However, this is not the case. This is why the .display() method exists, to make it really obvious that this is not an accurate representation.

The proper solution to #[deriving(Show)] is to provide the ability to customize the deriving. #14268 is related, though I believe there are other relevant issues as well.

@alexcrichton
Copy link
Member

At this time the std::path module is still a candidate for stabilization, and this will likely come up during the stabilization process regardless. For now, though, using the display() method is in line with the current design of the module. In light of this, I'm going to close this out of inactivity for reconsideration when std::path comes up for stabilization.

lnicola pushed a commit to lnicola/rust that referenced this pull request Jul 11, 2024
…eykril

fix: Skip match exhaustiveness checking if pattern type contains errors

Should fix rust-lang/rust-analyzer#17509, checking when errors are involved is generally a bad idea as the algorithm doesn't really expect error types in the first place I believe
lnicola pushed a commit to lnicola/rust that referenced this pull request Jul 28, 2024
fix: Panic in debug profile for tuple deconstruct with arity mismatch

Fixes rust-lang#17585, which doesn't affect daily use cases but quite annoying in development of r-a itself like writing tests.

This PR applies similar approach as in rust-lang#17534, skipping match usefulness check for patterns containing errors
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Aug 1, 2024
fix: Panic in debug profile for tuple deconstruct with arity mismatch

Fixes rust-lang#17585, which doesn't affect daily use cases but quite annoying in development of r-a itself like writing tests.

This PR applies similar approach as in rust-lang#17534, skipping match usefulness check for patterns containing errors
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.

6 participants