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 5 pull requests #104791

Closed
wants to merge 104 commits into from
Closed

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

TiddoLangerak and others added 30 commits August 10, 2022 13:07
Previously, when triggering a method extraction from within a trait
impl block, then this would always create a new impl block for
the struct, even if there already is one. Now, it'll put the extracted
method in the matching existing block if it exists.
…it-into-impl-root, r=Veykril

Feat: extracted method from trait impl is placed in existing impl

**Before**

https://user-images.githubusercontent.com/1759192/183872883-3b0eafd2-d1dc-440e-9e66-38e3372f8b64.mp4

**After**

https://user-images.githubusercontent.com/1759192/183875769-87f34c7d-52f0-4dfc-9766-f591ee738ebb.mp4

Previously, when triggering a method extraction from within an impl trait block, then this would always create a new impl block for
the struct, even if there already is one. Now, if there is already an existing trait-less impl block, then it'll put the extracted method in there.

**Caveats**:
- It currently requires the target impl block to be non-empty. This limitation is because the current architecture takes a `node_to_insert_after` as reference for where to insert the extracted function. An empty impl block doesn't have such a reference node, since it's empty. It seems that supporting this requires a much larger and more complex change.
- This is my first contribution in rust, so apologies for any beginner mistakes.
The length of byte strings containing escaped newlines is displayed two
bytes longer when the first escaped character is a newline.

This is due to a small bug in handling the first escaped newline in
string literals.

Closes rust-lang#13567
Thanks to Lukas Wirth for a suggestion.
Bump Cargo rust-version fields to latest stable

We already depend on `let ... else` now anyways

Closes rust-lang/rust-analyzer#13562
Generalize reborrow hints as adjustment hints

Like reborrow hints, these are still mainly useful for teaching/learning

![image](https://user-images.githubusercontent.com/3757771/200073606-b5cd3b95-a9ad-454d-a3c4-d4d89bf45928.png)
…escaped-newlines, r=Veykril

Fix the length displayed for byte string literals with escaped newlines

This is a fix for the problem I reported earlier: "the length of byte strings containing escaped newlines is displayed two bytes longer when the first escaped character is a newline".

I would appreciate it if you could review the fix.
Many thanks.

Closes rust-lang#13567
dvdhrm and others added 12 commits November 21, 2022 17:04
Prevent DllImport from being attached to DSOLocal definitions in the
LLVM IR. The combination makes no sense, since definitions local to the
compilation unit will never be imported from external objects.

Additionally, LLVM will refuse the IR if it encounters the
combination (introduced in [1]):

  if (GV.hasDLLImportStorageClass())
    Assert(!GV.isDSOLocal(),
           "GlobalValue with DLLImport Storage is dso_local!", &GV);

Right now, codegen-llvm will only apply DllImport to constants and rely
on call-stubs for functions. Hence, we simply extend the codegen of
constants to skip DllImport for any local definitions.

This was discovered when switching the EFI targets to the static
relocation model [2]. With this fixed, we can start another attempt at
this.

[1] https://smlnj-gitlab.cs.uchicago.edu/manticore/llvm/commit/509132b368efed10bbdad825403f45e9cf1d6e38
[2] rust-lang#101656
Add a codegen-test that verifies inter-crate linkage with the static
relocation model. We expect all symbols that are part of a rust
compilation to end up in the same DSO, thus we expect `dso_local`
annotations.
…r=jackh726

get rid of to_poly_trait_predicate and many `without_const` calls

continuation of rust-lang#104483

r? ``@compiler-errors``
…safe_fn, r=Mark-Simulacrum

Add `#![deny(unsafe_op_in_unsafe_fn)]` in liballoc tests

In rust-lang#104647 (comment) it was mentioned that liballoc tests should probably have this enabled (we have it pretty much everywhere else in the stdlib), so I added it.

This will probably conflict with rust-lang#104647 so I'll rebase after that lands.
codegen-llvm: never combine DSOLocal and DllImport

Prevent DllImport from being attached to DSOLocal definitions in the LLVM IR. The combination makes no sense, since definitions local to the compilation unit will never be imported from external objects.

Additionally, LLVM will refuse the IR if it encounters the combination (introduced in [1]):

```
  if (GV.hasDLLImportStorageClass())
    Assert(!GV.isDSOLocal(),
           "GlobalValue with DLLImport Storage is dso_local!", &GV);
```

Right now, codegen-llvm will only apply DllImport to constants and rely on call-stubs for functions. Hence, we simply extend the codegen of constants to skip DllImport for any local definitions.

This was discovered when switching the EFI targets to the static relocation model [2]. With this fixed, we can start another attempt at this.

[1] https://smlnj-gitlab.cs.uchicago.edu/manticore/llvm/commit/509132b368efed10bbdad825403f45e9cf1d6e38
[2] rust-lang#101656
…malize, r=lcnr

Use ObligationCtxt::normalize

r? ``@lcnr``
…r=lnicola

⬆️ rust-analyzer

r? ``@ghost``
@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 Nov 23, 2022
@Manishearth
Copy link
Member Author

@bors r+ p=5

@bors
Copy link
Contributor

bors commented Nov 23, 2022

📌 Commit 2e860eb has been approved by Manishearth

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 Nov 23, 2022
@bors
Copy link
Contributor

bors commented Nov 23, 2022

⌛ Testing commit 2e860eb with merge c63079e8214f6f3cd7c1414c1c29e8ed9533dfc2...

@bors
Copy link
Contributor

bors commented Nov 24, 2022

💔 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 Nov 24, 2022
@Manishearth
Copy link
Member Author

test [codegen] src/test/codegen/zip.rs ... ok

failures:

---- [codegen] src/test/codegen/static-relocation-model.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/codegen/static-relocation-model/static-relocation-model.ll" "/Users/runner/work/rust/rust/src/test/codegen/static-relocation-model.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC"
stdout: none
--- stderr -------------------------------
/Users/runner/work/rust/rust/src/test/codegen/static-relocation-model.rs:16:11: error: CHECK: expected string not found in input
// CHECK: @extern_static = external dso_local local_unnamed_addr global i8
          ^
/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/codegen/static-relocation-model/static-relocation-model.ll:1:1: note: scanning from here
; ModuleID = 'static_relocation_model.445b1f62-cgu.0'
^
/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/codegen/static-relocation-model/static-relocation-model.ll:6:1: note: possible intended match here
@extern_static = external local_unnamed_addr global i8
^

Input file: /Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/codegen/static-relocation-model/static-relocation-model.ll
Check file: /Users/runner/work/rust/rust/src/test/codegen/static-relocation-model.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'static_relocation_model.445b1f62-cgu.0' 
check:16'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: source_filename = "static_relocation_model.445b1f62-cgu.0" 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3: target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4: target triple = "x86_64-apple-macosx10.8.0" 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:  
check:16'0     ~
            6: @extern_static = external local_unnamed_addr global i8 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:16'1     ?                                                       possible intended match
            7:  
check:16'0     ~
            8: ; Function Attrs: uwtable 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
            9: define i8 @access_extern() unnamed_addr #0 { 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           10: start: 
check:16'0     ~~~~~~~
           11:  %_1 = tail call i8 @extern_fn() 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
>>>>>>
------------------------------------------



failures:
    [codegen] src/test/codegen/static-relocation-model.rs

test result: FAILED. 344 passed; 1 failed; 39 ignored; 0 measured; 0 filtered out; finished in 19.59s

Build completed unsuccessfully in 0:57:57
== clock drift check ==
  local time: Thu Nov 24 00:16:54 UTC 2022
  network time: Thu, 24 Nov 2022 00:16:54 GMT
== end clock drift check ==
Error: Process completed with exit code 1.
0s

@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): VMotbOcPndAQ
      Provisioning UDID: 4203018E-580F-C1B5-9525-B745CECA79EB

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

---- [codegen] src/test/codegen/static-relocation-model.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/codegen/static-relocation-model/static-relocation-model.ll" "/Users/runner/work/rust/rust/src/test/codegen/static-relocation-model.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC"
stdout: none
--- stderr -------------------------------
/Users/runner/work/rust/rust/src/test/codegen/static-relocation-model.rs:16:11: error: CHECK: expected string not found in input
// CHECK: @extern_static = external dso_local local_unnamed_addr global i8
          ^
/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/codegen/static-relocation-model/static-relocation-model.ll:1:1: note: scanning from here
; ModuleID = 'static_relocation_model.445b1f62-cgu.0'
^
/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/codegen/static-relocation-model/static-relocation-model.ll:6:1: note: possible intended match here
@extern_static = external local_unnamed_addr global i8

Input file: /Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/codegen/static-relocation-model/static-relocation-model.ll
Check file: /Users/runner/work/rust/rust/src/test/codegen/static-relocation-model.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
            1: ; ModuleID = 'static_relocation_model.445b1f62-cgu.0' 
check:16'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: source_filename = "static_relocation_model.445b1f62-cgu.0" 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3: target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4: target triple = "x86_64-apple-macosx10.8.0" 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:  
check:16'0     ~
            6: @extern_static = external local_unnamed_addr global i8 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:16'1     ?                                                       possible intended match
            7:  
check:16'0     ~
            8: ; Function Attrs: uwtable 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
            9: define i8 @access_extern() unnamed_addr #0 { 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           10: start: 
check:16'0     ~~~~~~~
           11:  %_1 = tail call i8 @extern_fn() 
check:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
>>>>>>
------------------------------------------

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. 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.