Skip to content

Rollup of 4 pull requests #135569

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 14 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

s-cerevisiae and others added 14 commits January 8, 2025 18:58
Apply eta-reduction on map to simplify code and make the style more
consistent
Changes the behavior of the `overflowing_literals` suggestion so that it
always suggest the smallest type regardless of the original type size.
The change between 0.1.143 and 0.1.144 includes refactoring that was in
compiler-builtins before, but had to be reverted before landing in
rust-lang/rust because the traits were leaking into diagnostics [1].
Recently a fix for this issue was merged [2] so the cleanup is reapplied
here.

This also acts as a regression test for [2].

[1]: rust-lang#128691 (comment)
[2]: rust-lang#135278
…als-help, r=chenyukang

Fix overflows in the implementation of `overflowing_literals` lint's help

This PR fixes two overflow problems that cause the `overflowing_literals` lint to behave incorrectly in some edge cases.

1. When an integer literal is between `i128::MAX` and `u128::MAX`, an overflowing `as` cast can cause the suggested type to be overly small. It's fixed by using checked type conversion and returning `u128` when it's the only choice. (Fixes rust-lang#135248)
2. When an integer literal is `i128::MIN` but is of a smaller type, an overflowing negation cause the compiler to panic in debug build. Fixed by checking the number size beforehand and `wrapping_neg`. (Fixes rust-lang#131849)

Edit: extracted the type conversion part into a standalone function to separate the concern of overflowing.
…gross35

use indirect return for `i128` and `f128` on wasm32

fixes rust-lang#135532

Based on https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md we now use an indirect return for  `i128`, `u128` and `f128`. That is what LLVM ended up doing anyway.

r? ``@bjorn3``
Clarify note in `std::sync::LazyLock` example

I doubt most people know what it means, as I did not until a week ago. In the current form, it seems like a `TODO:`.
Update `compiler-builtins` to 0.1.144

The change between 0.1.143 and 0.1.144 includes refactoring that was in compiler-builtins before, but had to be reverted before landing in rust-lang/rust because the traits were leaking into diagnostics [1]. Recently a fix for this issue was merged [2] so the cleanup is reapplied here.

This also acts as a regression test for [2].

[1]: rust-lang#128691 (comment)
[2]: rust-lang#135278
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jan 16, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=4

@bors
Copy link
Collaborator

bors commented Jan 16, 2025

📌 Commit c0b543b has been approved by matthiaskrgr

It is now in the queue for this repository.

@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 Jan 16, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 16, 2025
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#135249 (Fix overflows in the implementation of `overflowing_literals` lint's help)
 - rust-lang#135534 (use indirect return for `i128` and `f128` on wasm32)
 - rust-lang#135556 (Clarify note in `std::sync::LazyLock` example)
 - rust-lang#135560 (Update `compiler-builtins` to 0.1.144)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Jan 16, 2025

⌛ Testing commit c0b543b with merge 049d780...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-nopt failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [codegen] tests/codegen/zip.rs ... ok

failures:

---- [codegen] tests/codegen/f128-wasm32-callconv.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/f128-wasm32-callconv/f128-wasm32-callconv.ll" "/checkout/tests/codegen/f128-wasm32-callconv.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
--- stderr -------------------------------
--- stderr -------------------------------
/checkout/tests/codegen/f128-wasm32-callconv.rs:23:17: error: CHECK-SAME: expected string not found in input
 // CHECK-SAME: fp128 noundef %arg1
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/f128-wasm32-callconv/f128-wasm32-callconv.ll:7:29: note: scanning from here
define dso_local void @pass(i32 %_arg0, fp128 %arg1) unnamed_addr #0 {
                            ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/f128-wasm32-callconv/f128-wasm32-callconv.ll:9:25: note: possible intended match here
 call void @extern_call(fp128 %arg1) #1


Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/f128-wasm32-callconv/f128-wasm32-callconv.ll
Check file: /checkout/tests/codegen/f128-wasm32-callconv.rs

-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
           1: ; ModuleID = 'f128_wasm32_callconv.c110260781031043-cgu.0' 
           2: source_filename = "f128_wasm32_callconv.c110260781031043-cgu.0" 
           3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 
           5:  
           6: ; Function Attrs: nounwind 
           6: ; Function Attrs: nounwind 
           7: define dso_local void @pass(i32 %_arg0, fp128 %arg1) unnamed_addr #0 { 
same:23'0                                 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
           8: start: 
same:23'0     ~~~~~~~
           9:  call void @extern_call(fp128 %arg1) #1 
same:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
same:23'1                             ?                possible intended match
          10:  ret void 
same:23'0     ~~~~~~~~~~
          11: } 
same:23'0     ~~
          12:  
same:23'0     ~
          13: ; Function Attrs: nounwind 
same:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          14: define dso_local void @ret(ptr sret([16 x i8]) align 16 %_0, i32 %_arg0, fp128 %arg1) unnamed_addr #0 { 
same:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          15: start: 
          16:  store fp128 %arg1, ptr %_0, align 16 
          17:  ret void 
          18: } 
          20: ; Function Attrs: nounwind 
          20: ; Function Attrs: nounwind 
          21: define dso_local void @forward(ptr %dst) unnamed_addr #0 { 
          23:  %0 = alloca [16 x i8], align 16 
          23:  %0 = alloca [16 x i8], align 16 
          24:  call void @extern_ret(ptr sret([16 x i8]) align 16 %0) #1 
          25:  %_2 = load fp128, ptr %0, align 16 
          26:  store fp128 %_2, ptr %dst, align 16 
          27:  ret void 
          28: } 
          30: ; Function Attrs: nounwind 
          30: ; Function Attrs: nounwind 
          31: declare dso_local void @extern_call(fp128) unnamed_addr #0 
          33: ; Function Attrs: nounwind 
          33: ; Function Attrs: nounwind 
          34: declare dso_local void @extern_ret(ptr sret([16 x i8]) align 16) unnamed_addr #0 
          35:  
          36: attributes #0 = { nounwind "target-cpu"="generic" } 
          37: attributes #1 = { nounwind } 
          38:  
          39: !llvm.ident = !{!0} 
          40:  
          41: !0 = !{!"rustc version 1.86.0-nightly (049d780c1 2025-01-16)"} 
------------------------------------------


---- [codegen] tests/codegen/i128-wasm32-callconv.rs stdout ----
---- [codegen] tests/codegen/i128-wasm32-callconv.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/i128-wasm32-callconv/i128-wasm32-callconv.ll" "/checkout/tests/codegen/i128-wasm32-callconv.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
--- stderr -------------------------------
--- stderr -------------------------------
/checkout/tests/codegen/i128-wasm32-callconv.rs:23:17: error: CHECK-SAME: expected string not found in input
 // CHECK-SAME: i128 noundef %arg1
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/i128-wasm32-callconv/i128-wasm32-callconv.ll:7:29: note: scanning from here
define dso_local void @pass(i32 %_arg0, i128 %arg1) unnamed_addr #0 {
                            ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/i128-wasm32-callconv/i128-wasm32-callconv.ll:9:25: note: possible intended match here
 call void @extern_call(i128 %arg1) #1


Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/i128-wasm32-callconv/i128-wasm32-callconv.ll
Check file: /checkout/tests/codegen/i128-wasm32-callconv.rs

-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
           1: ; ModuleID = 'i128_wasm32_callconv.4380b968d8170b44-cgu.0' 
           2: source_filename = "i128_wasm32_callconv.4380b968d8170b44-cgu.0" 
           3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 
           5:  
           6: ; Function Attrs: nounwind 
           6: ; Function Attrs: nounwind 
           7: define dso_local void @pass(i32 %_arg0, i128 %arg1) unnamed_addr #0 { 
same:23'0                                 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
           8: start: 
same:23'0     ~~~~~~~
           9:  call void @extern_call(i128 %arg1) #1 
same:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
same:23'1                             ?               possible intended match
          10:  ret void 
same:23'0     ~~~~~~~~~~
          11: } 
same:23'0     ~~
          12:  
same:23'0     ~
          13: ; Function Attrs: nounwind 
same:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          14: define dso_local void @ret(ptr sret([16 x i8]) align 16 %_0, i32 %_arg0, i128 %arg1) unnamed_addr #0 { 
same:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
          15: start: 
          16:  store i128 %arg1, ptr %_0, align 16 
          17:  ret void 
          18: } 
          20: ; Function Attrs: nounwind 
          20: ; Function Attrs: nounwind 
          21: define dso_local void @forward(ptr %dst) unnamed_addr #0 { 
          23:  %0 = alloca [16 x i8], align 16 
          23:  %0 = alloca [16 x i8], align 16 
          24:  call void @extern_ret(ptr sret([16 x i8]) align 16 %0) #1 
          25:  %_2 = load i128, ptr %0, align 16 
          26:  store i128 %_2, ptr %dst, align 16 
          27:  ret void 
          28: } 
          30: ; Function Attrs: nounwind 
          30: ; Function Attrs: nounwind 
          31: declare dso_local void @extern_call(i128) unnamed_addr #0 
          33: ; Function Attrs: nounwind 
          33: ; Function Attrs: nounwind 
          34: declare dso_local void @extern_ret(ptr sret([16 x i8]) align 16) unnamed_addr #0 
          35:  
          36: attributes #0 = { nounwind "target-cpu"="generic" } 
          37: attributes #1 = { nounwind } 
          38:  
          39: !llvm.ident = !{!0} 
          40:  
          41: !0 = !{!"rustc version 1.86.0-nightly (049d780c1 2025-01-16)"} 
------------------------------------------



@bors
Copy link
Collaborator

bors commented Jan 16, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 16, 2025
@matthiaskrgr matthiaskrgr deleted the rollup-8vs4lv6 branch January 25, 2025 09:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants