Skip to main content

miri/
sym.rs

1#![allow(non_upper_case_globals)]
2
3#[doc(no_inline)]
4pub use rustc_span::sym::*;
5
6macro_rules! val {
7    ($name:ident) => {
8        stringify!($name)
9    };
10    ($name:ident $value:literal) => {
11        $value
12    };
13}
14
15macro_rules! generate {
16    ($($name:ident $(: $value:literal)? ,)*) => {
17        /// To be supplied to `rustc_interface::Config`
18        pub const EXTRA_SYMBOLS: &[&str] = &[
19            $(
20                val!($name $($value)?),
21            )*
22        ];
23
24        $(
25            pub const $name: rustc_span::Symbol = rustc_span::Symbol::new(rustc_span::symbol::PREDEFINED_SYMBOLS_COUNT + ${index()});
26        )*
27    };
28}
29
30// List of extra symbols to be included in Miri.
31// An alternative content can be specified using a colon after the symbol name.
32generate! {
33    sys_mutex_lock,
34    sys_mutex_try_lock,
35    sys_mutex_unlock,
36}