Commit Graph

2186 Commits

Author SHA1 Message Date
bors
1b1f6ea468 Auto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieu
Implement RFC 2945: "C-unwind" ABI

## Implement RFC 2945: "C-unwind" ABI

This branch implements [RFC 2945]. The tracking issue for this RFC is #74990.

The feature gate for the issue is `#![feature(c_unwind)]`.

This RFC was created as part of the ffi-unwind project group tracked at rust-lang/lang-team#19.

### Changes

Further details will be provided in commit messages, but a high-level overview
of the changes follows:

* A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`,
and `Thiscall` variants, marking whether unwinding across FFI boundaries is
acceptable. The cases where each of these variants' `unwind` member is true
correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and
`thiscall-unwind` ABI strings introduced in RFC 2945 [3].

* This commit adds a `c_unwind` feature gate for the new ABI strings.
Tests for this feature gate are included in `src/test/ui/c-unwind/`, which
ensure that this feature gate works correctly for each of the new ABIs.
A new language features entry in the unstable book is added as well.

* We adjust the `rustc_middle::ty::layout::fn_can_unwind` function,
used to compute whether or not a `FnAbi` object represents a function that
should be able to unwind when `panic=unwind` is in use.

* Changes are also made to
`rustc_mir_build::build::should_abort_on_panic` so that the function ABI is
used to determind whether it should abort, assuming that the `panic=unwind`
strategy is being used, and no explicit unwind attribute was provided.

[RFC 2945]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
2021-03-10 16:44:04 +00:00
katelyn a. martin
95182bb2cc rustc_target: add "unwind" payloads to Abi
### Overview

    This commit begins the implementation work for RFC 2945. For more
    information, see the rendered RFC [1] and tracking issue [2].

    A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`,
    and `Thiscall` variants, marking whether unwinding across FFI
    boundaries is acceptable. The cases where each of these variants'
    `unwind` member is true correspond with the `C-unwind`,
    `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings
    introduced in RFC 2945 [3].

 ### Feature Gate and Unstable Book

    This commit adds a `c_unwind` feature gate for the new ABI strings.
    Tests for this feature gate are included in `src/test/ui/c-unwind/`,
    which ensure that this feature gate works correctly for each of the
    new ABIs.

    A new language features entry in the unstable book is added as well.

 ### Further Work To Be Done

    This commit does not proceed to implement the new unwinding ABIs,
    and is intentionally scoped specifically to *defining* the ABIs and
    their feature flag.

 ### One Note on Test Churn

    This will lead to some test churn, in re-blessing hash tests, as the
    deleted comment in `src/librustc_target/spec/abi.rs` mentioned,
    because we can no longer guarantee the ordering of the `Abi`
    variants.

    While this is a downside, this decision was made bearing in mind
    that RFC 2945 states the following, in the "Other `unwind` Strings"
    section [3]:

    >  More unwind variants of existing ABI strings may be introduced,
    >  with the same semantics, without an additional RFC.

    Adding a new variant for each of these cases, rather than specifying
    a payload for a given ABI, would quickly become untenable, and make
    working with the `Abi` enum prone to mistakes.

    This approach encodes the unwinding information *into* a given ABI,
    to account for the future possibility of other `-unwind` ABI
    strings.

 ### Ignore Directives

    `ignore-*` directives are used in two of our `*-unwind` ABI test
    cases.

    Specifically, the `stdcall-unwind` and `thiscall-unwind` test cases
    ignore architectures that do not support `stdcall` and
    `thiscall`, respectively.

    These directives are cribbed from
    `src/test/ui/c-variadic/variadic-ffi-1.rs` for `stdcall`, and
    `src/test/ui/extern/extern-thiscall.rs` for `thiscall`.

    This would otherwise fail on some targets, see:
    fcf697f902

 ### Footnotes

[1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
[2]: https://github.com/rust-lang/rust/issues/74990
[3]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#other-unwind-abi-strings
2021-03-09 14:38:29 -05:00
kadmin
d674d3dad8 Clean up todos
Also add some span_bugs where it is unreachable
2021-03-09 19:31:31 +00:00
kadmin
d30c497de6 Build StKind::CopyOverlapping
This replaces where it was previously being constructed in intrinsics, with direct construction
of the Statement.
2021-03-09 16:54:14 +00:00
kadmin
83e6251f21 Update cranelift 2021-03-09 16:54:14 +00:00
bjorn3
6b58ed225e Adjust for changed -Zmir-opt-level numbering 2021-03-09 16:45:55 +01:00
bjorn3
871874817b Lower GHA timeout to 60 min 2021-03-09 16:30:31 +01:00
bjorn3
eefe1ede82 Update config name for latest rust-analyzer 2021-03-09 12:52:43 +01:00
bjorn3
9adb139356 Add rustc_private=true to the package metadata for rust-analyzer 2021-03-09 12:46:04 +01:00
bjorn3
826189ef51 Some clippy fixes 2021-03-09 12:37:39 +01:00
bjorn3
8f62149d07 Rustup to rustc 1.52.0-nightly (8f349be27 2021-03-08) 2021-03-09 10:16:43 +01:00
bjorn3
6ef48e9cb4 Sync from rust 4b9f5cc4c1 2021-03-09 10:10:40 +01:00
bors
7f020206e8 Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`
2021-03-08 08:39:24 +00:00
bjorn3
341a4863fa Use the new component dependency option of the rust-toolchain file (take 2) 2021-03-07 17:47:56 +01:00
bjorn3
05339134de Add license section to the readme
Just in case
2021-03-06 19:26:11 +01:00
bjorn3
95e4db3e03 More doc fixes 2021-03-06 19:22:36 +01:00
bjorn3
be3aa0689e Revert "Use jemalloc"
This reverts commit d194c707c8.

It fails the bootstrap test as jemalloc_sys is not built
2021-03-06 19:21:30 +01:00
bjorn3
76bb1f173f Move the more advanced ways to use cg_clif to usage.md 2021-03-06 19:19:29 +01:00
bjorn3
d194c707c8 Use jemalloc 2021-03-06 19:06:15 +01:00
bjorn3
cecd7a9ae6 Add clif comments when in release mode
Fixes #1130
2021-03-06 18:45:04 +01:00
bjorn3
4ca3384db6 Make it possible to enable the verifier in release mode 2021-03-06 15:33:47 +01:00
bjorn3
bd1b1dd58e Handle #![windows_subsystem] 2021-03-06 14:58:29 +01:00
bjorn3
5f3d640d45 Fix warning 2021-03-06 14:49:55 +01:00
bjorn3
0985044c75 Use --print file-names instead of a match on uname 2021-03-06 14:46:38 +01:00
bjorn3
274a7ac4c4
Merge pull request #1145 from bjorn3/mingw_support
Support cross-compiling to Windows using MinGW
2021-03-05 23:03:06 +01:00
bjorn3
00f1cddb9c Test Windows cross-compilation on CI 2021-03-05 21:58:38 +01:00
bjorn3
d23b12fa62 Build all tests when cross-compiling 2021-03-05 21:32:49 +01:00
bjorn3
1122f42e28 Support cross-compiling to Windows using MinGW 2021-03-05 21:32:49 +01:00
bjorn3
c825bc8e61 Update Cranelift
This adds support for the WindowsFastcall calling convention
2021-03-05 21:32:49 +01:00
bjorn3
09a36b43d6 Merge branch 'sync_from_rust' 2021-03-05 19:13:22 +01:00
bjorn3
27886cd6b6 Merge commit '9a0c32934ebe376128230aa8da3275697b2053e7' into sync_cg_clif-2021-03-05 2021-03-05 19:12:59 +01:00
bjorn3
9a0c32934e Disable value debuginfo
This prevents an expensive Cranelift pass from running to reconstruct the debuginfo
2021-03-05 16:59:35 +01:00
bjorn3
5e736293b3 Rustfmt 2021-03-05 11:21:44 +01:00
bjorn3
b5f67dc703 Rustup to rustc 1.52.0-nightly (45b3c2851 2021-03-04) 2021-03-05 10:58:30 +01:00
bjorn3
9406510cee Sync from rust a0d66b54fb 2021-03-05 10:46:59 +01:00
Oli Scherer
b63df38a98 Shrink the size of Rvalue by 16 bytes 2021-03-05 09:33:01 +00:00
bjorn3
7d33e5bf3d Fix bootstrap test script 2021-03-01 12:34:49 +01:00
bjorn3
27a5f4f472 Update Cranelift
Fixes #1143
2021-03-01 12:19:22 +01:00
Guillaume Gomez
8b7d335c38 Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se
Stabilize str_split_once

Closes #74773
2021-02-26 15:52:29 +01:00
bjorn3
86c594426f
Merge pull request #1144 from bjorn3/dynamic_module
Use dynamic dispatch for the inner Module
2021-02-23 21:00:33 +01:00
bjorn3
73d3a1c14a Use dynamic dispatch for the inner Module
This improves compilation time and shrinks the linked backend from
13MB to 9.7MB on Linux.
2021-02-23 18:49:37 +01:00
bjorn3
ef96a0f3f0 Update Cranelift 2021-02-23 18:48:55 +01:00
bjorn3
c247446570 Disable macro-error rust-analyzer diagnostic 2021-02-23 09:56:16 +01:00
bjorn3
b0028fa409 Update dependencies 2021-02-22 14:56:06 +01:00
bjorn3
d5ac849a24 Update Cranelift 2021-02-22 14:46:24 +01:00
bjorn3
a5bf6d2f18 Rustup to rustc 1.52.0-nightly (83b30a639 2021-02-20) 2021-02-21 17:27:53 +01:00
bjorn3
013b3c5a7c Rustfmt 2021-02-21 17:03:21 +01:00
bjorn3
4eb6754749 Sync from rust 3e826bb112 2021-02-21 17:02:04 +01:00
bjorn3
ecba16f296 Various enum to int cast fixes 2021-02-21 16:52:42 +01:00
bjorn3
7fc34839ac Revert "Remove shift amount masking"
This reverts commit c5f98b586f.

It turns out to be necessary anyway
2021-02-21 16:51:40 +01:00