-
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
Move Duration to libcore #46666
Move Duration to libcore #46666
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
483a3cd
to
ab0b5a8
Compare
src/libcore/time.rs
Outdated
/// | ||
/// let duration = Duration::from_millis(5432); | ||
/// assert_eq!(duration.as_secs(), 5); | ||
/// assert_eq!(duration.subsec_nanos(), 432_000_000); |
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.
subsec_millis?
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.
This is part of #46508
src/libcore/time.rs
Outdated
/// | ||
/// let duration = Duration::from_micros(1_234_567); | ||
/// assert_eq!(duration.as_secs(), 1); | ||
/// assert_eq!(duration.subsec_nanos(), 234_567_000); |
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.
subsec_micros?
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.
This is part of #46508
#46508 has been merged. @clarcharr |
☔ The latest upstream changes (presumably #46874) made this pull request unmergeable. Please resolve the merge conflicts. |
ab0b5a8
to
94113b7
Compare
@kennytm Just rebased! Waiting on CI. |
src/libcore/time.rs
Outdated
@@ -7,6 +7,19 @@ | |||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |||
// option. This file may not be copied, modified, or distributed | |||
// except according to those terms. | |||
#![stable(feature = "duration", since = "1.3.0")] |
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 the module level stability here be updated to 1.24.0 with a new feature name?
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.
Not sure! My assumption is that because we're simply moving what was already stable in std to core, that we should use the same feature and version. But I can update it or mark it as unstable if desired.
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.
The type's stability definitely shouldn't change, but its placement in libcore is new. If nothing else, it's a nice indication in rustdoc as to when it first showed up.
@aturon what do you think?
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.
src/libcore/time.rs
Outdated
@@ -45,7 +58,7 @@ const MICROS_PER_SEC: u64 = 1_000_000; | |||
/// | |||
/// let ten_millis = Duration::from_millis(10); | |||
/// ``` | |||
#[stable(feature = "duration", since = "1.3.0")] | |||
#![stable(feature = "duration_core", since = "1.24.0")] |
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.
Why add the !
here...
[00:03:27] error: an inner attribute is not permitted following an outer doc comment
[00:03:27] --> /checkout/src/libcore/time.rs:61:3
[00:03:27] |
[00:03:27] 61 | #![stable(feature = "duration_core", since = "1.24.0")]
[00:03:27] | ^
[00:03:27] |
[00:03:27] = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
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 copy-pasted and shouldn't have.
c876661
to
09b6a5b
Compare
(it is passing now) |
☔ The latest upstream changes (presumably #46922) made this pull request unmergeable. Please resolve the merge conflicts. |
09b6a5b
to
3f6b8e1
Compare
@bors r+ |
📌 Commit 3f6b8e1 has been approved by |
@bors r- |
Er, actually, let's make sure the rest of the libs folks are okay with this since the move is insta-stable. @rfcbot fcp merge |
Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged teams: Concerns:
Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@alexcrichton I mean, that PR is two years old and Rust has gained a lot of Pre-1.0 I actually used a bit of Rust for a systems programming class, and although To flip the question: do you have any vague idea of what an std-requiring (to add: if |
☔ The latest upstream changes (presumably #47392) made this pull request unmergeable. Please resolve the merge conflicts. |
Ah sorry I meant to comment on this but forgot! The @rust-lang/libs team discussed this PR at triage last week and the conclusion was that we should go ahead and move forward with it. Our thinking was that we can't think of any functionality we'd really like to add to @clarcharr want to rebase before merging? @rfcbot fcp merge |
Also can you move the tests to an the |
rfcbot is not responding 😕 |
er sorry that's my mistake, it was already done above! @rfcbot resolved we-may-want-std |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Just realised that one primary use of libstd |
That was an example of what we felt wasn't necessarily critical functionality to have but something we could stabilize at a later date via other means. How does that sound to you though? |
Seems fine to me! |
So I believe the consensus here is we want to merge this, but are waiting on a rebase. Is that correct? |
Indeed! |
The final comment period is now complete. |
3f6b8e1
to
aab712c
Compare
Rebased! |
@bors: r+ |
📌 Commit aab712c has been approved by |
☀️ Test successful - status-appveyor, status-travis |
Fixes #46520; should be merged after #46508.