Commit 4910642
committed
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)1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| 913 | + | |
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
916 | 917 | | |
917 | 918 | | |
918 | 919 | | |
919 | 920 | | |
| 921 | + | |
920 | 922 | | |
921 | 923 | | |
922 | 924 | | |
| |||
926 | 928 | | |
927 | 929 | | |
928 | 930 | | |
| 931 | + | |
929 | 932 | | |
930 | 933 | | |
931 | 934 | | |
932 | 935 | | |
933 | 936 | | |
934 | 937 | | |
935 | 938 | | |
| 939 | + | |
936 | 940 | | |
937 | 941 | | |
938 | 942 | | |
| |||
942 | 946 | | |
943 | 947 | | |
944 | 948 | | |
| 949 | + | |
945 | 950 | | |
946 | 951 | | |
947 | 952 | | |
| |||
951 | 956 | | |
952 | 957 | | |
953 | 958 | | |
| 959 | + | |
954 | 960 | | |
955 | 961 | | |
956 | 962 | | |
957 | 963 | | |
958 | 964 | | |
959 | 965 | | |
960 | 966 | | |
| 967 | + | |
961 | 968 | | |
962 | 969 | | |
963 | 970 | | |
| |||
967 | 974 | | |
968 | 975 | | |
969 | 976 | | |
| 977 | + | |
970 | 978 | | |
971 | 979 | | |
972 | 980 | | |
973 | 981 | | |
974 | 982 | | |
975 | 983 | | |
976 | 984 | | |
| 985 | + | |
977 | 986 | | |
978 | 987 | | |
979 | 988 | | |
| |||
0 commit comments