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 #113181

Closed

Commits on Jun 7, 2023

  1. Configuration menu
    Copy the full SHA
    82336c1 View commit details
    Browse the repository at this point in the history
  2. add wasm eh intrinsics

    mirkootter committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    00ce5e8 View commit details
    Browse the repository at this point in the history
  3. add comment

    mirkootter committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    35cdb28 View commit details
    Browse the repository at this point in the history
  4. wasm exception handling

    mirkootter committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    82730b4 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    12ad662 View commit details
    Browse the repository at this point in the history
  6. fix comment (review change)

    Co-authored-by: bjorn3 <[email protected]>
    mirkootter and bjorn3 committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    744ec64 View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2023

  1. Configuration menu
    Copy the full SHA
    8af8a95 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2023

  1. Configuration menu
    Copy the full SHA
    26cd548 View commit details
    Browse the repository at this point in the history
  2. migrate lifetime too

    compiler-errors committed Jun 26, 2023
    Configuration menu
    Copy the full SHA
    724f3ff View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2023

  1. Configuration menu
    Copy the full SHA
    d8d09b0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5b51d9c View commit details
    Browse the repository at this point in the history
  3. Introduce exec_compiled_test_general

    This will allow the `run-coverage` mode to easily set environment variable
    `LLVM_PROFILE_FILE`, and to prevent the executable from being deleted after a
    successful run.
    Zalathar committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    a32cdee View commit details
    Browse the repository at this point in the history
  4. Remember whether failure-status was explicitly specified

    Currently a test without a `failure-status` directive is treated as having an
    expected failure-status of 1, but `run-coverage` tests will want to treat those
    tests as expecting success instead.
    Zalathar committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    75d01f8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a42bbd0 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    22e119b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e0625b4 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d05653c View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    9d2564a View commit details
    Browse the repository at this point in the history
  10. Migrate the remaining run-make/coverage-reports tests over to `run-…

    …coverage`
    
    To make it easier to verify that the output snapshots have been migrated
    faithfully, this change adds some temporary helper code that lets us avoid
    having to completely re-bless the existing snapshots.
    
    A later change in this PR will then re-bless the tests and remove the temporary
    helper code.
    Zalathar committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    a2c0b38 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    edd051c View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    7b4e75b View commit details
    Browse the repository at this point in the history
  13. fix typo

    He1pa committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    453603a View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2023

  1. Configuration menu
    Copy the full SHA
    cde54ff View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4dcce38 View commit details
    Browse the repository at this point in the history
  3. add slice::swap suggestion

    y21 committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    679c5be View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2023

  1. Rollup merge of rust-lang#111322 - mirkootter:master, r=davidtwco

    Support for native WASM exceptions
    
    ### Motivation
    Currently, rustc does not support native WASM exceptions. It does support JavaScript based exceptions for the wasm32-emscripten-target, but this requires back&forth with javascript for many calls, which is very slow.
    
    Native wasm support for exceptions is quite common: Clang+LLVM implemented them years ago, and all major browsers support them by now. They enable zero-cost exceptions, at least with regard to runtime-performance-cost. They may increase startup-time and code size, though.
    
    ### Important: This PR does not change default behaviour
    Exceptions usually add a lot of code in form of unwinding blocks, increasing the binary size. Most users probably do not want that, especially which regard to web development.
    
    Therefore, wasm exceptions play a similar role as WASM-threads: rustc should support them, like clang does, but users who want to use it have to use some command-line magic like rustflags to opt in.
    
    ### What does this PR do?
    As stated above, the default behaviour is not changed. It is already possible to opt-in into wasm exceptions using the command line. Unfortunately, the LLVM IR is invalid and the LLVM backend crashes.
    ```
    rustc <sourcefile>
      --target wasm32-unknown-unknown
      -C panic=unwind
      -C llvm-args=-wasm-enable-eh
      -C target-feature=+exception-handling
    ```
    As it turns out, LLVM is quite picky when it comes to IR for exception handling. If the IR does not look exactly like it should, some LLVM-assertions fail and the code generation crashes.
    
    This PR adds the necessary modifications to the code generator to make it work. It also adds `exception-handling` as a wasm target feature.
    
    ### What this PR does not / what is missing
    This PR is not a full fledges solution. It is the first step. A few parts are still missing; however, it is already useable (see next section).
    
    Currently missing:
    * The std library has to be adapted. Currently, only [no_std] crates work
    * Usually, nested exceptions abort the program (i.e. a panic during the cleanup of another panic). This is currently not done yet.
      - Currently, code inside cleanup handlers does not unwind
      - To fix this requires a little more work: The code generator currently maintains a single terminate block per function for this. Unfortunately, WASM requires funclet based exception handling. Therefore, we need to create a terminate block per funclet. This is probably not a big problem, but I want to keep this PR simple.
    
    ### How to use the compiler given this PR?
    This PR does not add any command line flags or features. It uses those which are already there. To compile with exceptions enabled, you need
    * to set the panic strategy to unwind, i.e. `-C panic=unwind`
    * to enable the exception-handling target feature, i.e. `-C target-feature=+exception-handling`
    * to tell LLVM about the exception handling, i.e. `-C llvm-args=-wasm-enable-eh`
    
    Since the standard library has not been adapted, you can only use it in [no_std] crates as of now. The intrinsic `core::intrinsics::r#try` works. To throw exceptions, you need the ````@llvm.wasm.throw```` intrinsic.
    
    I created a sample application which works for me: https://github.com/mirkootter/rust-wasm-demos
    This example can be run at https://webassembly.sh
    compiler-errors authored Jun 30, 2023
    Configuration menu
    Copy the full SHA
    c139641 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#111403 - y21:suggest-slice-swap, r=compiler…

    …-errors
    
    suggest `slice::swap` for `mem::swap(&mut x[0], &mut x[1])` borrowck error
    
    Recently saw someone ask why this code (example slightly modified):
    ```rs
    fn main() {
      let mut foo = [1, 2];
      std::mem::swap(&mut foo[0], &mut foo[1]);
    }
    ```
    triggers this error and how to fix it:
    ```
    error[E0499]: cannot borrow `foo[_]` as mutable more than once at a time
     --> src/main.rs:4:33
      |
    4 |     std::mem::swap(&mut foo[0], &mut foo[1]);
      |     -------------- -----------  ^^^^^^^^^^^ second mutable borrow occurs here
      |     |              |
      |     |              first mutable borrow occurs here
      |     first borrow later used by call
      |
      = help: consider using `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices
    ```
    The current help message is nice and goes in the right direction, but I think we can do better for this specific instance and suggest `slice::swap`, which makes this compile
    compiler-errors authored Jun 30, 2023
    Configuration menu
    Copy the full SHA
    b0ed475 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#112086 - petrochenkov:impambig, r=oli-obk

    resolve: Remove artificial import ambiguity errors
    
    Fixes rust-lang#56414.
    
    FCP report: rust-lang#112086 (comment)
    compiler-errors authored Jun 30, 2023
    Configuration menu
    Copy the full SHA
    302bffd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    12d4f08 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#112300 - Zalathar:run-coverage, r=wesleywiser

    Convert `run-make/coverage-reports` tests to use a custom compiletest mode
    
    I was frustrated by the fact that most of the coverage tests are glued together with makefiles and shell scripts, so I tried my hand at converting most of them over to a newly-implemented `run-coverage` mode/suite in compiletest.
    
    This ~~*mostly*~~ resolves rust-lang#85009, ~~though I've left a small number of the existing tests as-is because they would require more work to fix/support~~.
    
    ---
    
    I had time to go back and add support for the more troublesome tests that I had initially skipped over, so this PR now manages to completely get rid of `run-make/coverage-reports`.
    
    ---
    
    The patches are arranged as follows:
    
    - Declare the new mode/suite in bootstrap
    - Small changes to compiletest that will be used by the new mode
    - Implement the new mode in compiletest
    - Migrate most of the tests over
    - Add more code to bootstrap and compiletest to support the remaining tests
    - Migrate the remaining tests (with some temporary hacks to avoid re-blessing them)
    - Remove the temporary hacks and re-bless the migrated tests
    - Remove the unused remnants of `run-make/coverage-reports`
    compiler-errors authored Jun 30, 2023
    Configuration menu
    Copy the full SHA
    33a0812 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#112795 - He1pa:translation_builtin_macros, …

    …r=davidtwco
    
    Migrate some rustc_builtin_macros to SessionDiagnostic
    
    Part of rust-lang#100717.
    
    ```@rustbot``` label +A-translation
    compiler-errors authored Jun 30, 2023
    Configuration menu
    Copy the full SHA
    ae30e8c View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#113071 - compiler-errors:no-parent-non-life…

    …time-args-in-apit, r=eholk
    
    Account for late-bound vars from parent arg-position impl trait
    
    We should be reporting an error like we do for late-bound args coming from a parent APIT.
    
    Fixes rust-lang#113016
    compiler-errors authored Jun 30, 2023
    Configuration menu
    Copy the full SHA
    9ba54ca View commit details
    Browse the repository at this point in the history