Skip to content

Commit 96f1da8

Browse files
committed
Auto merge of rust-lang#124638 - nnethercote:mv-expand-tests, r=compiler-errors
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 rust-lang#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. r? `@compiler-errors`
2 parents 80420a6 + 2acbe9c commit 96f1da8

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
@@ -3976,7 +3976,6 @@ dependencies = [
39763976
"rustc_session",
39773977
"rustc_span",
39783978
"smallvec",
3979-
"termcolor",
39803979
"thin-vec",
39813980
"tracing",
39823981
]
@@ -4464,6 +4463,7 @@ dependencies = [
44644463
"rustc_macros",
44654464
"rustc_session",
44664465
"rustc_span",
4466+
"termcolor",
44674467
"thin-vec",
44684468
"tracing",
44694469
"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
@@ -34,24 +34,4 @@ pub mod module;
3434
#[allow(rustc::untranslatable_diagnostic)]
3535
pub mod proc_macro;
3636

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

0 commit comments

Comments
 (0)