Skip to main content

rustc_session/config/
cfg.rs

1//! cfg and check-cfg configuration
2//!
3//! This module contains the definition of [`Cfg`] and [`CheckCfg`]
4//! as well as the logic for creating the default configuration for a
5//! given [`Session`].
6//!
7//! It also contains the filling of the well known configs, which should
8//! ALWAYS be in sync with the default_configuration.
9//!
10//! ## Adding a new cfg
11//!
12//! Adding a new feature requires two new symbols one for the cfg itself
13//! and the second one for the unstable feature gate, those are defined in
14//! `rustc_span::symbol`.
15//!
16//! As well as the following points,
17//!  - Add the activation logic in [`default_configuration`]
18//!  - Add the cfg to [`CheckCfg::fill_well_known`] (and related files),
19//!    so that the compiler can know the cfg is expected
20//!  - Add the cfg in [`disallow_cfgs`] to disallow users from setting it via `--cfg`
21//!  - Add the feature gating in `compiler/rustc_feature/src/builtin_attrs.rs`
22
23use std::hash::Hash;
24use std::iter;
25
26use rustc_abi::Align;
27use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
28use rustc_lint_defs::builtin::EXPLICIT_BUILTIN_CFGS_IN_FLAGS;
29use rustc_span::{Symbol, sym};
30use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, Target};
31
32use crate::config::{CrateType, FmtDebug};
33use crate::{Session, diagnostics};
34
35/// The parsed `--cfg` options that define the compilation environment of the
36/// crate, used to drive conditional compilation.
37///
38/// An `FxIndexSet` is used to ensure deterministic ordering of error messages
39/// relating to `--cfg`.
40pub type Cfg = FxIndexSet<(Symbol, Option<Symbol>)>;
41
42/// The parsed `--check-cfg` options.
43#[derive(#[automatically_derived]
impl ::core::default::Default for CheckCfg {
    #[inline]
    fn default() -> Self {
        CheckCfg {
            exhaustive_names: ::core::default::Default::default(),
            exhaustive_values: ::core::default::Default::default(),
            expecteds: ::core::default::Default::default(),
            well_known_names: ::core::default::Default::default(),
        }
    }
}Default)]
44pub struct CheckCfg {
45    /// Is well known names activated
46    pub exhaustive_names: bool,
47    /// Is well known values activated
48    pub exhaustive_values: bool,
49    /// All the expected values for a config name
50    pub expecteds: FxHashMap<Symbol, ExpectedValues<Symbol>>,
51    /// Well known names (only used for diagnostics purposes)
52    pub well_known_names: FxHashSet<Symbol>,
53}
54
55pub enum ExpectedValues<T> {
56    Some(FxHashSet<Option<T>>),
57    Any,
58}
59
60impl<T: Eq + Hash> ExpectedValues<T> {
61    fn insert(&mut self, value: T) -> bool {
62        match self {
63            ExpectedValues::Some(expecteds) => expecteds.insert(Some(value)),
64            ExpectedValues::Any => false,
65        }
66    }
67
68    pub fn contains(&self, value: &Option<T>) -> bool {
69        match self {
70            ExpectedValues::Some(expecteds) => expecteds.contains(value),
71            ExpectedValues::Any => false,
72        }
73    }
74}
75
76impl<T: Eq + Hash> Extend<T> for ExpectedValues<T> {
77    fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
78        match self {
79            ExpectedValues::Some(expecteds) => expecteds.extend(iter.into_iter().map(Some)),
80            ExpectedValues::Any => {}
81        }
82    }
83}
84
85impl<'a, T: Eq + Hash + Copy + 'a> Extend<&'a T> for ExpectedValues<T> {
86    fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
87        match self {
88            ExpectedValues::Some(expecteds) => expecteds.extend(iter.into_iter().map(|a| Some(*a))),
89            ExpectedValues::Any => {}
90        }
91    }
92}
93
94/// Disallow builtin cfgs from the CLI.
95pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
96    let disallow = |cfg: &(Symbol, Option<Symbol>), controlled_by| {
97        let cfg_name = cfg.0;
98        let cfg = if let Some(value) = cfg.1 {
99            ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}=\"{1}\"", cfg_name, value))
    })format!(r#"{}="{}""#, cfg_name, value)
100        } else {
101            ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", cfg_name))
    })format!("{}", cfg_name)
102        };
103        sess.psess.buffer_crate_lint(
104            EXPLICIT_BUILTIN_CFGS_IN_FLAGS,
105            diagnostics::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by },
106        )
107    };
108
109    // We want to restrict setting builtin cfgs that will produce incoherent behavior
110    // between the cfg and the rustc cli flag that sets it.
111    //
112    // The tests are in tests/ui/cfg/disallowed-cli-cfgs.rs.
113
114    // By-default all builtin cfgs are disallowed, only those are allowed:
115    //  - test: as it makes sense to the have the `test` cfg active without the builtin
116    //          test harness. See Cargo `harness = false` config.
117    //
118    // Cargo `--cfg test`: https://github.com/rust-lang/cargo/blob/bc89bffa5987d4af8f71011c7557119b39e44a65/src/cargo/core/compiler/mod.rs#L1124
119
120    for cfg in user_cfgs {
121        match cfg {
122            (sym::overflow_checks, None) => disallow(cfg, "-C overflow-checks"),
123            (sym::debug_assertions, None) => disallow(cfg, "-C debug-assertions"),
124            (sym::ub_checks, None) => disallow(cfg, "-Z ub-checks"),
125            (sym::contract_checks, None) => disallow(cfg, "-Z contract-checks"),
126            (sym::sanitize, None | Some(_)) => disallow(cfg, "-Z sanitizer"),
127            (
128                sym::sanitizer_cfi_generalize_pointers | sym::sanitizer_cfi_normalize_integers,
129                None | Some(_),
130            ) => disallow(cfg, "-Z sanitizer=cfi"),
131            (sym::proc_macro, None) => disallow(cfg, "--crate-type proc-macro"),
132            (sym::panic, Some(sym::abort | sym::unwind | sym::immediate_abort)) => {
133                disallow(cfg, "-C panic")
134            }
135            (sym::target_feature, Some(_)) => disallow(cfg, "-C target-feature"),
136            (sym::unix, None)
137            | (sym::windows, None)
138            | (sym::relocation_model, Some(_))
139            | (sym::target_abi, None | Some(_))
140            | (sym::target_arch, Some(_))
141            | (sym::target_endian, Some(_))
142            | (sym::target_env, None | Some(_))
143            | (sym::target_family, Some(_))
144            | (sym::target_object_format, Some(_))
145            | (sym::target_os, Some(_))
146            | (sym::target_pointer_width, Some(_))
147            | (sym::target_vendor, None | Some(_))
148            | (sym::target_has_atomic, Some(_))
149            | (sym::target_has_threads, None | Some(_))
150            | (sym::target_has_atomic_primitive_alignment, Some(_))
151            | (sym::target_has_atomic_load_store, Some(_))
152            | (sym::target_has_reliable_f16, None | Some(_))
153            | (sym::target_has_reliable_f16_math, None | Some(_))
154            | (sym::target_has_reliable_f16b, None | Some(_))
155            | (sym::target_has_reliable_f128, None | Some(_))
156            | (sym::target_has_reliable_f128_math, None | Some(_))
157            | (sym::target_thread_local, None) => disallow(cfg, "--target"),
158            (sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"),
159            _ => {}
160        }
161    }
162}
163
164/// Generate the default configs for a given session
165pub(crate) fn default_configuration(sess: &Session) -> Cfg {
166    let mut ret = Cfg::default();
167
168    macro_rules! ins_none {
169        ($key:expr) => {
170            ret.insert(($key, None));
171        };
172    }
173    macro_rules! ins_str {
174        ($key:expr, $val_str:expr) => {
175            ret.insert(($key, Some(Symbol::intern($val_str))));
176        };
177    }
178    macro_rules! ins_sym {
179        ($key:expr, $val_sym:expr) => {
180            ret.insert(($key, Some($val_sym)));
181        };
182    }
183
184    // Symbols are inserted in alphabetical order as much as possible.
185    // The exceptions are where control flow forces things out of order.
186    //
187    // Run `rustc --print cfg` to see the configuration in practice.
188    //
189    // NOTE: These insertions should be kept in sync with
190    // `CheckCfg::fill_well_known` below.
191
192    if sess.opts.debug_assertions {
193        ret.insert((sym::debug_assertions, None));ins_none!(sym::debug_assertions);
194    }
195
196    if sess.is_nightly_build() {
197        match sess.opts.unstable_opts.fmt_debug {
198            FmtDebug::Full => {
199                ret.insert((sym::fmt_debug, Some(sym::full)));ins_sym!(sym::fmt_debug, sym::full);
200            }
201            FmtDebug::Shallow => {
202                ret.insert((sym::fmt_debug, Some(sym::shallow)));ins_sym!(sym::fmt_debug, sym::shallow);
203            }
204            FmtDebug::None => {
205                ret.insert((sym::fmt_debug, Some(sym::none)));ins_sym!(sym::fmt_debug, sym::none);
206            }
207        }
208    }
209
210    if sess.overflow_checks() {
211        ret.insert((sym::overflow_checks, None));ins_none!(sym::overflow_checks);
212    }
213
214    // We insert a cfg for the name of session's panic strategy.
215    // Since the ImmediateAbort strategy is new, it also sets cfg(panic="abort"), so that code
216    // which is trying to detect whether unwinding is enabled by checking for cfg(panic="abort")
217    // does not need to be updated.
218    ret.insert((sym::panic, Some(sess.panic_strategy().desc_symbol())));ins_sym!(sym::panic, sess.panic_strategy().desc_symbol());
219    if sess.panic_strategy() == PanicStrategy::ImmediateAbort {
220        ret.insert((sym::panic, Some(PanicStrategy::Abort.desc_symbol())));ins_sym!(sym::panic, PanicStrategy::Abort.desc_symbol());
221    }
222
223    // JUSTIFICATION: before wrapper fn is available
224    #[allow(rustc::bad_opt_access)]
225    if sess.opts.crate_types.contains(&CrateType::ProcMacro) {
226        ret.insert((sym::proc_macro, None));ins_none!(sym::proc_macro);
227    }
228
229    if sess.is_nightly_build() {
230        ret.insert((sym::relocation_model,
        Some(sess.target.relocation_model.desc_symbol())));ins_sym!(sym::relocation_model, sess.target.relocation_model.desc_symbol());
231    }
232
233    for mut s in sess.sanitizers() {
234        // KASAN is still ASAN under the hood, so it uses the same attribute.
235        if s == SanitizerSet::KERNELADDRESS {
236            s = SanitizerSet::ADDRESS;
237        }
238        // KHWASAN is still HWASAN under the hood, so it uses the same attribute.
239        if s == SanitizerSet::KERNELHWADDRESS {
240            s = SanitizerSet::HWADDRESS;
241        }
242        ret.insert((sym::sanitize, Some(Symbol::intern(&s.to_string()))));ins_str!(sym::sanitize, &s.to_string());
243    }
244
245    if sess.is_sanitizer_cfi_generalize_pointers_enabled() {
246        ret.insert((sym::sanitizer_cfi_generalize_pointers, None));ins_none!(sym::sanitizer_cfi_generalize_pointers);
247    }
248    if sess.is_sanitizer_cfi_normalize_integers_enabled() {
249        ret.insert((sym::sanitizer_cfi_normalize_integers, None));ins_none!(sym::sanitizer_cfi_normalize_integers);
250    }
251
252    ret.insert((sym::target_abi, Some(sess.target.cfg_abi.desc_symbol())));ins_sym!(sym::target_abi, sess.target.cfg_abi.desc_symbol());
253    ret.insert((sym::target_arch, Some(sess.target.arch.desc_symbol())));ins_sym!(sym::target_arch, sess.target.arch.desc_symbol());
254    ret.insert((sym::target_endian, Some(sess.target.endian.desc_symbol())));ins_sym!(sym::target_endian, sess.target.endian.desc_symbol());
255    ret.insert((sym::target_env, Some(sess.target.env.desc_symbol())));ins_sym!(sym::target_env, sess.target.env.desc_symbol());
256    ret.insert((sym::target_object_format,
        Some(sess.target.options.binary_format.desc_symbol())));ins_sym!(sym::target_object_format, sess.target.options.binary_format.desc_symbol());
257
258    for family in sess.target.families.as_ref() {
259        ret.insert((sym::target_family, Some(Symbol::intern(family))));ins_str!(sym::target_family, family);
260        if family == "windows" {
261            ret.insert((sym::windows, None));ins_none!(sym::windows);
262        } else if family == "unix" {
263            ret.insert((sym::unix, None));ins_none!(sym::unix);
264        }
265    }
266
267    // `target_has_atomic*`
268    let layout = sess.target.parse_data_layout().unwrap_or_else(|err| {
269        sess.dcx().emit_fatal(err);
270    });
271    let mut has_atomic = false;
272    for (i, align) in [
273        (8, layout.i8_align),
274        (16, layout.i16_align),
275        (32, layout.i32_align),
276        (64, layout.i64_align),
277        (128, layout.i128_align),
278    ] {
279        if i >= sess.target.min_atomic_width() && i <= sess.target.max_atomic_width() {
280            if !has_atomic {
281                has_atomic = true;
282                if sess.is_nightly_build() {
283                    if sess.target.atomic_cas {
284                        ret.insert((sym::target_has_atomic, None));ins_none!(sym::target_has_atomic);
285                    }
286                    ret.insert((sym::target_has_atomic_load_store, None));ins_none!(sym::target_has_atomic_load_store);
287                }
288            }
289            let mut insert_atomic = |sym, align: Align| {
290                if sess.target.atomic_cas {
291                    ret.insert((sym::target_has_atomic, Some(sym)));ins_sym!(sym::target_has_atomic, sym);
292                }
293                if align.bits() == i {
294                    ret.insert((sym::target_has_atomic_primitive_alignment, Some(sym)));ins_sym!(sym::target_has_atomic_primitive_alignment, sym);
295                }
296                ret.insert((sym::target_has_atomic_load_store, Some(sym)));ins_sym!(sym::target_has_atomic_load_store, sym);
297            };
298            insert_atomic(sym::integer(i), align);
299            if sess.target.pointer_width as u64 == i {
300                insert_atomic(sym::ptr, layout.pointer_align().abi);
301            }
302        }
303    }
304
305    if !sess.target.singlethread(&sess.internal_target_features) {
306        ret.insert((sym::target_has_threads, None));ins_none!(sym::target_has_threads);
307    }
308
309    ret.insert((sym::target_os, Some(sess.target.os.desc_symbol())));ins_sym!(sym::target_os, sess.target.os.desc_symbol());
310    ret.insert((sym::target_pointer_width,
        Some(sym::integer(sess.target.pointer_width))));ins_sym!(sym::target_pointer_width, sym::integer(sess.target.pointer_width));
311
312    if sess.opts.unstable_opts.has_thread_local.unwrap_or(sess.target.has_thread_local) {
313        ret.insert((sym::target_thread_local, None));ins_none!(sym::target_thread_local);
314    }
315
316    ret.insert((sym::target_vendor, Some(sess.target.vendor_symbol())));ins_sym!(sym::target_vendor, sess.target.vendor_symbol());
317
318    // If the user wants a test runner, then add the test cfg.
319    if sess.is_test_crate() {
320        ret.insert((sym::test, None));ins_none!(sym::test);
321    }
322
323    if sess.ub_checks() {
324        ret.insert((sym::ub_checks, None));ins_none!(sym::ub_checks);
325    }
326
327    if sess.contract_checks() {
328        ret.insert((sym::contract_checks, None));ins_none!(sym::contract_checks);
329    }
330
331    ret
332}
333
334impl CheckCfg {
335    /// Fill the current [`CheckCfg`] with all the well known cfgs
336    pub fn fill_well_known(&mut self, current_target: &Target) {
337        if !self.exhaustive_values && !self.exhaustive_names {
338            return;
339        }
340
341        // for `#[cfg(foo)]` (i.e. cfg value is none)
342        let no_values = || {
343            let mut values = FxHashSet::default();
344            values.insert(None);
345            ExpectedValues::Some(values)
346        };
347
348        // preparation for inserting some values
349        let empty_values = || {
350            let values = FxHashSet::default();
351            ExpectedValues::Some(values)
352        };
353
354        macro_rules! ins {
355            ($name:expr, $values:expr) => {{
356                self.well_known_names.insert($name);
357                self.expecteds.entry($name).or_insert_with($values)
358            }};
359        }
360
361        // Symbols are inserted in alphabetical order as much as possible.
362        // The exceptions are where control flow forces things out of order.
363        //
364        // NOTE: This should be kept in sync with `default_configuration`.
365        // Note that symbols inserted conditionally in `default_configuration`
366        // are inserted unconditionally here.
367        //
368        // One exception is the `test` cfg which is consider to be a "user-space"
369        // cfg, despite being also set by in `default_configuration` above.
370        // It allows the build system to "deny" using the config by not marking it
371        // as expected (e.g. `lib.test = false` for Cargo).
372        //
373        // When adding a new config here you should also update
374        // `tests/ui/check-cfg/well-known-values.rs` (in order to test the
375        // expected values of the new config) and bless the all directory.
376        //
377        // Don't forget to update `src/doc/rustc/src/check-cfg.md`
378        // in the unstable book as well!
379
380        {
    self.well_known_names.insert(sym::debug_assertions);
    self.expecteds.entry(sym::debug_assertions).or_insert_with(no_values)
};ins!(sym::debug_assertions, no_values);
381
382        {
    self.well_known_names.insert(sym::fmt_debug);
    self.expecteds.entry(sym::fmt_debug).or_insert_with(empty_values)
}ins!(sym::fmt_debug, empty_values).extend(FmtDebug::all());
383
384        // These four are never set by rustc, but we set them anyway; they
385        // should not trigger the lint because `cargo clippy`, `cargo doc`,
386        // `cargo test`, `cargo miri run` and `cargo fmt` (respectively)
387        // can set them.
388        {
    self.well_known_names.insert(sym::clippy);
    self.expecteds.entry(sym::clippy).or_insert_with(no_values)
};ins!(sym::clippy, no_values);
389        {
    self.well_known_names.insert(sym::doc);
    self.expecteds.entry(sym::doc).or_insert_with(no_values)
};ins!(sym::doc, no_values);
390        {
    self.well_known_names.insert(sym::doctest);
    self.expecteds.entry(sym::doctest).or_insert_with(no_values)
};ins!(sym::doctest, no_values);
391        {
    self.well_known_names.insert(sym::miri);
    self.expecteds.entry(sym::miri).or_insert_with(no_values)
};ins!(sym::miri, no_values);
392        {
    self.well_known_names.insert(sym::rust_analyzer);
    self.expecteds.entry(sym::rust_analyzer).or_insert_with(no_values)
};ins!(sym::rust_analyzer, no_values);
393        {
    self.well_known_names.insert(sym::rustfmt);
    self.expecteds.entry(sym::rustfmt).or_insert_with(no_values)
};ins!(sym::rustfmt, no_values);
394
395        {
    self.well_known_names.insert(sym::overflow_checks);
    self.expecteds.entry(sym::overflow_checks).or_insert_with(no_values)
};ins!(sym::overflow_checks, no_values);
396
397        {
    self.well_known_names.insert(sym::panic);
    self.expecteds.entry(sym::panic).or_insert_with(empty_values)
}ins!(sym::panic, empty_values)
398            .extend(PanicStrategy::ALL.iter().map(PanicStrategy::desc_symbol));
399
400        {
    self.well_known_names.insert(sym::proc_macro);
    self.expecteds.entry(sym::proc_macro).or_insert_with(no_values)
};ins!(sym::proc_macro, no_values);
401
402        {
    self.well_known_names.insert(sym::relocation_model);
    self.expecteds.entry(sym::relocation_model).or_insert_with(empty_values)
}ins!(sym::relocation_model, empty_values)
403            .extend(RelocModel::ALL.iter().map(RelocModel::desc_symbol));
404
405        let sanitize_values = SanitizerSet::all()
406            .into_iter()
407            .map(|sanitizer| Symbol::intern(sanitizer.as_str().unwrap()));
408        {
    self.well_known_names.insert(sym::sanitize);
    self.expecteds.entry(sym::sanitize).or_insert_with(empty_values)
}ins!(sym::sanitize, empty_values).extend(sanitize_values);
409
410        {
    self.well_known_names.insert(sym::sanitizer_cfi_generalize_pointers);
    self.expecteds.entry(sym::sanitizer_cfi_generalize_pointers).or_insert_with(no_values)
};ins!(sym::sanitizer_cfi_generalize_pointers, no_values);
411        {
    self.well_known_names.insert(sym::sanitizer_cfi_normalize_integers);
    self.expecteds.entry(sym::sanitizer_cfi_normalize_integers).or_insert_with(no_values)
};ins!(sym::sanitizer_cfi_normalize_integers, no_values);
412
413        {
    self.well_known_names.insert(sym::target_feature);
    self.expecteds.entry(sym::target_feature).or_insert_with(empty_values)
}ins!(sym::target_feature, empty_values).extend(
414            rustc_target::target_features::all_rust_features()
415                .filter(|(_, s)| s.in_cfg())
416                .map(|(f, _s)| f)
417                .chain(rustc_target::target_features::RUSTC_SPECIFIC_FEATURES.iter().cloned())
418                .map(Symbol::intern),
419        );
420
421        // sym::target_*
422        {
423            const VALUES: [&Symbol; 9] = [
424                &sym::target_abi,
425                &sym::target_arch,
426                &sym::target_endian,
427                &sym::target_env,
428                &sym::target_family,
429                &sym::target_object_format,
430                &sym::target_os,
431                &sym::target_pointer_width,
432                &sym::target_vendor,
433            ];
434
435            // Initialize (if not already initialized)
436            for &e in VALUES {
437                if !self.exhaustive_values {
438                    {
    self.well_known_names.insert(e);
    self.expecteds.entry(e).or_insert_with(|| ExpectedValues::Any)
};ins!(e, || ExpectedValues::Any);
439                } else {
440                    {
    self.well_known_names.insert(e);
    self.expecteds.entry(e).or_insert_with(empty_values)
};ins!(e, empty_values);
441                }
442            }
443
444            if self.exhaustive_values {
445                // Get all values map at once otherwise it would be costly.
446                // (8 values * 220 targets ~= 1760 times, at the time of writing this comment).
447                let [
448                    Some(values_target_abi),
449                    Some(values_target_arch),
450                    Some(values_target_endian),
451                    Some(values_target_env),
452                    Some(values_target_family),
453                    Some(values_target_object_format),
454                    Some(values_target_os),
455                    Some(values_target_pointer_width),
456                    Some(values_target_vendor),
457                ] = self.expecteds.get_disjoint_mut(VALUES)
458                else {
459                    {
    ::core::panicking::panic_fmt(format_args!("unable to get all the check-cfg values buckets"));
};panic!("unable to get all the check-cfg values buckets");
460                };
461
462                for target in Target::builtins().chain(iter::once(current_target.clone())) {
463                    values_target_abi.insert(target.options.cfg_abi.desc_symbol());
464                    values_target_arch.insert(target.arch.desc_symbol());
465                    values_target_endian.insert(target.options.endian.desc_symbol());
466                    values_target_env.insert(target.options.env.desc_symbol());
467                    values_target_family.extend(
468                        target.options.families.iter().map(|family| Symbol::intern(family)),
469                    );
470                    values_target_object_format.insert(target.options.binary_format.desc_symbol());
471                    values_target_os.insert(target.options.os.desc_symbol());
472                    values_target_pointer_width.insert(sym::integer(target.pointer_width));
473                    values_target_vendor.insert(target.vendor_symbol());
474                }
475            }
476        }
477
478        let atomic_values = &[
479            sym::ptr,
480            sym::integer(8usize),
481            sym::integer(16usize),
482            sym::integer(32usize),
483            sym::integer(64usize),
484            sym::integer(128usize),
485        ];
486        for sym in [sym::target_has_atomic, sym::target_has_atomic_load_store] {
487            {
    self.well_known_names.insert(sym);
    self.expecteds.entry(sym).or_insert_with(no_values)
}ins!(sym, no_values).extend(atomic_values);
488        }
489        {
    self.well_known_names.insert(sym::target_has_atomic_primitive_alignment);
    self.expecteds.entry(sym::target_has_atomic_primitive_alignment).or_insert_with(empty_values)
}ins!(sym::target_has_atomic_primitive_alignment, empty_values).extend(atomic_values);
490
491        {
    self.well_known_names.insert(sym::target_thread_local);
    self.expecteds.entry(sym::target_thread_local).or_insert_with(no_values)
};ins!(sym::target_thread_local, no_values);
492        {
    self.well_known_names.insert(sym::target_has_threads);
    self.expecteds.entry(sym::target_has_threads).or_insert_with(no_values)
};ins!(sym::target_has_threads, no_values);
493
494        {
    self.well_known_names.insert(sym::ub_checks);
    self.expecteds.entry(sym::ub_checks).or_insert_with(no_values)
};ins!(sym::ub_checks, no_values);
495        {
    self.well_known_names.insert(sym::contract_checks);
    self.expecteds.entry(sym::contract_checks).or_insert_with(no_values)
};ins!(sym::contract_checks, no_values);
496
497        {
    self.well_known_names.insert(sym::unix);
    self.expecteds.entry(sym::unix).or_insert_with(no_values)
};ins!(sym::unix, no_values);
498        {
    self.well_known_names.insert(sym::windows);
    self.expecteds.entry(sym::windows).or_insert_with(no_values)
};ins!(sym::windows, no_values);
499    }
500}