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

Redox: correct is_absolute() and has_root() #43983

Merged
merged 4 commits into from Aug 23, 2017
Merged

Conversation

@ids1024
Copy link
Contributor

@ids1024 ids1024 commented Aug 18, 2017

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.

ids1024 added 2 commits Aug 18, 2017
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
Copy link
Collaborator

@rust-highfive rust-highfive commented Aug 18, 2017

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Aug 22, 2017

Can this avoid the usage of #[cfg] and instead use cfg! instead? Also presumably this could add a few tests?

@ids1024
Copy link
Contributor Author

@ids1024 ids1024 commented Aug 22, 2017

I changed it the cfg!. It should be possible to add #[cfg(target_os = "redox")] tests alongside the current Unix and Windows ones in this file, although they presumably wouldn't run on CI and I'm frankly not quite sure how to run run the libstd unit tests on Redox (since it isn't possible to build Rust under Redox itself yet)....

@@ -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)]

This comment has been minimized.

@alexcrichton

alexcrichton Aug 22, 2017
Member

I don't think either annotation here is necessary?

This comment has been minimized.

@ids1024

ids1024 Aug 22, 2017
Author Contributor

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.

// Detect scheme on Redox
#[inline]
#[allow(unused_variables)]
fn has_scheme(s: &[u8]) -> bool {

This comment has been minimized.

@alexcrichton

alexcrichton Aug 22, 2017
Member

Should this be something like has_redox_scheme?

@@ -605,6 +612,9 @@ pub struct Components<'a> {
// normalization, e.g. \\server\share == \\server\share\.
has_physical_root: bool,

// For Redox
has_scheme: bool,

This comment has been minimized.

@alexcrichton

alexcrichton Aug 22, 2017
Member

Can this be avoided and the has_physical_root above be generalized?

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Aug 22, 2017

@bors: r+ rollup

@bors
Copy link
Contributor

@bors bors commented Aug 22, 2017

📌 Commit fe2d661 has been approved by alexcrichton

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 23, 2017
…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.
bors added a commit that referenced this pull request Aug 23, 2017
Rollup of 8 pull requests

- Successful merges: #43631, #43977, #43983, #44016, #44039, #44043, #44047, #44054
- Failed merges:
@bors bors merged commit fe2d661 into rust-lang:master Aug 23, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ids1024 ids1024 deleted the ids1024:redox-path-prefix branch Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.