Skip to content

Fix uefi-macros trybuild test #1183

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
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions uefi-macros/tests/ui/fail/entry_bad_return_type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ error[E0308]: mismatched types
8 | fn main(_handle: Handle, _st: SystemTable<Boot>) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Status`, found `bool`
|
= note: expected fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<_>) -> Status`
found fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<_>) -> bool`
= note: expected fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<uefi::table::Boot>) -> Status`
found fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<uefi::table::Boot>) -> bool`
15 changes: 15 additions & 0 deletions xtask/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,21 @@ impl Cargo {
}
CargoAction::Test => {
action = "test";

// Ensure that uefi-macros trybuild tests work regardless of
// whether RUSTFLAGS is set.
//
// The trybuild tests run `rustc` with `--verbose`, which
// affects error output. This flag is set via
// `--config=build.rustflags` [1], but that will be ignored if
// the RUSTFLAGS env var is set. Compensate by appending
// `--verbose` to the var in that case.
//
// [1]: https://github.com/dtolnay/trybuild/blob/b1b7064b7ad11e0ab563e9eb843651d86e4545b7/src/cargo.rs#L44
if let Ok(mut rustflags) = env::var("RUSTFLAGS") {
rustflags.push_str(" --verbose");
cmd.env("RUSTFLAGS", rustflags);
}
}
};
cmd.arg(action);
Expand Down