Closed
Description
The ABI string for extern "..."
is validated while being parsed, meaning one can get errors about in cfg
'd off modules:
#[cfg(foo)]
mod foo {
extern "foo" {}
}
<anon>:3:12: 3:17 error: illegal ABI: expected one of [cdecl, stdcall, fastcall, aapcs, win64, Rust, C, system, rust-intrinsic, rust-call], found `foo`
<anon>:3 extern "foo" {}
^~~~~
(Compiled without --cfg foo
.)
This isn't necessarily wrong, but it is weird and somewhat annoying if one needs it. (It can be worked-around by hiding the extern
block behind a macro: macro_rules! annoying ( () => { extern "foo" {} }); annoying!()
.)