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

Rollup of 4 pull requests #65243

Closed
wants to merge 11 commits into from
Closed

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Oct 9, 2019

Successful merges:

Failed merges:

r? @ghost

rick68 and others added 11 commits September 20, 2019 17:38
In particular, we sometimes cannot if there is an earlier error.
eg. make it easier to test -Ztimings for rustc
Prefer statx on linux if available

This PR make `metadata`-related functions try to invoke `statx` first on Linux if available,
making `std::fs::Metadata::created` work on Linux with `statx` supported.

It follows the discussion in rust-lang#61386 , and will fix rust-lang#59743

The implementation of this PR is simply converting `struct statx` into `struct stat64` with
extra fields for `btime` if `statx` succeeds, since other fields are not currently used.

---

I also did a separated benchmark for `fs::metadata`, `stat64`, `statx`, and `statx` with conversion to `stat64`.
It shows that `statx` with conversion is even more faster than pure `statx`.
I think it's due to `sizeof stat64 == 114` but `sizeof statx == 256`.

Anyway, the bare implementation of `statx` with conversion is only about 0.2% slower than the original impl (`stat64`-family).
With heap-allocation counted (~8.5% of total cost), the difference between `stat` and `statx` (with or without conversion) is just nothing.

Therefore, I think it is not urgent to use bare `struct statx` as underlying representation now.
There is no need to break `std::os::linux::fs::MetadataExt::as_raw_stat` (rust-lang#61386 (comment))

[Separated bare benchmarks](https://gist.github.com/oxalica/c4073ecb202c599fe41b7f15f86dc79c):
```
metadata_ok             time:   [529.41 ns 529.77 ns 530.19 ns]
metadata_err            time:   [538.71 ns 539.39 ns 540.35 ns]
stat64_ok               time:   [484.32 ns 484.53 ns 484.75 ns]
stat64_err              time:   [481.77 ns 482.00 ns 482.24 ns]
statx_ok                time:   [488.07 ns 488.35 ns 488.62 ns]
statx_err               time:   [487.74 ns 488.00 ns 488.27 ns]
statx_cvt_ok            time:   [485.05 ns 485.28 ns 485.53 ns]
statx_cvt_err           time:   [485.23 ns 485.45 ns 485.67 ns]
```

r? @alexcrichton
make it possible to add args to cargo in x.py

eg. make it easier to test -Ztimings for rustc

cc rust-lang#65088
…eturn-ice, r=cramertj

don't assume we can *always* find a return type hint in async fn

In particular, we sometimes cannot if there is an earlier error.

Fixes rust-lang#65159

r? @cramertj, who reviewed the original PR
@Centril
Copy link
Contributor Author

Centril commented Oct 9, 2019

@bors r+ p=4 rollup=never

@bors
Copy link
Contributor

bors commented Oct 9, 2019

📌 Commit 5a24534 has been approved by Centril

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 9, 2019
@bors
Copy link
Contributor

bors commented Oct 9, 2019

⌛ Testing commit 5a24534 with merge d992ac706284642f1cca5341ad110fcda46296cb...

@rust-highfive
Copy link
Collaborator

The job i686-gnu-nopt of your PR failed (pretty log, 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.
2019-10-09T20:16:51.2502348Z [RUSTC-TIMING] hashbrown test:false 0.984
2019-10-09T20:16:54.5948740Z error[E0308]: mismatched types
2019-10-09T20:16:54.5950024Z    --> src/libstd/sys/unix/fs.rs:101:29
2019-10-09T20:16:54.5951478Z     |
2019-10-09T20:16:54.5952105Z 101 |             stat.st_nlink = buf.stx_nlink as u64;
2019-10-09T20:16:54.5952728Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected u32, found u64
2019-10-09T20:16:54.5953459Z help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.5953902Z     |
2019-10-09T20:16:54.5954295Z 101 |             stat.st_nlink = (buf.stx_nlink as u64).try_into().unwrap();
2019-10-09T20:16:54.5955020Z 
2019-10-09T20:16:54.5962816Z error[E0308]: mismatched types
2019-10-09T20:16:54.5963716Z    --> src/libstd/sys/unix/fs.rs:107:31
2019-10-09T20:16:54.5964149Z     |
2019-10-09T20:16:54.5964149Z     |
2019-10-09T20:16:54.5964666Z 107 |             stat.st_blksize = buf.stx_blksize as i64;
2019-10-09T20:16:54.5965244Z     |                               ^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.5965757Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.5966766Z     |
2019-10-09T20:16:54.5967392Z 107 |             stat.st_blksize = (buf.stx_blksize as i64).try_into().unwrap();
2019-10-09T20:16:54.5968285Z 
2019-10-09T20:16:54.5977287Z error[E0308]: mismatched types
2019-10-09T20:16:54.5977956Z    --> src/libstd/sys/unix/fs.rs:109:29
2019-10-09T20:16:54.5978477Z     |
2019-10-09T20:16:54.5978477Z     |
2019-10-09T20:16:54.5979353Z 109 |             stat.st_atime = buf.stx_atime.tv_sec;
2019-10-09T20:16:54.5980285Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.5980816Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.5981242Z     |
2019-10-09T20:16:54.5981923Z 109 |             stat.st_atime = buf.stx_atime.tv_sec.try_into().unwrap();
2019-10-09T20:16:54.5982717Z 
2019-10-09T20:16:54.5983372Z error[E0308]: mismatched types
2019-10-09T20:16:54.5983681Z    --> src/libstd/sys/unix/fs.rs:110:34
2019-10-09T20:16:54.5983936Z     |
2019-10-09T20:16:54.5983936Z     |
2019-10-09T20:16:54.5984251Z 110 |             stat.st_atime_nsec = buf.stx_atime.tv_nsec as i64;
2019-10-09T20:16:54.5984874Z     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.5985408Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.5986236Z     |
2019-10-09T20:16:54.5986961Z 110 |             stat.st_atime_nsec = (buf.stx_atime.tv_nsec as i64).try_into().unwrap();
2019-10-09T20:16:54.5987877Z 
2019-10-09T20:16:54.5993736Z error[E0308]: mismatched types
2019-10-09T20:16:54.5994247Z    --> src/libstd/sys/unix/fs.rs:111:29
2019-10-09T20:16:54.5994690Z     |
2019-10-09T20:16:54.5994690Z     |
2019-10-09T20:16:54.5995183Z 111 |             stat.st_mtime = buf.stx_mtime.tv_sec;
2019-10-09T20:16:54.5995726Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.5996866Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.5997397Z     |
2019-10-09T20:16:54.5997984Z 111 |             stat.st_mtime = buf.stx_mtime.tv_sec.try_into().unwrap();
2019-10-09T20:16:54.5998864Z 
2019-10-09T20:16:54.6002973Z error[E0308]: mismatched types
2019-10-09T20:16:54.6003697Z    --> src/libstd/sys/unix/fs.rs:112:34
2019-10-09T20:16:54.6004126Z     |
2019-10-09T20:16:54.6004126Z     |
2019-10-09T20:16:54.6004652Z 112 |             stat.st_mtime_nsec = buf.stx_mtime.tv_nsec as i64;
2019-10-09T20:16:54.6005269Z     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.6006737Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.6007557Z     |
2019-10-09T20:16:54.6008196Z 112 |             stat.st_mtime_nsec = (buf.stx_mtime.tv_nsec as i64).try_into().unwrap();
2019-10-09T20:16:54.6012743Z 
2019-10-09T20:16:54.6018303Z error[E0308]: mismatched types
2019-10-09T20:16:54.6018937Z    --> src/libstd/sys/unix/fs.rs:113:29
2019-10-09T20:16:54.6019784Z     |
2019-10-09T20:16:54.6019784Z     |
2019-10-09T20:16:54.6020355Z 113 |             stat.st_ctime = buf.stx_ctime.tv_sec;
2019-10-09T20:16:54.6020943Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.6021504Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.6021934Z     |
2019-10-09T20:16:54.6022460Z 113 |             stat.st_ctime = buf.stx_ctime.tv_sec.try_into().unwrap();
2019-10-09T20:16:54.6023376Z 
2019-10-09T20:16:54.6030429Z error[E0308]: mismatched types
2019-10-09T20:16:54.6030982Z    --> src/libstd/sys/unix/fs.rs:114:34
2019-10-09T20:16:54.6031445Z     |
2019-10-09T20:16:54.6031445Z     |
2019-10-09T20:16:54.6031976Z 114 |             stat.st_ctime_nsec = buf.stx_ctime.tv_nsec as i64;
2019-10-09T20:16:54.6032564Z     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:16:54.6033109Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:16:54.6033733Z     |
2019-10-09T20:16:54.6034263Z 114 |             stat.st_ctime_nsec = (buf.stx_ctime.tv_nsec as i64).try_into().unwrap();
2019-10-09T20:16:54.6035060Z 
2019-10-09T20:16:54.8866852Z error: aborting due to 8 previous errors
2019-10-09T20:16:54.8868039Z 
2019-10-09T20:16:54.8868631Z For more information about this error, try `rustc --explain E0308`.
---
2019-10-09T20:16:54.9470285Z == clock drift check ==
2019-10-09T20:16:54.9484485Z   local time: Wed Oct  9 20:16:54 UTC 2019
2019-10-09T20:16:54.9909569Z   network time: Wed, 09 Oct 2019 20:16:54 GMT
2019-10-09T20:16:54.9912495Z == end clock drift check ==
2019-10-09T20:16:56.4218180Z ##[error]Bash exited with code '1'.
2019-10-09T20:16:56.4252911Z ##[section]Starting: Upload CPU usage statistics
2019-10-09T20:16:56.4269910Z ==============================================================================
2019-10-09T20:16:56.4270027Z Task         : Bash
2019-10-09T20:16:56.4270274Z Description  : Run a Bash script on macOS, Linux, or Windows

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)

@bors
Copy link
Contributor

bors commented Oct 9, 2019

💔 Test failed - checks-azure

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

The job i686-gnu-nopt of your PR failed (pretty log, 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.
2019-10-09T20:27:22.5409497Z [RUSTC-TIMING] hashbrown test:false 0.874
2019-10-09T20:27:25.6628959Z error[E0308]: mismatched types
2019-10-09T20:27:25.6629696Z    --> src/libstd/sys/unix/fs.rs:101:29
2019-10-09T20:27:25.6629919Z     |
2019-10-09T20:27:25.6630218Z 101 |             stat.st_nlink = buf.stx_nlink as u64;
2019-10-09T20:27:25.6630571Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected u32, found u64
2019-10-09T20:27:25.6630913Z help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6631156Z     |
2019-10-09T20:27:25.6631490Z 101 |             stat.st_nlink = (buf.stx_nlink as u64).try_into().unwrap();
2019-10-09T20:27:25.6632267Z 
2019-10-09T20:27:25.6672744Z error[E0308]: mismatched types
2019-10-09T20:27:25.6674435Z    --> src/libstd/sys/unix/fs.rs:107:31
2019-10-09T20:27:25.6675158Z     |
2019-10-09T20:27:25.6675158Z     |
2019-10-09T20:27:25.6679136Z 107 |             stat.st_blksize = buf.stx_blksize as i64;
2019-10-09T20:27:25.6680544Z     |                               ^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6682032Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6682742Z     |
2019-10-09T20:27:25.6683347Z 107 |             stat.st_blksize = (buf.stx_blksize as i64).try_into().unwrap();
2019-10-09T20:27:25.6684175Z 
2019-10-09T20:27:25.6684613Z error[E0308]: mismatched types
2019-10-09T20:27:25.6685101Z    --> src/libstd/sys/unix/fs.rs:109:29
2019-10-09T20:27:25.6685862Z     |
2019-10-09T20:27:25.6685862Z     |
2019-10-09T20:27:25.6686506Z 109 |             stat.st_atime = buf.stx_atime.tv_sec;
2019-10-09T20:27:25.6687264Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6687891Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6688904Z     |
2019-10-09T20:27:25.6689595Z 109 |             stat.st_atime = buf.stx_atime.tv_sec.try_into().unwrap();
2019-10-09T20:27:25.6690323Z 
2019-10-09T20:27:25.6690715Z error[E0308]: mismatched types
2019-10-09T20:27:25.6691148Z    --> src/libstd/sys/unix/fs.rs:110:34
2019-10-09T20:27:25.6691565Z     |
2019-10-09T20:27:25.6691565Z     |
2019-10-09T20:27:25.6692928Z 110 |             stat.st_atime_nsec = buf.stx_atime.tv_nsec as i64;
2019-10-09T20:27:25.6693916Z     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6694520Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6695116Z     |
2019-10-09T20:27:25.6696171Z 110 |             stat.st_atime_nsec = (buf.stx_atime.tv_nsec as i64).try_into().unwrap();
2019-10-09T20:27:25.6696900Z 
2019-10-09T20:27:25.6697254Z error[E0308]: mismatched types
2019-10-09T20:27:25.6697710Z    --> src/libstd/sys/unix/fs.rs:111:29
2019-10-09T20:27:25.6698120Z     |
2019-10-09T20:27:25.6698120Z     |
2019-10-09T20:27:25.6698983Z 111 |             stat.st_mtime = buf.stx_mtime.tv_sec;
2019-10-09T20:27:25.6699723Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6700209Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6700606Z     |
2019-10-09T20:27:25.6701254Z 111 |             stat.st_mtime = buf.stx_mtime.tv_sec.try_into().unwrap();
2019-10-09T20:27:25.6702633Z 
2019-10-09T20:27:25.6703237Z error[E0308]: mismatched types
2019-10-09T20:27:25.6703760Z    --> src/libstd/sys/unix/fs.rs:112:34
2019-10-09T20:27:25.6704398Z     |
2019-10-09T20:27:25.6704398Z     |
2019-10-09T20:27:25.6705014Z 112 |             stat.st_mtime_nsec = buf.stx_mtime.tv_nsec as i64;
2019-10-09T20:27:25.6706137Z     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6706638Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6707432Z     |
2019-10-09T20:27:25.6708132Z 112 |             stat.st_mtime_nsec = (buf.stx_mtime.tv_nsec as i64).try_into().unwrap();
2019-10-09T20:27:25.6709789Z 
2019-10-09T20:27:25.6718013Z error[E0308]: mismatched types
2019-10-09T20:27:25.6718678Z    --> src/libstd/sys/unix/fs.rs:113:29
2019-10-09T20:27:25.6718914Z     |
2019-10-09T20:27:25.6718914Z     |
2019-10-09T20:27:25.6719209Z 113 |             stat.st_ctime = buf.stx_ctime.tv_sec;
2019-10-09T20:27:25.6719540Z     |                             ^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6719861Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6720096Z     |
2019-10-09T20:27:25.6720392Z 113 |             stat.st_ctime = buf.stx_ctime.tv_sec.try_into().unwrap();
2019-10-09T20:27:25.6720994Z 
2019-10-09T20:27:25.6721221Z error[E0308]: mismatched types
2019-10-09T20:27:25.6721473Z    --> src/libstd/sys/unix/fs.rs:114:34
2019-10-09T20:27:25.6721678Z     |
2019-10-09T20:27:25.6721678Z     |
2019-10-09T20:27:25.6722832Z 114 |             stat.st_ctime_nsec = buf.stx_ctime.tv_nsec as i64;
2019-10-09T20:27:25.6723304Z     |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found i64
2019-10-09T20:27:25.6723733Z help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
2019-10-09T20:27:25.6724047Z     |
2019-10-09T20:27:25.6724441Z 114 |             stat.st_ctime_nsec = (buf.stx_ctime.tv_nsec as i64).try_into().unwrap();
2019-10-09T20:27:25.6724970Z 
2019-10-09T20:27:25.9601028Z error: aborting due to 8 previous errors
2019-10-09T20:27:25.9601212Z 
2019-10-09T20:27:25.9601792Z For more information about this error, try `rustc --explain E0308`.
---
2019-10-09T20:27:26.0205005Z == clock drift check ==
2019-10-09T20:27:26.0223286Z   local time: Wed Oct  9 20:27:26 UTC 2019
2019-10-09T20:27:26.1602897Z   network time: Wed, 09 Oct 2019 20:27:26 GMT
2019-10-09T20:27:26.1603113Z == end clock drift check ==
2019-10-09T20:27:27.8706095Z ##[error]Bash exited with code '1'.
2019-10-09T20:27:27.8749164Z ##[section]Starting: Upload CPU usage statistics
2019-10-09T20:27:27.8751748Z ==============================================================================
2019-10-09T20:27:27.8751821Z Task         : Bash
2019-10-09T20:27:27.8752344Z Description  : Run a Bash script on macOS, Linux, or Windows

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)

@Centril Centril closed this Oct 9, 2019
@Centril Centril deleted the rollup-q5yzqpf branch October 9, 2019 23:43
@Centril Centril added the rollup A PR which is a rollup label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants