about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2024-11-27 17:21:59 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2024-11-28 15:45:25 +0000
commit72d2db7bf46f565f4ee5cc73d65b4f4906e7420e (patch)
treecc99fa78c866bf03bb01acd2df7d33d6f5337bce /src/bootstrap
parentc322cd5c5ac13b5ef16a487c889f8c148d8e3841 (diff)
downloadrust-72d2db7bf46f565f4ee5cc73d65b4f4906e7420e.tar.gz
rust-72d2db7bf46f565f4ee5cc73d65b4f4906e7420e.zip
Implement lint against `Symbol::intern` on a string literal
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/builder/cargo.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index 0688a1d6892..13f351de20e 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -1030,6 +1030,15 @@ impl Builder<'_> {
 
         if mode == Mode::Rustc {
             rustflags.arg("-Wrustc::internal");
+            // cfg(bootstrap) - remove this check when lint is in bootstrap compiler
+            if stage != 0 {
+                // Lint is allow by default so downstream tools don't get a lit
+                // they can do nothing about
+                // We shouldn't be preinterning symbols used by tests
+                if cmd_kind != Kind::Test {
+                    rustflags.arg("-Drustc::symbol_intern_string_literal");
+                }
+            }
             // FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
             // of the individual lints are satisfied.
             rustflags.arg("-Wkeyword_idents_2024");