diff options
| author | bors <bors@rust-lang.org> | 2024-11-28 19:00:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-28 19:00:58 +0000 |
| commit | a2545fd6fc66b4323f555223a860c451885d1d2b (patch) | |
| tree | b405de3aabf66e4e7f1b9188abd7b4b5b8ecdb56 /tests/ui/rust-2024 | |
| parent | 7e565cce6a03340edb4b9f56228cf5e480e24806 (diff) | |
| parent | f94142b366f9bc57c15e9ac274f83d0f9c03ffac (diff) | |
| download | rust-a2545fd6fc66b4323f555223a860c451885d1d2b.tar.gz rust-a2545fd6fc66b4323f555223a860c451885d1d2b.zip | |
Auto merge of #133540 - ehuss:compiletest-proc-macro, r=jieyouxu
Compiletest: add proc-macro header This adds a `proc-macro` header to simplify using proc-macros, and to reduce boilerplate. This header works similar to the `aux-build` header where you pass a path for a proc-macro to be built. This allows the `force-host`, `no-prefer-dynamic` headers, and `crate_type` attribute to be removed. Additionally it uses `--extern` like `aux_crate` (allows implicit `extern crate` in 2018) and `--extern proc_macro` (to place in the prelude in 2018). ~~This also includes a secondary change which defaults the edition of proc-macros to 2024. This further reduces boilerplate (removing `extern crate proc_macro;`), and allows using modern Rust syntax. I was a little on the fence including this. I personally prefer it, but I can imagine it might be confusing to others.~~ EDIT: Removed Some tests were changed so that when there is a chain of dependencies A→B→C, that the `@ proc-macro` is placed in `B` instead of `A` so that the `--extern` flag works correctly (previously it depended on `-L` to find `C`). I think this is better to make the dependencies more explicit. None of these tests looked like the were actually testing this behavior. There is one test that had an unexplained output change: `tests/ui/macros/same-sequence-span.rs`. I do not know why it changed, but it didn't look like it was particularly important. Perhaps there was a normalization issue? This is currently not compatible with the rustdoc `build-aux-docs` header. It can probably be fixed, I'm just not feeling motivated to do that right now. ### Implementation steps - [x] Document this new behavior in rustc-dev-guide once we figure out the specifics. https://github.com/rust-lang/rustc-dev-guide/pull/2149
Diffstat (limited to 'tests/ui/rust-2024')
6 files changed, 5 insertions, 16 deletions
diff --git a/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2021.rs b/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2021.rs index 81080fcdce3..ab23e63c0da 100644 --- a/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2021.rs +++ b/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2021.rs @@ -1,8 +1,4 @@ -//@ force-host //@ edition:2021 -//@ no-prefer-dynamic - -#![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2024.rs b/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2024.rs index aa655942150..0fa908411f5 100644 --- a/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2024.rs +++ b/tests/ui/rust-2024/auxiliary/reserved-guarded-strings-macro-2024.rs @@ -1,8 +1,4 @@ -//@ force-host //@ edition:2024 -//@ no-prefer-dynamic - -#![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/tests/ui/rust-2024/reserved-guarded-strings-via-macro-2.rs b/tests/ui/rust-2024/reserved-guarded-strings-via-macro-2.rs index 3f9f373ba22..6b0103d4a50 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-via-macro-2.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings-via-macro-2.rs @@ -1,6 +1,6 @@ //@ edition:2021 -//@ aux-build:reserved-guarded-strings-macro-2021.rs -//@ aux-build:reserved-guarded-strings-macro-2024.rs +//@ proc-macro: reserved-guarded-strings-macro-2021.rs +//@ proc-macro: reserved-guarded-strings-macro-2024.rs extern crate reserved_guarded_strings_macro_2021 as m2021; extern crate reserved_guarded_strings_macro_2024 as m2024; diff --git a/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs b/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs index 882f52c48a6..ead2ab40b77 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs @@ -1,6 +1,6 @@ //@ run-pass //@ edition:2024 -//@ aux-build:reserved-guarded-strings-macro-2021.rs +//@ proc-macro: reserved-guarded-strings-macro-2021.rs extern crate reserved_guarded_strings_macro_2021 as m2021; diff --git a/tests/ui/rust-2024/unsafe-attributes/auxiliary/unsafe-attributes-pm.rs b/tests/ui/rust-2024/unsafe-attributes/auxiliary/unsafe-attributes-pm.rs index 557731d82d3..cab6af57cb1 100644 --- a/tests/ui/rust-2024/unsafe-attributes/auxiliary/unsafe-attributes-pm.rs +++ b/tests/ui/rust-2024/unsafe-attributes/auxiliary/unsafe-attributes-pm.rs @@ -1,7 +1,4 @@ -//@ force-host -//@ no-prefer-dynamic - -#![crate_type = "proc-macro"] +//@ edition: 2018 extern crate proc_macro; diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs index 782a3942236..4f369a8305b 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs @@ -6,7 +6,7 @@ //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@[edition2024] compile-flags: -Zunstable-options -//@ aux-crate: unsafe_attributes_pm=unsafe-attributes-pm.rs +//@ proc-macro: unsafe-attributes-pm.rs unsafe_attributes_pm::missing_unsafe!(); |
