Skip to content

Commit 70cc333

Browse files
committed
Move some tests from rustc_expand to rustc_parse.
There are some test cases involving `parse` and `tokenstream` and `mut_visit` that are located in `rustc_expand`. Because it used to be the case that constructing a `ParseSess` required the involvement of `rustc_expand`. However, since #64197 merged (a long time ago) `rust_expand` no longer needs to be involved. This commit moves the tests into `rustc_parse`. This is the optimal place for the `parse` tests. It's not ideal for the `tokenstream` and `mut_visit` tests -- they would be better in `rustc_ast` -- but they still rely on parsing, which is not available in `rustc_ast`. But `rustc_parse` is lower down in the crate graph and closer to `rustc_ast` than `rust_expand`, so it's still an improvement for them. The exact renaming is as follows: - rustc_expand/src/mut_visit/tests.rs -> rustc_parse/src/parser/mut_visit/tests.rs - rustc_expand/src/tokenstream/tests.rs -> rustc_parse/src/parser/tokenstream/tests.rs - rustc_expand/src/tests.rs + rustc_expand/src/parse/tests.rs -> compiler/rustc_parse/src/parser/tests.rs The latter two test files are combined because there's no need for them to be separate, and having a `rustc_parse::parser::parse` module would be weird. This also means some `pub(crate)`s can be removed.
1 parent 79734f1 commit 70cc333

File tree

9 files changed

+405
-425
lines changed

9 files changed

+405
-425
lines changed

Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -3907,7 +3907,6 @@ dependencies = [
39073907
"rustc_session",
39083908
"rustc_span",
39093909
"smallvec",
3910-
"termcolor",
39113910
"thin-vec",
39123911
"tracing",
39133912
]
@@ -4396,6 +4395,7 @@ dependencies = [
43964395
"rustc_macros",
43974396
"rustc_session",
43984397
"rustc_span",
4398+
"termcolor",
43994399
"thin-vec",
44004400
"tracing",
44014401
"unicode-normalization",

compiler/rustc_expand/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ rustc_serialize = { path = "../rustc_serialize" }
2525
rustc_session = { path = "../rustc_session" }
2626
rustc_span = { path = "../rustc_span" }
2727
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
28-
termcolor = "1.2"
2928
thin-vec = "0.2.12"
3029
tracing = "0.1"
3130
# tidy-alphabetical-end

compiler/rustc_expand/src/lib.rs

-20
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,4 @@ pub mod proc_macro;
3838
#[allow(rustc::untranslatable_diagnostic)]
3939
pub(crate) mod mbe;
4040

41-
// HACK(Centril, #64197): These shouldn't really be here.
42-
// Rather, they should be with their respective modules which are defined in other crates.
43-
// However, since for now constructing a `ParseSess` sorta requires `config` from this crate,
44-
// these tests will need to live here in the interim.
45-
46-
#[cfg(test)]
47-
mod tests;
48-
#[cfg(test)]
49-
mod parse {
50-
mod tests;
51-
}
52-
#[cfg(test)]
53-
mod tokenstream {
54-
mod tests;
55-
}
56-
#[cfg(test)]
57-
mod mut_visit {
58-
mod tests;
59-
}
60-
6141
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

0 commit comments

Comments
 (0)