diff --git a/uefi-macros/tests/ui/fail/entry_bad_return_type.stderr b/uefi-macros/tests/ui/fail/entry_bad_return_type.stderr index 52e4a7cfb..4c7d1674e 100644 --- a/uefi-macros/tests/ui/fail/entry_bad_return_type.stderr +++ b/uefi-macros/tests/ui/fail/entry_bad_return_type.stderr @@ -4,5 +4,5 @@ error[E0308]: mismatched types 8 | fn main(_handle: Handle, _st: SystemTable) -> 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) -> Status` + found fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable) -> bool` diff --git a/xtask/src/cargo.rs b/xtask/src/cargo.rs index 8376e514e..8039d6a91 100644 --- a/xtask/src/cargo.rs +++ b/xtask/src/cargo.rs @@ -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);