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

Turn duration consts into associated consts #58595

Merged
merged 3 commits into from Feb 23, 2019
Merged

Turn duration consts into associated consts #58595

merged 3 commits into from Feb 23, 2019

Conversation

ghost
Copy link

@ghost ghost commented Feb 20, 2019

As suggested in #57391 (comment), I'm moving Duration constants (SECOND, MILLISECOND and so on; currently behind unstable duration_constants feature) into the impl Duration block.

cc @frewsxcv @SimonSapin

@rust-highfive
Copy link
Collaborator

r? @withoutboats

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 20, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Feb 20, 2019

O_o we have zero tests using these?

Can you add a bunch of tests (maybe just as doctests on the constants showing a usage example)?

r? @oli-obk

@ghost
Copy link
Author

ghost commented Feb 20, 2019

@oli-obk Seems so 😅 I've added a few doctests on the constants now.

@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:05fba768:start=1550696384926645461,finish=1550696486158318672,duration=101231673211
$ 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:16:00] 
[01:16:00] running 119 tests
[01:16:25] .iiiii...i.....i..i...i..i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i.i. 100/119
[01:16:29] i......iii.i.....ii
[01:16:29] 
[01:16:29]  finished in 28.512
[01:16:29] travis_fold:end:test_debuginfo

---
[01:30:53] .................................................................................................... 1900/2269
[01:31:07] .................................................................................................... 2000/2269
[01:31:23] .................................................................................................... 2100/2269
[01:31:40] .................................................................................i.................. 2200/2269
[01:31:49] ........................................FF.FF........................
[01:31:49] 
[01:31:49] ---- time.rs - time::Duration::MICROSECOND (line 90) stdout ----
[01:31:49] ---- time.rs - time::Duration::MICROSECOND (line 90) stdout ----
[01:31:49] error[E0658]: use of unstable library feature 'duration_constants' (see issue #57391)
[01:31:49]  --> time.rs:93:12
[01:31:49]   |
[01:31:49] 6 | assert_eq!(Duration::MICROSECOND, Duration::from_micros(1));
[01:31:49]   |
[01:31:49]   = help: add #![feature(duration_constants)] to the crate attributes to enable
[01:31:49] 
[01:31:49] thread 'time.rs - time::Duration::MICROSECOND (line 90)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
[01:31:49] thread 'time.rs - time::Duration::MICROSECOND (line 90)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
[01:31:49] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:31:49] 
[01:31:49] ---- time.rs - time::Duration::MILLISECOND (line 78) stdout ----
[01:31:49] error[E0658]: use of unstable library feature 'duration_constants' (see issue #57391)
[01:31:49]  --> time.rs:81:12
[01:31:49]   |
[01:31:49] 6 | assert_eq!(Duration::MILLISECOND, Duration::from_millis(1));
[01:31:49]   |
[01:31:49]   = help: add #![feature(duration_constants)] to the crate attributes to enable
[01:31:49] 
[01:31:49] thread 'time.rs - time::Duration::MILLISECOND (line 78)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
[01:31:49] thread 'time.rs - time::Duration::MILLISECOND (line 78)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
[01:31:49] 
[01:31:49] ---- time.rs - time::Duration::NANOSECOND (line 102) stdout ----
[01:31:49] error[E0658]: use of unstable library feature 'duration_constants' (see issue #57391)
[01:31:49]  --> time.rs:105:12
[01:31:49]   |
[01:31:49] 6 | assert_eq!(Duration::NANOSECOND, Duration::from_nanos(1));
[01:31:49]   |
[01:31:49]   = help: add #![feature(duration_constants)] to the crate attributes to enable
[01:31:49] 
[01:31:49] thread 'time.rs - time::Duration::NANOSECOND (line 102)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
[01:31:49] thread 'time.rs - time::Duration::NANOSECOND (line 102)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
[01:31:49] 
[01:31:49] ---- time.rs - time::Duration::SECOND (line 66) stdout ----
[01:31:49] error[E0658]: use of unstable library feature 'duration_constants' (see issue #57391)
[01:31:49]  --> time.rs:69:12
[01:31:49]   |
[01:31:49] 6 | assert_eq!(Duration::SECOND, Duration::from_secs(1));
[01:31:49]   |
[01:31:49]   = help: add #![feature(duration_constants)] to the crate attributes to enable
[01:31:49] 
[01:31:49] thread 'time.rs - time::Duration::SECOND (line 66)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13
---
[01:31:49] 
[01:31:49] error: test failed, to rerun pass '--doc'
[01:31:49] 
[01:31:49] 
[01:31:49] 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" "core" "--" "--quiet"
[01:31:49] 
[01:31:49] 
[01:31:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:31:49] Build completed unsuccessfully in 0:27:01
[01:31:49] Build completed unsuccessfully in 0:27:01
[01:31:49] make: *** [check] Error 1
[01:31:49] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2607f246
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Feb 20 22:33:25 UTC 2019
---
travis_time:end:0919f182:start=1550702007407071609,finish=1550702007411498413,duration=4426804
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:14deaea9
$ ln -s . checkout && for CORE 

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)

@oli-obk
Copy link
Contributor

oli-obk commented Feb 21, 2019

👍

@bors r+

@bors
Copy link
Contributor

bors commented Feb 21, 2019

📌 Commit c6d24cd has been approved by oli-obk

@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 21, 2019
@Centril
Copy link
Contributor

Centril commented Feb 23, 2019

@bors rollup

Centril added a commit to Centril/rust that referenced this pull request Feb 23, 2019
…iated, r=oli-obk

Turn duration consts into associated consts

As suggested in rust-lang#57391 (comment), I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block.

cc @frewsxcv @SimonSapin
Centril added a commit to Centril/rust that referenced this pull request Feb 23, 2019
…iated, r=oli-obk

Turn duration consts into associated consts

As suggested in rust-lang#57391 (comment), I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block.

cc @frewsxcv @SimonSapin
Centril added a commit to Centril/rust that referenced this pull request Feb 23, 2019
…iated, r=oli-obk

Turn duration consts into associated consts

As suggested in rust-lang#57391 (comment), I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block.

cc @frewsxcv @SimonSapin
Centril added a commit to Centril/rust that referenced this pull request Feb 23, 2019
…iated, r=oli-obk

Turn duration consts into associated consts

As suggested in rust-lang#57391 (comment), I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block.

cc @frewsxcv @SimonSapin
Centril added a commit to Centril/rust that referenced this pull request Feb 23, 2019
…iated, r=oli-obk

Turn duration consts into associated consts

As suggested in rust-lang#57391 (comment), I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block.

cc @frewsxcv @SimonSapin
bors added a commit that referenced this pull request Feb 23, 2019
Rollup of 16 pull requests

Successful merges:

 - #58100 (Transition librustdoc to Rust 2018)
 - #58122 (RangeInclusive internal iteration performance improvement.)
 - #58199 (Add better error message for partial move)
 - #58227 (Updated RELEASES.md for 1.33.0)
 - #58353 (Check the Self-type of inherent associated constants)
 - #58453 (SGX target: fix panic = abort)
 - #58476 (Remove `LazyTokenStream`.)
 - #58526 (Special suggestion for illegal unicode curly quote pairs)
 - #58595 (Turn duration consts into associated consts)
 - #58609 (Allow Self::Module to be mutated.)
 - #58628 (Optimise vec![false; N] to zero-alloc)
 - #58643 (Don't generate minification variables if minification disabled)
 - #58648 (Update tests to account for cross-platform testing and miri.)
 - #58654 (Do not underflow after resetting unmatched braces count)
 - #58658 (Add expected/provided byte alignments to validation error message)
 - #58667 (Reduce Miri-related Code Repetition `like (n << amt) >> amt`)

Failed merges:

r? @ghost
@bors bors merged commit c6d24cd into rust-lang:master Feb 23, 2019
@ghost ghost deleted the make-duration-consts-associated branch February 23, 2019 18:07
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants