use cargo rustc for macro expansion so -Zbuild-std can be supported#5214
use cargo rustc for macro expansion so -Zbuild-std can be supported#5214skrap wants to merge 4 commits into
cargo rustc for macro expansion so -Zbuild-std can be supported#5214Conversation
0689c20 to
b5da051
Compare
|
Cc @mbyx for ctest |
b5da051 to
1100563
Compare
|
Reminder, once the PR becomes ready for a review, use |
bef315b to
af836b6
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot review I think I have addressed the feedback, though in exploring the changes I sometimes made some different choices. I've left comments in the conversations where appropriate. |
2ef0daf to
3294988
Compare
3294988 to
9dd5dd1
Compare
This comment has been minimized.
This comment has been minimized.
ba0cdaa to
f752fb9
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot review Further review feedback. I'm a bit shy about adding more API than necessary for the stated purpose of the PR. If we have a clear use case for the API proposed, I think that should be proposed in a separate PR. |
There was a problem hiding this comment.
Just updating the status here.
Also, regarding the general concern about API surface area: don't worry about it :) as long as it's somewhat sane, for ctest I tend to err on the side of adding small things we might need while related code is already being modified, rather than leaving a gap that might need ctest-specific changes in the future. There might be somebody who appreciates it even if libc doesn't have an immediate use.
f752fb9 to
c9e1f8a
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot review OK, I have gone with your suggestions on the remaining items. Please have a look. I will squash the commits into one before merging. |
| // In order to avoid warnings causing failures here when the | ||
| // environment's RUSTFLAGS contains -Dwarnings (or similar), | ||
| // we will clear RUSTFLAGS. | ||
| cmd.env_remove("RUSTFLAGS"); |
There was a problem hiding this comment.
Change to .env_clear() so Cargo doesn't pick up more flags that are meant for the host.
There was a problem hiding this comment.
I am guessing this will fail because it'll do away with things like PATH, which might be necessary for cargo to call the correct helpers, but I will do as you ask in the interest of moving this forward.
There was a problem hiding this comment.
Fair point, feel free to leave it for now if you haven't already tested and I'll poke around some more afterwards
| } | ||
|
|
||
| /// Configures extra arguments to be passed to cargo during macro expansion. | ||
| /// This can be used, for example, to pass `-Zbuild-std`` if required. |
There was a problem hiding this comment.
| /// This can be used, for example, to pass `-Zbuild-std`` if required. | |
| /// This can be used, for example, to pass `-Zbuild-std` if required. |
Mismatched backtick
|
|
||
| /// Configures extra arguments to be passed to cargo during macro expansion. | ||
| /// This can be used, for example, to pass `-Zbuild-std`` if required. | ||
| pub fn macro_expansion_cargo_args_mut(&mut self) -> &mut Vec<String> { |
There was a problem hiding this comment.
| pub fn macro_expansion_cargo_args_mut(&mut self) -> &mut Vec<String> { | |
| pub fn expansion_cargo_args_mut(&mut self) -> &mut Vec<String> { |
Simpler name, there's only one expansion
Description
Address #5204 by invoking macro expansion through
cargo rustcinstead of rustc directly. This allows the use of the-Zbuild-stdflag, enabling targets without a prebuilt std (e.g. tier 3 targets) to build the libc tests.Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI