Skip to content

Commit 921993e

Browse files
committed
Add cfg_emscripten_wasm_eh feature
1 parent 91dc864 commit 921993e

File tree

8 files changed

+23
-0
lines changed

8 files changed

+23
-0
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const GATED_CFGS: &[GatedCfg] = &[
3737
(sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
3838
// this is consistent with naming of the compiler flag it's for
3939
(sym::fmt_debug, sym::fmt_debug, Features::fmt_debug),
40+
(sym::emscripten_wasm_eh, sym::cfg_emscripten_wasm_eh, Features::cfg_emscripten_wasm_eh),
4041
];
4142

4243
/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ declare_features! (
202202
(internal, allow_internal_unstable, "1.0.0", None),
203203
/// Allows using anonymous lifetimes in argument-position impl-trait.
204204
(unstable, anonymous_lifetime_in_impl_trait, "1.63.0", None),
205+
/// Allows access to the emscripten_wasm_eh config, used by panic_unwind and unwind
206+
(internal, cfg_emscripten_wasm_eh, "CURRENT_RUSTC_VERSION", None),
205207
/// Allows identifying the `compiler_builtins` crate.
206208
(internal, compiler_builtins, "1.13.0", None),
207209
/// Allows writing custom MIR

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ symbols! {
570570
cfg_autodiff_fallback,
571571
cfg_boolean_literals,
572572
cfg_doctest,
573+
cfg_emscripten_wasm_eh,
573574
cfg_eval,
574575
cfg_fmt_debug,
575576
cfg_hide,

library/panic_unwind/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// `real_imp` is unused with Miri, so silence warnings.
2626
#![cfg_attr(miri, allow(dead_code))]
2727
#![allow(internal_features)]
28+
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
2829

2930
use alloc::boxed::Box;
3031
use core::any::Any;

library/unwind/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
feature(simd_wasm64, wasm_exception_handling_intrinsics)
99
)]
1010
#![allow(internal_features)]
11+
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
1112

1213
// Force libc to be included even if unused. This is required by many platforms.
1314
#[cfg(not(all(windows, target_env = "msvc")))]

tests/ui/cfg/disallowed-cli-cfgs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//@ revisions: target_has_atomic_equal_alignment_ target_has_atomic_load_store_
88
//@ revisions: target_thread_local_ relocation_model_
99
//@ revisions: fmt_debug_
10+
//@ revisions: emscripten_wasm_eh_
1011

1112
//@ [overflow_checks_]compile-flags: --cfg overflow_checks
1213
//@ [debug_assertions_]compile-flags: --cfg debug_assertions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ compile-flags: --check-cfg=cfg(emscripten_wasm_eh)
2+
#[cfg(not(emscripten_wasm_eh))]
3+
//~^ `cfg(emscripten_wasm_eh)` is experimental
4+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0658]: `cfg(emscripten_wasm_eh)` is experimental and subject to change
2+
--> $DIR/feature-gate-cfg-emscripten-wasm-eh.rs:2:11
3+
|
4+
LL | #[cfg(not(emscripten_wasm_eh))]
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add `#![feature(cfg_emscripten_wasm_eh)]` to the crate attributes to enable
8+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)