-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Redox: correct is_absolute() and has_root() #43983
Conversation
Redox paths are problematic. It would make sense to add a `Scheme` variant to the `std::path::Component` enum; but that would presumably be a breaking change due to exhaustive matching. Alternately it could use the existing `Prefix` variant, like Windows, but none of the existing types of prefix make sense, Redox only has one kind, and adding a new variant to that enum has the same issue as `Component`.
(rust_highfive has picked a reviewer for you, use r? to override) |
Can this avoid the usage of |
I changed it the |
src/libstd/path.rs
Outdated
@@ -323,6 +323,13 @@ unsafe fn u8_slice_as_os_str(s: &[u8]) -> &OsStr { | |||
mem::transmute(s) | |||
} | |||
|
|||
// Detect scheme on Redox | |||
#[inline] | |||
#[allow(unused_variables)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think either annotation here is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right; inlining probably will happen anyway. The allow
was needed with #[cfg]
since the argument was unused on non-Redox, but is unneeded now.
src/libstd/path.rs
Outdated
// Detect scheme on Redox | ||
#[inline] | ||
#[allow(unused_variables)] | ||
fn has_scheme(s: &[u8]) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be something like has_redox_scheme
?
src/libstd/path.rs
Outdated
@@ -605,6 +612,9 @@ pub struct Components<'a> { | |||
// normalization, e.g. \\server\share == \\server\share\. | |||
has_physical_root: bool, | |||
|
|||
// For Redox | |||
has_scheme: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be avoided and the has_physical_root
above be generalized?
@bors: r+ rollup |
📌 Commit fe2d661 has been approved by |
…ichton Redox: correct is_absolute() and has_root() This is awkward, but representing schemes properly in `Components` is not easily possible without breaking backwards compatibility, as discussed earlier in rust-lang#37702. But these methods can be corrected anyway.
This is awkward, but representing schemes properly in
Components
is not easily possible without breaking backwards compatibility, as discussed earlier in #37702.But these methods can be corrected anyway.