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 alias methods to PathBuf for underlying OsString (#58234) #58539

Merged
merged 4 commits into from
Feb 20, 2019

Conversation

aaronstillwell
Copy link
Contributor

@aaronstillwell aaronstillwell commented Feb 17, 2019

Implemented the following methods on PathBuf which forward to the underlying OsString.

  • capacity
  • with_capacity
  • clear
  • reserve
  • reserve_exact
  • shrink_to_fit
  • shrink_to

These methods have been documented with reference to the original docs for OsString. @Mark-Simulacrum please let me know if you feel this does not suffice.

Further, I've not yet included tests for these definitions - please advise on how comprehensive tests need to be for methods such as these that simply alias other (already tested) methods.

(This PR addresses issue #58234)

Implemented the following methods on PathBuf which
forward to the underlying OsString.

- capacity
- with_capacity
- clear
- reserve
- reserve_exact
- shrink_to_fit
- shrink_to
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 17, 2019
@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 17, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1736716e:start=1550417310801331543,finish=1550417311542447085,duration=741115542
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:03:34] tidy error: /checkout/src/libstd/path.rs:1164: trailing whitespace
[00:03:36] some tidy checks failed
[00:03:36] 
[00:03:36] 
[00:03:36] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:36] 
[00:03:36] 
[00:03:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:36] Build completed unsuccessfully in 0:00:45
[00:03:36] Build completed unsuccessfully in 0:00:45
[00:03:36] Makefile:68: recipe for target 'tidy' failed
[00:03:36] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:153536c1
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sun Feb 17 15:32:18 UTC 2019
---
travis_time:end:0722703c:start=1550417539663024944,finish=1550417539667538776,duration=4513832
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1061d6c0
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:2a44d900
travis_time:start:2a44d900
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:068f67ac
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

src/libstd/path.rs Outdated Show resolved Hide resolved
src/libstd/path.rs Outdated Show resolved Hide resolved
src/libstd/path.rs Outdated Show resolved Hide resolved
src/libstd/path.rs Outdated Show resolved Hide resolved
src/libstd/path.rs Outdated Show resolved Hide resolved
src/libstd/path.rs Outdated Show resolved Hide resolved
src/libstd/path.rs Outdated Show resolved Hide resolved
- Fixed incorrect `mut` usage
- Fixed style in accordance with tidy
- Marked all methods as unstable
- Changed feature identifier to path_buf_alias_os_string_methods
@aaronstillwell
Copy link
Contributor Author

@kennytm your corrections have been implemented

src/libstd/path.rs Outdated Show resolved Hide resolved
Feature gate changed to `path_buf_capacity` as per advice from @Mark-Simulacrum
@aaronstillwell
Copy link
Contributor Author

@Mark-Simulacrum done

@Mark-Simulacrum
Copy link
Member

@bors r+

Since these are all unstable I don't think we need to FCP before landing this.

@bors
Copy link
Contributor

bors commented Feb 17, 2019

📌 Commit 35d8c44 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:2e348a1d:start=1550423806825871078,finish=1550423807581839013,duration=755967935
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:12:36] 
[01:12:36] running 119 tests
[01:13:01] .iiiii...i.....i..i...i..i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i.i. 100/119
[01:13:06] i......iii.i.....ii
[01:13:06] 
[01:13:06]  finished in 29.442
[01:13:06] travis_fold:end:test_debuginfo

---
[01:31:11] ..........iii......i......i...i......i.............................................................. 300/992
[01:31:15] .................................................................................................... 400/992
[01:31:24] ........................i.i.....................................iiii........ii...................... 500/992
[01:31:31] .................................................................................................... 600/992
[01:31:38] .............................................................................................F...... 700/992
[01:32:00] .................................................................................................... 900/992
[01:32:07] ......................................iiii..................................................
[01:32:07] failures:
[01:32:07] 
[01:32:07] 
[01:32:07] ---- path.rs - path::PathBuf::with_capacity (line 1153) stdout ----
[01:32:07] error[E0658]: use of unstable library feature 'path_buf_capacity' (see issue #58234)
[01:32:07]  --> path.rs:1156:12
[01:32:07] 6 | let path = PathBuf::with_capacity(10);
[01:32:07]   |            ^^^^^^^^^^^^^^^^^^^^^^
[01:32:07]   |
[01:32:07]   |
[01:32:07]   = help: add #![feature(path_buf_capacity)] to the crate attributes to enable
[01:32:07] 
[01:32:07] error[E0658]: use of unstable library feature 'path_buf_capacity' (see issue #58234)
[01:32:07]  --> path.rs:1157:21
[01:32:07]   |
[01:32:07] 7 | let capacity = path.capacity();
[01:32:07]   |
[01:32:07]   |
[01:32:07]   = help: add #![feature(path_buf_capacity)] to the crate attributes to enable
[01:32:07] 
[01:32:07] error[E0658]: use of unstable library feature 'path_buf_capacity' (see issue #58234)
[01:32:07]   --> path.rs:1162:27
[01:32:07]    |
[01:32:07] 12 | assert_eq!(capacity, path.capacity());
[01:32:07]    |
[01:32:07]    |
[01:32:07]    = help: add #![feature(path_buf_capacity)] to the crate attributes to enable
[01:32:07] thread 'path.rs - path::PathBuf::with_capacity (line 1153)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:354:13
[01:32:07] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:32:07] 
[01:32:07] 
---
[01:32:07] 
[01:32:07] error: test failed, to rerun pass '--doc'
[01:32:07] 
[01:32:07] 
[01:32:07] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:32:07] 
[01:32:07] 
[01:32:07] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:32:07] Build completed unsuccessfully in 0:31:07
[01:32:07] Build completed unsuccessfully in 0:31:07
[01:32:07] Makefile:48: recipe for target 'check' failed
[01:32:07] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:20481a4d
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sun Feb 17 18:49:06 UTC 2019

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 17, 2019
…acrum

Add alias methods to PathBuf for underlying OsString (rust-lang#58234)

Implemented the following methods on PathBuf which forward to the underlying OsString.

- capacity
- with_capacity
- clear
- reserve
- reserve_exact
- shrink_to_fit
- shrink_to

These methods have been documented with reference to the original docs for `OsString`. @Mark-Simulacrum please let me know if you feel this does not suffice.

Further, I've not yet included tests for these definitions - please advise on how comprehensive tests need to be for methods such as these that simply alias other (already tested) methods.

(This PR addresses issue rust-lang#58234)
@Centril
Copy link
Contributor

Centril commented Feb 18, 2019

Failed in rollup #58550, @bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 18, 2019
@aaronstillwell
Copy link
Contributor Author

@Centril @Mark-Simulacrum this is now passing all checks

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 18, 2019

📌 Commit c9fbcc1 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 18, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Feb 18, 2019
…acrum

Add alias methods to PathBuf for underlying OsString (rust-lang#58234)

Implemented the following methods on PathBuf which forward to the underlying OsString.

- capacity
- with_capacity
- clear
- reserve
- reserve_exact
- shrink_to_fit
- shrink_to

These methods have been documented with reference to the original docs for `OsString`. @Mark-Simulacrum please let me know if you feel this does not suffice.

Further, I've not yet included tests for these definitions - please advise on how comprehensive tests need to be for methods such as these that simply alias other (already tested) methods.

(This PR addresses issue rust-lang#58234)
kennytm added a commit to kennytm/rust that referenced this pull request Feb 20, 2019
…acrum

Add alias methods to PathBuf for underlying OsString (rust-lang#58234)

Implemented the following methods on PathBuf which forward to the underlying OsString.

- capacity
- with_capacity
- clear
- reserve
- reserve_exact
- shrink_to_fit
- shrink_to

These methods have been documented with reference to the original docs for `OsString`. @Mark-Simulacrum please let me know if you feel this does not suffice.

Further, I've not yet included tests for these definitions - please advise on how comprehensive tests need to be for methods such as these that simply alias other (already tested) methods.

(This PR addresses issue rust-lang#58234)
bors added a commit that referenced this pull request Feb 20, 2019
Rollup of 24 pull requests

Successful merges:

 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58044 (Make overflowing and wrapping negation const)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58384 (Fix tables display)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58409 (rustdoc: respect alternate flag when formatting impl trait)
 - #58456 (Remove no longer accurate diagnostic code about NLL)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58538 (Add missing fmt structs examples)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58546 (librustc_codegen_llvm => 2018)
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind)
 - #58553 (Use more impl header lifetime elision)
 - #58562 (Fix style nits)
 - #58565 (Fix typo in std::future::Future docs)
 - #58568 (Fix a transposition in driver.rs.)
 - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`)
 - #58576 (Stabilize iter::successors and iter::from_fn)
bors added a commit that referenced this pull request Feb 20, 2019
Rollup of 24 pull requests

Successful merges:

 - #56470 (Modify doctest's auto-`fn main()` to allow `Result`s)
 - #58044 (Make overflowing and wrapping negation const)
 - #58303 (Improve stability tags display)
 - #58336 (Fix search results interactions)
 - #58384 (Fix tables display)
 - #58392 (Use less explicit shifting in std::net::ip)
 - #58409 (rustdoc: respect alternate flag when formatting impl trait)
 - #58456 (Remove no longer accurate diagnostic code about NLL)
 - #58528 (Don't use an allocation for ItemId in StmtKind)
 - #58530 (Monomorphize less code in fs::{read|write})
 - #58534 (Mention capping forbid lints)
 - #58536 (Remove UB in pointer tests)
 - #58538 (Add missing fmt structs examples)
 - #58539 (Add alias methods to PathBuf for underlying OsString (#58234))
 - #58544 (Fix doc for rustc "-g" flag)
 - #58545 (Add regression test for a specialization-related ICE (#39448))
 - #58546 (librustc_codegen_llvm => 2018)
 - #58551 (Explain a panic in test case net::tcp::tests::double_bind)
 - #58553 (Use more impl header lifetime elision)
 - #58562 (Fix style nits)
 - #58565 (Fix typo in std::future::Future docs)
 - #58568 (Fix a transposition in driver.rs.)
 - #58569 (Reduce Some Code Repetitions like `(n << amt) >> amt`)
 - #58576 (Stabilize iter::successors and iter::from_fn)
@bors bors merged commit c9fbcc1 into rust-lang:master Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants