Skip to content

Commit

Permalink
Auto merge of rust-lang#124638 - nnethercote:mv-expand-tests, r=compi…
Browse files Browse the repository at this point in the history
…ler-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`
  • Loading branch information
bors committed May 6, 2024
2 parents 80420a6 + 2acbe9c commit 96f1da8
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 425 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3976,7 +3976,6 @@ dependencies = [
"rustc_session",
"rustc_span",
"smallvec",
"termcolor",
"thin-vec",
"tracing",
]
Expand Down Expand Up @@ -4464,6 +4463,7 @@ dependencies = [
"rustc_macros",
"rustc_session",
"rustc_span",
"termcolor",
"thin-vec",
"tracing",
"unicode-normalization",
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_expand/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
termcolor = "1.2"
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
20 changes: 0 additions & 20 deletions compiler/rustc_expand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,4 @@ pub mod module;
#[allow(rustc::untranslatable_diagnostic)]
pub mod proc_macro;

// HACK(Centril, #64197): These shouldn't really be here.
// Rather, they should be with their respective modules which are defined in other crates.
// However, since for now constructing a `ParseSess` sorta requires `config` from this crate,
// these tests will need to live here in the interim.

#[cfg(test)]
mod tests;
#[cfg(test)]
mod parse {
mod tests;
}
#[cfg(test)]
mod tokenstream {
mod tests;
}
#[cfg(test)]
mod mut_visit {
mod tests;
}

rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
Loading

0 comments on commit 96f1da8

Please sign in to comment.