-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
compiletest: Support --extern modifiers with proc-macro directive
#151695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+36
−9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So that `pub-priv1.rs` test does not have to (ab)use the `aux-crate` directive for this purpose. This is very edge-casey so I don't think we should document this in rustc-dev-guide. If someone needs to do this they will look at the code and easily find the functionality. This is a bit hacky since `--extern priv:pm.rs` is not valid, but we can make our directives work however we want. And I think this is a fine pragmatic approach. Doing it "the right way" would be a lot of work for not much gain. Plus, that work can be done incrementally in small steps in the future if wanted.
4d31092 to
996d72b
Compare
1 task
Collaborator
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
--extern options with proc-macro directive--extern modifiers with proc-macro directive
Member
|
Thanks for splitting out the previous changes. @bors r+ |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 2, 2026
…thar compiletest: Support `--extern` modifiers with `proc-macro` directive So that the `src/tools/compiletest/src/directives/auxiliary/tests.rs` test does not have to (ab)use the `aux-crate` directive for this purpose. This is very edge-casey so I don't think we should document this in rustc-dev-guide. Mentioning it will confuse more than it helps. If someone needs to do this they will look at the code and easily find the functionality. This is a bit hacky since `--extern priv:pm.rs` is not valid, but we can make our directives work however we want. And I think this is a fine pragmatic approach. Doing it "the right way" would be a lot of work for not much gain. Plus, that work can be done incrementally in small steps in the future if wanted. r? @Zalathar --- Follow-up to: - rust-lang#151353 - rust-lang#151670 ### Unblocks: - rust-lang#151691, because without this fix that test fails (see rust-lang#151691 (comment))
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 2, 2026
…uwer Rollup of 11 pull requests Successful merges: - #150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151902 (explain why we dont skip some of this work when there are field projections) - #151974 (Update documentation for `Result::ok()`) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 2, 2026
…thar compiletest: Support `--extern` modifiers with `proc-macro` directive So that the `src/tools/compiletest/src/directives/auxiliary/tests.rs` test does not have to (ab)use the `aux-crate` directive for this purpose. This is very edge-casey so I don't think we should document this in rustc-dev-guide. Mentioning it will confuse more than it helps. If someone needs to do this they will look at the code and easily find the functionality. This is a bit hacky since `--extern priv:pm.rs` is not valid, but we can make our directives work however we want. And I think this is a fine pragmatic approach. Doing it "the right way" would be a lot of work for not much gain. Plus, that work can be done incrementally in small steps in the future if wanted. r? @Zalathar --- Follow-up to: - rust-lang#151353 - rust-lang#151670 ### Unblocks: - rust-lang#151691, because without this fix that test fails (see rust-lang#151691 (comment))
This was referenced Feb 2, 2026
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 2, 2026
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 2, 2026
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 3, 2026
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
rust-timer
added a commit
that referenced
this pull request
Feb 3, 2026
Rollup merge of #151695 - Enselic:proc-macro-priv-v2, r=Zalathar compiletest: Support `--extern` modifiers with `proc-macro` directive So that the `src/tools/compiletest/src/directives/auxiliary/tests.rs` test does not have to (ab)use the `aux-crate` directive for this purpose. This is very edge-casey so I don't think we should document this in rustc-dev-guide. Mentioning it will confuse more than it helps. If someone needs to do this they will look at the code and easily find the functionality. This is a bit hacky since `--extern priv:pm.rs` is not valid, but we can make our directives work however we want. And I think this is a fine pragmatic approach. Doing it "the right way" would be a lot of work for not much gain. Plus, that work can be done incrementally in small steps in the future if wanted. r? @Zalathar --- Follow-up to: - #151353 - #151670 ### Unblocks: - #151691, because without this fix that test fails (see #151691 (comment))
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Feb 3, 2026
…mic-v2, r=jdonszelmann
compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic`
Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with:
error: test compilation failed although it shouldn't!
--- stderr -------------------------------
error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
--> .../no-prefer-dynamic-means-no-so.rs:9:5
|
LL | no_prefer_dynamic_lib::return_42();
| ^^^^^^^^^^^^^^^^^^^^^
### Needed by:
- rust-lang#150591 because of rust-lang#151271. But IMHO this PR makes sense on its own.
### Must wait for:
- [x] rust-lang#151695
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Feb 3, 2026
…mic-v2, r=jdonszelmann
compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic`
Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with:
error: test compilation failed although it shouldn't!
--- stderr -------------------------------
error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
--> .../no-prefer-dynamic-means-no-so.rs:9:5
|
LL | no_prefer_dynamic_lib::return_42();
| ^^^^^^^^^^^^^^^^^^^^^
### Needed by:
- rust-lang#150591 because of rust-lang#151271. But IMHO this PR makes sense on its own.
### Must wait for:
- [x] rust-lang#151695
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Feb 3, 2026
…mic-v2, r=jdonszelmann
compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic`
Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with:
error: test compilation failed although it shouldn't!
--- stderr -------------------------------
error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
--> .../no-prefer-dynamic-means-no-so.rs:9:5
|
LL | no_prefer_dynamic_lib::return_42();
| ^^^^^^^^^^^^^^^^^^^^^
### Needed by:
- rust-lang#150591 because of rust-lang#151271. But IMHO this PR makes sense on its own.
### Must wait for:
- [x] rust-lang#151695
rust-timer
added a commit
that referenced
this pull request
Feb 3, 2026
Rollup merge of #151691 - Enselic:dylib-only-for-prefer-dynamic-v2, r=jdonszelmann compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic` Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with: error: test compilation failed although it shouldn't! --- stderr ------------------------------- error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so --> .../no-prefer-dynamic-means-no-so.rs:9:5 | LL | no_prefer_dynamic_lib::return_42(); | ^^^^^^^^^^^^^^^^^^^^^ ### Needed by: - #150591 because of #151271. But IMHO this PR makes sense on its own. ### Must wait for: - [x] #151695
github-actions bot
pushed a commit
to rust-lang/compiler-builtins
that referenced
this pull request
Feb 3, 2026
…=jdonszelmann
compiletest: Don't assume `aux-crate` becomes a `*.so` with `no-prefer-dynamic`
Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with:
error: test compilation failed although it shouldn't!
--- stderr -------------------------------
error: extern location for no_prefer_dynamic_lib does not exist: .../auxiliary/libno_prefer_dynamic_lib.so
--> .../no-prefer-dynamic-means-no-so.rs:9:5
|
LL | no_prefer_dynamic_lib::return_42();
| ^^^^^^^^^^^^^^^^^^^^^
### Needed by:
- rust-lang/rust#150591 because of rust-lang/rust#151271. But IMHO this PR makes sense on its own.
### Must wait for:
- [x] rust-lang/rust#151695
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-compiletest
Area: The compiletest test runner
A-testsuite
Area: The testsuite used to check the correctness of rustc
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So that the
src/tools/compiletest/src/directives/auxiliary/tests.rstest does not have to (ab)use theaux-cratedirective for this purpose.This is very edge-casey so I don't think we should document this in rustc-dev-guide. Mentioning it will confuse more than it helps. If someone needs to do this they will look at the code and easily find the functionality.
This is a bit hacky since
--extern priv:pm.rsis not valid, but we can make our directives work however we want. And I think this is a fine pragmatic approach. Doing it "the right way" would be a lot of work for not much gain. Plus, that work can be done incrementally in small steps in the future if wanted.r? @Zalathar
Follow-up to:
aux-cratedirective explicitly handle--externmodifiers #151353proc-macrodirective into struct #151670Unblocks:
aux-cratebecomes a*.sowithno-prefer-dynamic#151691, because without this fix that test fails (see compiletest: Don't assumeaux-cratebecomes a*.sowithno-prefer-dynamic#151691 (comment))