Module rustc_session::config::cfg

source ·
Expand description

cfg and check-cfg configuration

This module contains the definition of Cfg and CheckCfg as well as the logic for creating the default configuration for a given Session.

It also contains the filling of the well known configs, which should ALWAYS be in sync with the default_configuration.

§Adding a new cfg

Adding a new feature requires two new symbols one for the cfg it-self and the second one for the unstable feature gate, those are defined in rustc_span::symbol.

As well as the following points,

  • Add the activation logic in default_configuration
  • Add the cfg to CheckCfg::fill_well_known (and related files), so that the compiler can know the cfg is expected
  • Add the cfg in disallow_cfgs to disallow users from setting it via --cfg
  • Add the feature gating in compiler/rustc_feature/src/builtin_attrs.rs

Structs§

Enums§

Functions§

Type Aliases§

  • The parsed --cfg options that define the compilation environment of the crate, used to drive conditional compilation.