-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make time::Instant::actually_monotonic()
a const fn.
#65954
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
Conversation
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
Could you provide any context why this is needed? AFAIK |
This PR mainly prevents anyone from accidentally adding code which introduces runtime penalty to
note: AFAIK monotonicity only depends on platform and build configurations and won't change at runtime. |
Compile-time evaluation does not happen when const fn foo() -> bool { true }
pub fn bar() -> bool { foo() } ; playground::foo
; Function Attrs: nonlazybind uwtable
define internal zeroext i1 @_ZN10playground3foo17h3b9711775736012fE() unnamed_addr #0 !dbg !5 {
start:
ret i1 true, !dbg !10
}
; playground::bar
; Function Attrs: nonlazybind uwtable
define zeroext i1 @_ZN10playground3bar17hfc942ebdcf035a2cE() unnamed_addr #0 !dbg !11 {
start:
; call playground::foo
%0 = call zeroext i1 @_ZN10playground3foo17h3b9711775736012fE(), !dbg !12
br label %bb1, !dbg !12
bb1: ; preds = %start
ret i1 %0, !dbg !13
} EDIT: Also, |
@sinkuu Sorry, this is my mistake. But I wonder why the compiler doesn't evaluate it? |
@shamiao |
Ping from Triage: Any updates @shamiao |
@joelpalmer I have no further updates. Waiting the Rust crew to decide whether this PR should be merged. |
IMO the reason making this a
So I'd prefer to close this PR. |
@kennytm Opinion 3 seems compelling to me. I'll close this PR. |
No description provided.