Skip to content

Rollup of 7 pull requests #111283

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 21 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

jyn514 and others added 21 commits April 29, 2023 06:39
This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

- Switch clippy to the new hook

  This also adds a `extra_info` callback so clippy can include its own version number, which differs
  from rustc's.

- Call `install_ice_hook` in rustfmt
When we're adding a method to a type DIE, we only want a DW_AT_declaration
there, because LLVM LTO can't unify type definitions when a child DIE is a
full subprogram definition. Now the subprogram definition gets added at the
CU level with a specification link back to the abstract declaration.
UTF-8 checking in `const fn`-stabilized back in 1.63, but apparently somehow ASCII checking was never const-ified, despite being simpler.
… r=lcnr

Use fulfillment to check `Drop` impl compatibility

Use an `ObligationCtxt` to ensure that a `Drop` impl does not have stricter requirements than the ADT that it's implemented for, rather than using a `SimpleEqRelation` to (more or less) syntactically equate predicates on an ADT with predicates on an impl.

r? types

### Some background

The old code reads:

```rust
// An earlier version of this code attempted to do this checking
// via the traits::fulfill machinery. However, it ran into trouble
// since the fulfill machinery merely turns outlives-predicates
// 'a:'b and T:'b into region inference constraints. It is simpler
// just to look for all the predicates directly.
```

I'm not sure what this means, but perhaps in the 8 years since that this comment was written (cc rust-lang#23638) it's gotten easier to process region constraints after doing fulfillment? I don't know how this logic differs from anything we do in the `compare_impl_item` module. Ironically, later on it says:

```rust
// However, it may be more efficient in the future to batch
// the analysis together via the fulfill (see comment above regarding
// the usage of the fulfill machinery), rather than the
// repeated `.iter().any(..)` calls.
```

Also:
* Removes `SimpleEqRelation` which was far too syntactical in its relation.
* Fixes rust-lang#110557
Add Terminator conversion from MIR to SMIR, part #1

This adds internal MIR TerminatorKind to SMIR Terminator conversion.

r? ``@oli-obk``
Make the BUG_REPORT_URL configurable by tools

This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

I haven't changed clippy in case they want to make the change upstream instead of the subtree, but
I'm happy to do so here if the maintainers want - cc ```@rust-lang/clippy```

Fixes rust-lang#109486.
…michaelwoerister

debuginfo: split method declaration and definition

When we're adding a method to a type DIE, we only want a DW_AT_declaration
there, because LLVM LTO can't unify type definitions when a child DIE is a
full subprogram definition. Now the subprogram definition gets added at the
CU level with a specification link back to the abstract declaration.

Both GCC and Clang write debuginfo this way for C++ class methods.

Fixes rust-lang#109730.
Fixes rust-lang#109934.
Constify `[u8]::is_ascii` (unstably)

UTF-8 checking in `const fn`-stabilized back in 1.63 (rust-lang#97367), but apparently somehow ASCII checking was never const-ified, despite being simpler.

New constness-tracking issue for `is_ascii`: rust-lang#111090

I noticed this working on `ascii::Char`: rust-lang#110998
…mpiler-errors

add hint for =< as <=

Adds a compiler hint for when `=<` is typed instead of `<=`

Example hint:
```rust
fn foo() {
    if 1 =< 3 {
        println!("Hello, World!");
    }
}
```
```
error: expected type, found `3`
 --> main.rs:2:13
  |
2 |     if 1 =< 3 {
  |          -- ^ expected type
  |          |
  |          help: did you mean: `<=`
```

This PR only emits the suggestion if there is no space between the `=` and `<`.  This hopefully narrows the scope of when this error is emitted, however this still allows this error to be emitted in cases such as this:
```
error: expected expression, found `;`
 --> main.rs:2:18
  |
2 |     if 1 =< [i32;; 3]>::hello() {
  |          --      ^ expected expression
  |          |
  |          help: did you mean: `<=`
```

Which could be a good reason not to merge since I haven't been able to think of any other ways of narrowing the scope of this diagnostic.

closes rust-lang#111128
… r=cjgillot

More robust debug assertions for `Instance::resolve` on built-in traits with non-standard trait items

In rust-lang#111264, a user added a new item to the `Future` trait, but the code in [`resolve_associated_item`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ty_utils/instance/fn.resolve_associated_item.html) implicitly assumes that the `Future` trait is defined with only one method (`Future::poll`) and treats the generator body as the implementation of that method.

This PR adds some debug assertions to make sure that that new methods defined on `Future`/`Generator`/etc. don't accidentally resolve to the wrong item when they are added, and adds a helpful comment guiding a compiler dev (or curious `#![no_core]` user) to what must be done to support adding new associated items to these built-in implementations.

I am open to discuss whether a test should be added, but I chose against it because I opted to make these `bug!()`s instead of, e.g., diagnostics or fatal errors. Arguably it doesn't need a test because it's not a bug that can be triggered by an end user, and internal-facing misuses of core kind of touch on rust-lang/compiler-team#620 -- however, I think the assertions I added in this PR are still a very useful way to make sure this bug doesn't waste debugging resources down the line.

Fixes rust-lang#111264
@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels May 6, 2023
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Collaborator

bors commented May 6, 2023

📌 Commit 1783a35 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 May 6, 2023
@bors
Copy link
Collaborator

bors commented May 6, 2023

⌛ Testing commit 1783a35 with merge 414ee199efc9564d48be83b772c7a755b694b7c5...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
      System Firmware Version: VMW71.00V.13989454.B64.1906190538
      OS Loader Version: 540.120.3~22
      Apple ROM Info: [MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]Welcome to the Virtual Machine
      SMC Version (system): 2.8f0
      Serial Number (system): VMA5jilobsBU
      Provisioning UDID: 4203018E-580F-C1B5-9525-B745CECA79EB

hw.ncpu: 3
hw.byteorder: 1234
---
failures:

---- [assembly] tests/assembly/slice-is_ascii.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/ci-llvm/bin/FileCheck" "--input-file" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/assembly/slice-is_ascii/slice-is_ascii.s" "/Users/runner/work/rust/rust/tests/assembly/slice-is_ascii.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC" "--dump-input-context" "100"
stdout: none
/Users/runner/work/rust/rust/tests/assembly/slice-is_ascii.rs:20:12: error: CHECK: expected string not found in input
/Users/runner/work/rust/rust/tests/assembly/slice-is_ascii.rs:20:12: error: CHECK: expected string not found in input
 // CHECK: .[[LOOPHEAD:.+]]:
           ^
/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/assembly/slice-is_ascii/slice-is_ascii.s:6:23: note: scanning from here
_is_ascii_simple_demo:
                      ^
/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/assembly/slice-is_ascii/slice-is_ascii.s:14:1: note: possible intended match here
LBB0_1:

Input file: /Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/assembly/slice-is_ascii/slice-is_ascii.s
Check file: /Users/runner/work/rust/rust/tests/assembly/slice-is_ascii.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
            1:  .section __TEXT,__text,regular,pure_instructions 
            2:  .macosx_version_min 10, 8 
            3:  .intel_syntax noprefix 
            4:  .globl _is_ascii_simple_demo 
            5:  .p2align 4, 0x90 
            6: _is_ascii_simple_demo: 
check:20'0                           X error: no match found
            7:  .cfi_startproc 
check:20'0     ~~~~~~~~~~~~~~~~
            8:  push rbp 
check:20'0     ~~~~~~~~~~
            9:  .cfi_def_cfa_offset 16 
check:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~
           10:  .cfi_offset rbp, -16 
check:20'0     ~~~~~~~~~~~~~~~~~~~~~~
           11:  mov rbp, rsp 
check:20'0     ~~~~~~~~~~~~~~
           12:  .cfi_def_cfa_register rbp 
check:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13:  .p2align 4, 0x90 
check:20'0     ~~~~~~~~~~~~~~~~~~
           14: LBB0_1: 
check:20'0     ~~~~~~~~
check:20'1     ?        possible intended match
           15:  mov rax, rsi 
check:20'0     ~~~~~~~~~~~~~~
           16:  sub rsi, 1 
check:20'0     ~~~~~~~~~~~~
           17:  jb LBB0_3 
check:20'0     ~~~~~~~~~~~
           18:  cmp byte ptr [rdi + rax - 1], 0 
check:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           19:  jns LBB0_1 
check:20'0     ~~~~~~~~~~~~
           20: LBB0_3: 
check:20'0     ~~~~~~~~
           21:  test rax, rax 
check:20'0     ~~~~~~~~~~~~~~~
           22:  sete al 
check:20'0     ~~~~~~~~~
           23:  pop rbp 
check:20'0     ~~~~~~~~~
           24:  ret 
check:20'0     ~~~~~
           25:  .cfi_endproc 
check:20'0     ~~~~~~~~~~~~~~
           26:  
check:20'0     ~
           27: .subsections_via_symbols 
check:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------------



@bors
Copy link
Collaborator

bors commented May 6, 2023

💔 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 May 6, 2023
@matthiaskrgr matthiaskrgr deleted the rollup-3iadz93 branch March 16, 2024 18:18
# 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants