-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #113162
Rollup of 7 pull requests #113162
Conversation
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
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.
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.
…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.
Signed-off-by: ozkanonur <work@onurozkan.dev>
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
resolve: Remove artificial import ambiguity errors Fixes rust-lang#56414. FCP report: rust-lang#112086 (comment)
refactor `tool_doc!` resolves rust-lang#112211 (comment)
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`
…r=davidtwco Migrate some rustc_builtin_macros to SessionDiagnostic Part of rust-lang#100717. ``@rustbot`` label +A-translation
… r=oli-obk Make the `Elaboratable` trait take clauses We only ever elaborate clauses, so make this explicit in the trait's definition rather than having a bunch of `.expect_clause()` calls everywhere.
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
⌛ Testing commit 4338683 with merge bfa9e5c94429236d698e90578bbe3ca8fe4eb1e0... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
📌 Perf builds for each rolled up PR:
previous master: 8aed93d912 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Finished benchmarking commit (97279e9): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 661.088s -> 659.661s (-0.22%) |
Successful merges:
tool_doc!
#112234 (refactortool_doc!
)run-make/coverage-reports
tests to use a custom compiletest mode #112300 (Convertrun-make/coverage-reports
tests to use a custom compiletest mode)Elaboratable
trait take clauses #113144 (Make theElaboratable
trait take clauses)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup