about summary refs log tree commit diff
path: root/compiler/rustc_session/src/config
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-09-17 23:55:53 +0200
committerUrgau <urgau@numericable.fr>2025-01-02 16:49:55 +0100
commite8a4792b3e5ffa85453451ba27026de3a48c1581 (patch)
tree3c3ee4c44923be08317ddef12e16b4e95d4814d4 /compiler/rustc_session/src/config
parentbc3e3015b6e449bf1607f1023d2fbc2838ee37af (diff)
Make the `test` cfg a "userspace" check-cfg
Diffstat (limited to 'compiler/rustc_session/src/config')
-rw-r--r--compiler/rustc_session/src/config/cfg.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs
index 3426858495b..b68dfeffa34 100644
--- a/compiler/rustc_session/src/config/cfg.rs
+++ b/compiler/rustc_session/src/config/cfg.rs
@@ -332,6 +332,11 @@ impl CheckCfg {
         // Note that symbols inserted conditionally in `default_configuration`
         // are inserted unconditionally here.
         //
+        // One exception is the `test` cfg which is consider to be a "user-space"
+        // cfg, despite being also set by in `default_configuration` above.
+        // It allows the build system to "deny" using the config by not marking it
+        // as expected (e.g. `lib.test = false` for Cargo).
+        //
         // When adding a new config here you should also update
         // `tests/ui/check-cfg/well-known-values.rs` (in order to test the
         // expected values of the new config) and bless the all directory.
@@ -453,8 +458,6 @@ impl CheckCfg {
 
         ins!(sym::target_thread_local, no_values);
 
-        ins!(sym::test, no_values);
-
         ins!(sym::ub_checks, no_values);
 
         ins!(sym::unix, no_values);