-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Running from this commit, I get this unexpected GitHub Actions failure.
The source of the failure is that the trybuild crate (v1.0.85) is running UI tests in the tests/ui-nightly directory, and three of these tests are failing:
tests/ui-nightly/transmute-ref-dst-unsized.rs
tests/ui-nightly/transmute-ref-src-dst-unsized.rs
tests/ui-nightly/transmute-ref-src-unsized.rs
Unfortunately all that's output by trybuild is separate "expected" and "actual" output, so we have to diff by hand. Doing that reveals the following diffs between the expected outputs (present in the .stderr files) and the actual outputs (observed from rustc).
For tests/ui-nightly/transmute-ref-dst-unsized.rs:
35,37d34
< |
< | pub fn transmute<Src, Dst>(src: Src) -> Dst;
< | ^^^ required by this bound in `transmute`
For tests/ui-nightly/transmute-ref-src-dst-unsized.rs:
55,57d54
< |
< | pub fn transmute<Src, Dst>(src: Src) -> Dst;
< | ^^^ required by this bound in `transmute`
80,82d76
< |
< | pub fn transmute<Src, Dst>(src: Src) -> Dst;
< | ^^^ required by this bound in `transmute`
For tests/ui-nightly/transmute-ref-src-unsized.rs:
41,43d40
< |
< | pub fn transmute<Src, Dst>(src: Src) -> Dst;
< | ^^^ required by this bound in `transmute`
The "expected" output (the .stderr files) were generated by running the exact same command that is run here and on the exact same toolchain, but locally on my development machine (Linux), and with the extra TRYBUILD=overwrite environment variable to instruct trybuild to generate rather than test the .stderr files. In particular, that command is:
./cargo.sh +nightly test \
--package zerocopy \
--target x86_6[4](https://github.com/google/zerocopy/actions/runs/6411470438/job/17407059827?pr=183#step:10:4)-unknown-linux-gnu \
--features __internal_use_only_features_that_work_on_stable \
--verbose \
--What makes me think that this is a rustc bug is that the observed output from rustc (ie, the "actual" files) includes output like the following:
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> tests/ui-nightly/transmute-ref-dst-unsized.rs:13:28
|
13 | const DST_UNSIZED: &[u8] = transmute_ref!(&[0u8; 1]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `std::intrinsics::transmute`
--> $RUST/core/src/intrinsics.rs
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info)
IIUC, rustc should never produce output that says "required by a bound in...", lists the file, and then doesn't produce any code snippet. In the files generated on my local machine, this looks more sensible:
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> tests/ui-nightly/transmute-ref-dst-unsized.rs:13:28
|
13 | const DST_UNSIZED: &[u8] = transmute_ref!(&[0u8; 1]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `std::intrinsics::transmute`
--> $RUST/core/src/intrinsics.rs
|
| pub fn transmute<Src, Dst>(src: Src) -> Dst;
| ^^^ required by this bound in `transmute`
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info)
(Note that $RUST is the result of trybuild trying to normalize output so that it's less sensitive to small changes in compiler output. There is of course a chance that the spurious truncation is a bug in trybuild, and I've reported this bug to them as well.)
Version
cargo 1.71.0-nightly (64fb38c97 2023-05-23)
cc @jswrenn