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 7 pull requests #100985

Closed
wants to merge 19 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dpaoliello and others added 19 commits August 22, 2022 12:08
…keyword

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit migrates the errors that indicates an incorrect
CGU type and the fatal error that indicates that a CGU has
not been correctly recorded
This commit migrates around 80% of the parse file to use SsessionDiagnostic
We still have to migrate struct_err and struct_warn.
This commit migrates the errors in the function check_expected_reuse
to use the new SessionDiagnostic. It also does some small refactor
for the IncorrectCguReuseType to include the 'at least' word in the
fluent translation file
…, r=thomcc

Use `DisplayBuffer` for socket addresses.

Continuation of rust-lang#100625 for socket addresses.

Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.
…leywiser

Implementation of import_name_type

Fixes rust-lang#96534 by implementing rust-lang/compiler-team#525

Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's rust-lang#58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information.

This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`.

A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type.

Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself).

Design decisions (these match the MCP linked above):
* For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`).
* If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating.
* Using `import_name_type` on architectures other than 32bit x86 will result in an error.
* Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.
…grate-session, r=davidtwco

translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1

## Description

This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](rust-lang#100717 (comment)).

The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
…t_real_intrinsic, r=oli-obk,RalfJung

Make `const_eval_select` a real intrinsic

This fixes issues where `track_caller` functions do not have nice panic
messages anymore when there is a call to the function, and uses the
MIR system to replace the call instead of dispatching via lang items.

Fixes rust-lang#100696.
…ng_sugg, r=davidtwco

sugg: suggest the usage of boolean value when there is a typo in the keyword

Fixes rust-lang#100686

This adds a new suggestion when there is a well-known typo

With the following program

```rust
fn main() {
    let x = True;
}
```

Now we have the following suggestion

```
error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
extra sanity check against consts pointing to mutable memory

This should be both unreachable and redundant (since we already ensure that validation only reads from read-only memory, when validating consts), but I feel like we cannot be paranoid enough here, and also if this ever fails it'll be a nicer error than the "cannot read from mutable memory" error.
…r=JoshTriplett

Reduce code size of `assert_matches_failed`

Using `write_str` instead of `<str as Display>::fmt` avoids the `pad` function which is very expensive to have in size-constrained code.
@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Aug 25, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Aug 25, 2022

📌 Commit d7fbdc2 has been approved by Dylan-DPC

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 25, 2022
@bors
Copy link
Contributor

bors commented Aug 25, 2022

⌛ Testing commit d7fbdc2 with merge 200d9392993f72795fd9c079cbdd3d3f2221d0cd...

@bors
Copy link
Contributor

bors commented Aug 25, 2022

💔 Test failed - checks-actions

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
test [ui] src/test/ui/rfc-2497-if-let-chains/irrefutable-lets.rs#disallowed ... ok
test [ui] src/test/ui/rfc-2091-track-caller/std-panic-locations.rs#mir-opt ... ok
test [ui] src/test/ui/rfc-2306/convert-id-const-with-gate.rs ... ok
test [ui] src/test/ui/rfc-2565-param-attrs/attr-without-param.rs ... ok
test [ui] src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs ... ignored
test [ui] src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs ... ignored
test [ui] src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs ... ignored
test [ui] src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs ... ignored
test [ui] src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs ... ignored
test [ui] src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs ... ok
test [ui] src/test/ui/rfc-2565-param-attrs/param-attrs-2018.rs ... ok
test [ui] src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs ... ignored
test [ui] src/test/ui/rfc-2497-if-let-chains/no-double-assigments.rs ... ok
---
failures:

---- [codegen] src/test/codegen/alloc-optimisation.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/alloc-optimisation/alloc-optimisation.ll" "/checkout/src/test/codegen/alloc-optimisation.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC"
stdout: none
--- stderr -------------------------------
/checkout/src/test/codegen/alloc-optimisation.rs:10:17: error: CHECK-NEXT: is not on the line after the previous match
 // CHECK-NEXT: ret void
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/alloc-optimisation/alloc-optimisation.ll:13:2: note: 'next' match was here
 ret void
 ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/alloc-optimisation/alloc-optimisation.ll:8:7: note: previous match ended here
      ^
      ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/alloc-optimisation/alloc-optimisation.ll:9:1: note: non-matching line after previous match is here
; call core::mem::valid_align::ValidAlign::new_unchecked::runtime

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/alloc-optimisation/alloc-optimisation.ll
Check file: /checkout/src/test/codegen/alloc-optimisation.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
         .
         .
         .
         .
         8: start: 
         9: ; call core::mem::valid_align::ValidAlign::new_unchecked::runtime 
        10:  tail call void @_ZN4core3mem11valid_align10ValidAlign13new_unchecked7runtime17h1ef0a6d76a69e379E(i64 4) 
        11: ; call core::mem::valid_align::ValidAlign::new_unchecked::runtime 
        12:  tail call void @_ZN4core3mem11valid_align10ValidAlign13new_unchecked7runtime17h1ef0a6d76a69e379E(i64 4) 
        13:  ret void 
next:10      !~~~~~~~  error: match on wrong line
        14: } 
        15:  
        16: ; Function Attrs: nonlazybind uwtable 
        17: declare noundef i32 @rust_eh_personality(i32, i32 noundef, i64, ptr, ptr) unnamed_addr #0 
         .
         .
         .
>>>>>>
>>>>>>
------------------------------------------


---- [codegen] src/test/codegen/issue-96497-slice-size-nowrap.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/issue-96497-slice-size-nowrap/issue-96497-slice-size-nowrap.ll" "/checkout/src/test/codegen/issue-96497-slice-size-nowrap.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC"
stdout: none
--- stderr -------------------------------
/checkout/src/test/codegen/issue-96497-slice-size-nowrap.rs:27:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: store i32 42
               ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/issue-96497-slice-size-nowrap/issue-96497-slice-size-nowrap.ll:49:2: note: found here
 store i32 42, ptr %3, align 4

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/issue-96497-slice-size-nowrap/issue-96497-slice-size-nowrap.ll
Check file: /checkout/src/test/codegen/issue-96497-slice-size-nowrap.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
        .
        .
        .
        .
       44:  %_4 = icmp ugt i64 %1, 1 
       45:  br i1 %_4, label %"_ZN4core3ptr59drop_in_place$LT$alloc..boxed..Box$LT$$u5b$u32$u5d$$GT$$GT$17he789d453960d96d1E.exit", label %panic, !prof !3 
       46:  
       47: "_ZN4core3ptr59drop_in_place$LT$alloc..boxed..Box$LT$$u5b$u32$u5d$$GT$$GT$17he789d453960d96d1E.exit": ; preds = %start 
       48:  %3 = getelementptr inbounds [0 x i32], ptr %0, i64 0, i64 1 
       49:  store i32 42, ptr %3, align 4 
not:27      !~~~~~~~~~~~                   error: no match expected
       50: ; call core::mem::valid_align::ValidAlign::new_unchecked::runtime 
       51:  tail call void @_ZN4core3mem11valid_align10ValidAlign13new_unchecked7runtime17h1ef0a6d76a69e379E(i64 4) 
       52:  %4 = shl nsw i64 %1, 2 
       53:  tail call void @__rust_dealloc(ptr nonnull %0, i64 %4, i64 4) #5 
       54:  ret void 
        .
        .
>>>>>>
------------------------------------------

@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 Aug 25, 2022
@Dylan-DPC Dylan-DPC closed this Aug 25, 2022
@davidtwco davidtwco removed the A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic label Oct 4, 2022
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.

None yet