about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/example/std_example.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-04 01:49:24 +0000
committerbors <bors@rust-lang.org>2023-10-04 01:49:24 +0000
commit4910642aab5c6230dfbf0cafb382700ed3001dab (patch)
treea012c5636476ff11ddbfe056fb27a3c9b5b7121c /compiler/rustc_codegen_cranelift/example/std_example.rs
parent79f38b79147a5fb3c52d1fd1afc571226a77419c (diff)
parent92c9bcdff463e59ee5ff9355dd4511b0f3427e6b (diff)
downloadrust-4910642aab5c6230dfbf0cafb382700ed3001dab.tar.gz
rust-4910642aab5c6230dfbf0cafb382700ed3001dab.zip
Auto merge of #116386 - elichai:patch-2, r=thomcc
Add missing inline attributes to Duration trait impls

Currently `Duration::checked_add` is marked `#[inline]` but it's trait relative `Add::add` is not.
Leading to a case where:
```rust
pub fn foo() -> Duration {
    Duration::from_secs(10) + Duration::from_millis(6)
}

pub fn bar() -> Duration {
    Duration::from_secs(10).checked_add(Duration::from_millis(6)).expect("overflow when adding durations")
}
```
compiles to:
```asm

playground::foo:
	movl	$10, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	movl	$6000000, %ecx
	jmpq	*<core::time::Duration as core::ops::arith::Add>::add@GOTPCREL(%rip)

playground::bar:
	movl	$10, %eax
	movl	$6000000, %edx
	retq
```
(The same happens for all arithmetic operation)
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions