luaur_common/macros/luau_fastflagvariable.rs
1//! `LUAU_FASTFLAGVARIABLE(flag)` — defines a static (non-dynamic) bool FastFlag.
2//! Reference: `luau/Common/include/Luau/Common.h`.
3//!
4//! C++ expands to `namespace FFlag { FValue<bool> flag(#flag, false, false); }`.
5//! Rust modules aren't open like C++ namespaces, so the macro emits a bare
6//! `pub static` at the call site (no per-flag `mod`, which would collide when a
7//! file defines two flags); the enclosing per-crate `FFlag` module supplies the
8//! namespace, so reads stay `FFlag::flag` -> `crate::FFlag::flag.get()`.
9
10#[allow(non_snake_case)]
11#[macro_export]
12macro_rules! LUAU_FASTFLAGVARIABLE {
13 ($flag:ident) => {
14 #[allow(non_upper_case_globals)]
15 pub static $flag: $crate::records::f_value::FValue<bool> =
16 $crate::records::f_value::FValue::new(
17 concat!(stringify!($flag), "\0").as_ptr() as *const core::ffi::c_char,
18 false,
19 false,
20 );
21 };
22}
23
24pub use LUAU_FASTFLAGVARIABLE;