Skip to content
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

Rollup of 8 pull requests #130461

Closed
wants to merge 32 commits into from

Conversation

fee1-dead
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

GKFX and others added 30 commits August 11, 2024 09:10
On LLVM 20, these instructions already get eliminated, which at least
partially satisfies a TODO. I'm not talented enough at using FileCheck
to try and constrain this further, but if we really want to we could
copy an LLVM 20 specific version of this test that would restore it to
being CHECK-NEXT: insertvalue ...

@rustbot label: +llvm-main
This makes it much clearer which things are used outside the crate.
Reflow overly long comments, plus some minor whitespace improvements.
Because `bx` contains a `cx`.
`'mir` is not a good lifetime name in `LocalAnalyzer`, because it's used
on two unrelated fields. `'a` is more standard for a situation like this
(e.g. rust-lang#130022).
…option, r=jieyouxu

Fix rust-lang#128930: Print documentation of CLI options missing their arg

Fix rust-lang#128930. Failing to give an argument to CLI options which require it now prints something like:
```
$ rustc --print
error: Argument to option 'print' missing
       Usage:
           --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target]
                               Compiler information to print on stdout
```
… r=lcnr

Relate receiver invariantly in method probe for `Mode::Path`

Effectively reverts part of rust-lang#126128
Fixes rust-lang#126227

This PR changes method probing to use equality for fully path-based method lookup, and subtyping for receiver `.` method lookup.

r? lcnr
… r=dtolnay

Add new_cyclic_in for Rc and Arc

Currently, new_cyclic_in does not exist for Rc and Arc. This is an oversight according to rust-lang/wg-allocators#132.

This PR adds new_cyclic_in for Rc and Arc. The implementation is almost the exact same as new_cyclic with some small differences to make it allocator-specific. new_cyclic's implementation has been replaced with a call to `new_cyclic_in(data_fn, Global)`.

Remaining questions:
* ~~Is requiring Allocator to be Clone OK? According to rust-lang/wg-allocators#88, Allocators should be cheap to clone. I'm just hesitant to add unnecessary constraints, though I don't see an obvious workaround for this function since many called functions in new_cyclic_in expect an owned Allocator. I see Allocator.by_ref() as an option, but that doesn't work on when creating Weak { ptr: init_ptr, alloc: alloc.clone() }, because the type of Weak then becomes Weak<T, &A> which is incompatible.~~ Fixed, thank you `@zakarumych!` This PR no longer requires the allocator to be Clone.
* Currently, new_cyclic_in's documentation is almost entirely copy-pasted from new_cyclic, with minor tweaks to make it more accurate (e.g. Rc<T> -> Rc<T, A>). The example section is removed to mitigate redundancy and instead redirects to cyclic_in. Is this appropriate?
* ~~The comments in new_cyclic_in (and much of the implementation) are also copy-pasted from new_cyclic. Would it be better to make a helper method new_cyclic_in_internal that both functions call, with either Global or the custom allocator? I'm not sure if that's even possible, since the internal method would have to return Arc<T, Global> and I don't know if it's possible to "downcast" that to an Arc<T>. Maybe transmute would work here?~~ Done, thanks `@zakarumych`
* Arc::new_cyclic is #[inline], but Rc::new_cyclic is not. Which is preferred?
* nit: does it matter where in the impl block new_cyclic_in is defined?
…body, r=lcnr

Encode `coroutine_by_move_body_def_id` in crate metadata

We synthesize the MIR for a by-move body for the `FnOnce` implementation of async closures. It can be accessed with the `coroutine_by_move_body_def_id` query. We weren't encoding this query in the metadata though, nor were we properly recording that synthetic MIR in `mir_keys`, so the `optimized_mir` wasn't getting encoded either!

Stacked on top is a fix to consider `DefKind::SyntheticCoroutineBody` to return true in several places I missed. Specifically, we should consider the def-kind in `fn DefKind::is_fn_like()`, since that's what we were using to make sure we ensure `query mir_inliner_callees` before the MIR gets stolen for the body. This led to some CI failures that were caught by miri but which I added a test for.
Don't call `extern_crate` when local crate name is the same as a dependency and we have a trait error

rust-lang#124944 implemented logic to point out when a trait bound failure involves a *trait* and *type* who come from identically named but different crates. This logic calls the `extern_crate` query which is not valid on `LOCAL_CRATE` cnum, so let's filter that out eagerly.

Fixes rust-lang#130272
Fixes rust-lang#129184
…en, r=jieyouxu

Don't ICE in `opaque_hidden_inferred_bound` lint for RPITIT in trait with no default method body

Inline comment should explain the fix.

Fixes rust-lang#130422
…jubilee

tests: allow trunc/select instructions to be missing

On LLVM 20, these instructions already get eliminated, which at least partially satisfies a TODO. I'm not talented enough at using FileCheck to try and constrain this further, but if we really want to we could copy an LLVM 20 specific version of this test that would restore it to being CHECK-NEXT: insertvalue ...

`@rustbot` label: +llvm-main
r? `@DianQK`
…nups, r=jieyouxu

`rustc_codegen_ssa` cleanups

Just some minor improvements I found while reading through this code.

r? `@jieyouxu`
@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 Sep 17, 2024
@fee1-dead
Copy link
Member Author

@bors r+ p=8 rollup=never

@bors
Copy link
Contributor

bors commented Sep 17, 2024

📌 Commit 50fd6ce has been approved by fee1-dead

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 Sep 17, 2024
@bors
Copy link
Contributor

bors commented Sep 17, 2024

⌛ Testing commit 50fd6ce with merge 466c6fd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2024
…fee1-dead

Rollup of 8 pull requests

Successful merges:

 - rust-lang#128961 (Fix rust-lang#128930: Print documentation of CLI options missing their arg)
 - rust-lang#129073 (Relate receiver invariantly in method probe for `Mode::Path`)
 - rust-lang#129674 (Add new_cyclic_in for Rc and Arc)
 - rust-lang#130201 (Encode `coroutine_by_move_body_def_id` in crate metadata)
 - rust-lang#130275 (Don't call `extern_crate` when local crate name is the same as a dependency and we have a trait error)
 - rust-lang#130440 (Don't ICE in `opaque_hidden_inferred_bound` lint for RPITIT in trait with no default method body)
 - rust-lang#130454 (tests: allow trunc/select instructions to be missing)
 - rust-lang#130458 (`rustc_codegen_ssa` cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19 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/transmute-optimized.rs ... ok
test [codegen] tests/codegen/tune-cpu-on-functions.rs ... ok
test [codegen] tests/codegen/thread-local.rs ... ok
test [codegen] tests/codegen/tuple-layout-opt.rs ... ok
test [codegen] tests/codegen/try_question_mark_nop.rs#NINETEEN ... FAILED
test [codegen] tests/codegen/unchecked-float-casts.rs ... ok
test [codegen] tests/codegen/union-abi.rs#x86 ... ignored, only executed when the architecture is x86
test [codegen] tests/codegen/ub-checks.rs#NOCHECKS ... ok
test [codegen] tests/codegen/unwind-abis/aapcs-unwind-abi.rs ... ok
---
test [codegen] tests/codegen/thin-lto.rs ... ok

failures:

---- [codegen] tests/codegen/try_question_mark_nop.rs#NINETEEN stdout ----

error in revision `NINETEEN`: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/try_question_mark_nop.NINETEEN/try_question_mark_nop.ll" "/checkout/tests/codegen/try_question_mark_nop.rs" "--check-prefix=CHECK" "--check-prefix" "NINETEEN" "--check-prefix" "NONMSVC" "--allow-unused-prefixes" "--dump-input-context" "100"
--- stderr -------------------------------
/checkout/tests/codegen/try_question_mark_nop.rs:21:17: error: CHECK-NEXT: expected string not found in input
/checkout/tests/codegen/try_question_mark_nop.rs:21:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: insertvalue { i32, i32 } poison, i32 %0, 0
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/try_question_mark_nop.NINETEEN/try_question_mark_nop.ll:10:31: note: scanning from here
 %. = select i1 %trunc, i32 %0, i32 0
                              ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/try_question_mark_nop.NINETEEN/try_question_mark_nop.ll:11:7: note: possible intended match here
 %2 = insertvalue { i32, i32 } poison, i32 %., 0


Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/try_question_mark_nop.NINETEEN/try_question_mark_nop.ll


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
           1: ; ModuleID = 'try_question_mark_nop.e67e5ea31bdd6ce8-cgu.0' 
           2: source_filename = "try_question_mark_nop.e67e5ea31bdd6ce8-cgu.0" 
           3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
           4: target triple = "x86_64-unknown-linux-gnu" 
           5:  
           6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
           7: define { i32, i32 } @option_nop_match_32(i32 noundef range(i32 0, 2) %0, i32 %1) unnamed_addr #0 { 
           8: start: 
           9:  %trunc = trunc nuw i32 %0 to i1 
          10:  %. = select i1 %trunc, i32 %0, i32 0 
next:21'0                                   X~~~~~~~ error: no match found
          11:  %2 = insertvalue { i32, i32 } poison, i32 %., 0 
next:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:21'1           ?                                           possible intended match
          12:  %3 = insertvalue { i32, i32 } %2, i32 %1, 1 
next:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          13:  ret { i32, i32 } %3 
next:21'0     ~~~~~~~~~~~~~~~~~~~~~
          14: } 
next:21'0     ~~
          15:  
next:21'0     ~
          16: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
next:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          17: define { i32, i32 } @option_nop_traits_32(i32 noundef range(i32 0, 2) %0, i32 %1) unnamed_addr #0 { 
next:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          18: start: 
          19:  %2 = insertvalue { i32, i32 } poison, i32 %0, 0 
          20:  %3 = insertvalue { i32, i32 } %2, i32 %1, 1 
          21:  ret { i32, i32 } %3 
          22: } 
          23:  
          24: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          25: define { i32, i32 } @result_nop_match_32(i32 noundef range(i32 0, 2) %0, i32 noundef %1) unnamed_addr #0 { 
          26: start: 
          27:  %2 = insertvalue { i32, i32 } poison, i32 %0, 0 
          28:  %3 = insertvalue { i32, i32 } %2, i32 %1, 1 
          29:  ret { i32, i32 } %3 
          30: } 
          31:  
          32: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          33: define { i32, i32 } @result_nop_traits_32(i32 noundef range(i32 0, 2) %0, i32 noundef %1) unnamed_addr #0 { 
          34: start: 
          35:  %2 = insertvalue { i32, i32 } poison, i32 %0, 0 
          36:  %3 = insertvalue { i32, i32 } %2, i32 %1, 1 
          37:  ret { i32, i32 } %3 
          38: } 
          39:  
          40: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          41: define { i64, i64 } @result_nop_match_64(i64 noundef range(i64 0, 2) %0, i64 noundef %1) unnamed_addr #0 { 
          42: start: 
          43:  %2 = insertvalue { i64, i64 } poison, i64 %0, 0 
          44:  %3 = insertvalue { i64, i64 } %2, i64 %1, 1 
          45:  ret { i64, i64 } %3 
          46: } 
          47:  
          48: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          49: define { i64, i64 } @result_nop_traits_64(i64 noundef range(i64 0, 2) %0, i64 noundef %1) unnamed_addr #0 { 
          50: start: 
          51:  %2 = insertvalue { i64, i64 } poison, i64 %0, 0 
          52:  %3 = insertvalue { i64, i64 } %2, i64 %1, 1 
          53:  ret { i64, i64 } %3 
          54: } 
          55:  
          56: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          57: define { i64, ptr } @result_nop_match_ptr(i64 noundef range(i64 0, 2) %0, ptr noundef %1) unnamed_addr #0 { 
          58: start: 
          59:  %2 = insertvalue { i64, ptr } poison, i64 %0, 0 
          60:  %3 = insertvalue { i64, ptr } %2, ptr %1, 1 
          61:  ret { i64, ptr } %3 
          62: } 
          63:  
          64: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          65: define { i64, ptr } @result_nop_traits_ptr(i64 noundef range(i64 0, 2) %0, ptr noundef %1) unnamed_addr #0 { 
          66: start: 
          67:  %2 = insertvalue { i64, ptr } poison, i64 %0, 0 
          68:  %3 = insertvalue { i64, ptr } %2, ptr %1, 1 
          69:  ret { i64, ptr } %3 
          70: } 
          71:  
          72: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          73: define { i32, i32 } @control_flow_nop_match_32(i32 noundef range(i32 0, 2) %0, i32 noundef %1) unnamed_addr #0 { 
          74: start: 
          75:  %2 = insertvalue { i32, i32 } poison, i32 %0, 0 
          76:  %3 = insertvalue { i32, i32 } %2, i32 %1, 1 
          77:  ret { i32, i32 } %3 
          78: } 
          79:  
          80: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable 
          81: define { i32, i32 } @control_flow_nop_traits_32(i32 noundef range(i32 0, 2) %0, i32 noundef %1) unnamed_addr #0 { 
          82: start: 
          83:  %2 = insertvalue { i32, i32 } poison, i32 %0, 0 
          84:  %3 = insertvalue { i32, i32 } %2, i32 %1, 1 
          85:  ret { i32, i32 } %3 
          86: } 
          87:  
          88: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(none) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
          89:  
          90: !llvm.module.flags = !{!0, !1} 
          91: !llvm.ident = !{!2} 
          92:  
          93: !0 = !{i32 8, !"PIC Level", i32 2} 
          94: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
          95: !2 = !{!"rustc version 1.83.0-nightly (466c6fda1 2024-09-17)"} 
------------------------------------------




failures:
    [codegen] tests/codegen/try_question_mark_nop.rs#NINETEEN
test result: FAILED. 660 passed; 1 failed; 55 ignored; 0 measured; 0 filtered out; finished in 9.85s

Some tests failed in compiletest suite=codegen mode=codegen host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
Build completed unsuccessfully in 0:13:50

@bors
Copy link
Contributor

bors commented Sep 17, 2024

💔 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 Sep 17, 2024
@fee1-dead fee1-dead closed this Sep 17, 2024
@fee1-dead fee1-dead deleted the rollup-lbf8gqt branch September 17, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

rustc --print doesn't list valid options
9 participants