Skip to content

Commit 958fc08

Browse files
authored
Rollup merge of #134173 - onur-ozkan:allow-symbol-intern-string-literal, r=jieyouxu
allow `symbol_intern_string_literal` lint in test modules Since #133545, `x check compiler --stage 1` no longer works because compiler test modules trigger `symbol_intern_string_literal` lint errors. Bootstrap shouldn't control when to ignore or enable this lint in the compiler tree (using `Kind != Test` was ineffective for obvious reasons). Also, conditionally adding this rustflag invalidates the build cache between `x test` and other commands. This PR removes the `Kind` check from bootstrap and handles it directly in the compiler tree in a more natural way.
2 parents 454ed9b + 1268445 commit 958fc08

File tree

7 files changed

+13
-6
lines changed

7 files changed

+13
-6
lines changed

Diff for: compiler/rustc_ast/src/util/comments/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
2+
13
use rustc_span::create_default_session_globals_then;
24

35
use super::*;

Diff for: compiler/rustc_hir/src/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
2+
13
use rustc_data_structures::stable_hasher::Hash64;
24
use rustc_span::def_id::{DefPathHash, StableCrateId};
35
use rustc_span::edition::Edition;

Diff for: compiler/rustc_lint/src/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
2+
13
use rustc_span::{Symbol, create_default_session_globals_then};
24

35
use crate::levels::parse_lint_and_tool_name;

Diff for: compiler/rustc_parse/src/parser/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
2+
13
use std::assert_matches::assert_matches;
24
use std::io::prelude::*;
35
use std::iter::Peekable;

Diff for: compiler/rustc_parse/src/parser/tokenstream/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
2+
13
use rustc_ast::token::{self, IdentIsRaw};
24
use rustc_ast::tokenstream::{TokenStream, TokenTree};
35
use rustc_span::{BytePos, Span, Symbol, create_default_session_globals_then};

Diff for: compiler/rustc_span/src/edit_distance/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
2+
13
use super::*;
24

35
#[test]

Diff for: src/bootstrap/src/core/builder/cargo.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1035,12 +1035,7 @@ impl Builder<'_> {
10351035
rustflags.arg("-Wrustc::internal");
10361036
// cfg(bootstrap) - remove this check when lint is in bootstrap compiler
10371037
if stage != 0 {
1038-
// Lint is allow by default so downstream tools don't get a lit
1039-
// they can do nothing about
1040-
// We shouldn't be preinterning symbols used by tests
1041-
if cmd_kind != Kind::Test {
1042-
rustflags.arg("-Drustc::symbol_intern_string_literal");
1043-
}
1038+
rustflags.arg("-Drustc::symbol_intern_string_literal");
10441039
}
10451040
// FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
10461041
// of the individual lints are satisfied.

0 commit comments

Comments
 (0)