add `unwind_asm` feature gate for `may_unwind` option

This commit is contained in:
cynecx 2021-11-14 20:21:05 +01:00
parent 059d3b3f34
commit 686ace3b41
5 changed files with 34 additions and 0 deletions

View File

@ -49,6 +49,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
.struct_span_err(sp, "the `att_syntax` option is only supported on x86")
.emit();
}
if asm.options.contains(InlineAsmOptions::MAY_UNWIND)
&& !self.sess.features_untracked().asm_unwind
{
feature_err(
&self.sess.parse_sess,
sym::asm_unwind,
sp,
"the `may_unwind` option is unstable",
)
.emit();
}
let mut clobber_abis = FxHashMap::default();
if let Some(asm_arch) = asm_arch {

View File

@ -290,6 +290,8 @@ declare_features! (
(active, asm_experimental_arch, "1.58.0", Some(72016), None),
/// Allows using `sym` operands in inline assembly.
(active, asm_sym, "1.58.0", Some(72016), None),
/// Allows the `may_unwind` option in inline assembly.
(active, asm_unwind, "1.58.0", Some(72016), None),
/// Allows the user of associated type bounds.
(active, associated_type_bounds, "1.34.0", Some(52662), None),
/// Allows associated type defaults.

View File

@ -332,6 +332,7 @@ symbols! {
asm_const,
asm_experimental_arch,
asm_sym,
asm_unwind,
assert,
assert_inhabited,
assert_macro,

View File

@ -0,0 +1,8 @@
#![feature(asm)]
fn main() {
unsafe {
asm!("", options(may_unwind));
//~^ ERROR the `may_unwind` option is unstable
}
}

View File

@ -0,0 +1,12 @@
error[E0658]: the `may_unwind` option is unstable
--> $DIR/feature-gate-asm_unwind.rs:5:9
|
LL | asm!("", options(may_unwind));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information
= help: add `#![feature(asm_unwind)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.