Skip to content

$RUST directory normalization fails in GitHub CI tests #223

@schreter

Description

@schreter

On a PR to the cxx crate (see dtolnay/cxx#1180) their ui tests fail, because the normalization doesn't work properly in CI. The path to the Rust libraries is normalized properly in the local working directory, but not in CI. This results in a false-positive error in the test:

2023-02-25T18:57:14.9485120Z EXPECTED:
2023-02-25T18:57:14.9485950Z ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
2023-02-25T18:57:14.9486357Z error[E0599]: the method `to_cxx_exception` exists for reference `&NonError`, but its trait bounds were not satisfied
2023-02-25T18:57:14.9487364Z  --> tests/ui/result_no_display.rs:4:19
2023-02-25T18:57:14.9487605Z   |
2023-02-25T18:57:14.9487886Z 4 |         fn f() -> Result<()>;
2023-02-25T18:57:14.9488390Z   |                   ^^^^^^^^^^ method cannot be called on `&NonError` due to unsatisfied trait bounds
2023-02-25T18:57:14.9488681Z ...
2023-02-25T18:57:14.9488886Z 8 | pub struct NonError;
2023-02-25T18:57:14.9505278Z   | ------------------- doesn't satisfy `NonError: std::fmt::Display`
2023-02-25T18:57:14.9505559Z   |
2023-02-25T18:57:14.9505800Z   = note: the following trait bounds were not satisfied:
2023-02-25T18:57:14.9506086Z           `NonError: std::fmt::Display`
2023-02-25T18:57:14.9506370Z           which is required by `&NonError: ToCxxExceptionDefault`
2023-02-25T18:57:14.9506697Z note: the trait `std::fmt::Display` must be implemented
2023-02-25T18:57:14.9507018Z  --> $RUST/core/src/fmt/mod.rs
2023-02-25T18:57:14.9507551Z   = note: this error originates in the macro `::cxx::map_rust_error_to_cxx_exception` (in Nightly builds, run with -Z macro-backtrace for more info)
2023-02-25T18:57:14.9508072Z ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
2023-02-25T18:57:14.9508234Z 
2023-02-25T18:57:14.9508329Z ACTUAL OUTPUT:
2023-02-25T18:57:14.9508681Z ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
2023-02-25T18:57:14.9509031Z error[E0599]: the method `to_cxx_exception` exists for reference `&NonError`, but its trait bounds were not satisfied
2023-02-25T18:57:14.9509431Z  --> tests/ui/result_no_display.rs:4:19
2023-02-25T18:57:14.9509650Z   |
2023-02-25T18:57:14.9509889Z 4 |         fn f() -> Result<()>;
2023-02-25T18:57:14.9510186Z   |                   ^^^^^^^^^^ method cannot be called on `&NonError` due to unsatisfied trait bounds
2023-02-25T18:57:14.9510454Z ...
2023-02-25T18:57:14.9510647Z 8 | pub struct NonError;
2023-02-25T18:57:14.9511069Z   | ------------------- doesn't satisfy `NonError: std::fmt::Display`
2023-02-25T18:57:14.9511343Z   |
2023-02-25T18:57:14.9511576Z   = note: the following trait bounds were not satisfied:
2023-02-25T18:57:14.9511836Z           `NonError: std::fmt::Display`
2023-02-25T18:57:14.9512138Z           which is required by `&NonError: ToCxxExceptionDefault`
2023-02-25T18:57:14.9512462Z note: the trait `std::fmt::Display` must be implemented
2023-02-25T18:57:14.9512898Z  --> /rustc/c5c7d2b37780dac1092e75f12ab97dd56c30861d/library/core/src/fmt/mod.rs:786:1
2023-02-25T18:57:14.9513496Z   = note: this error originates in the macro `::cxx::map_rust_error_to_cxx_exception` (in Nightly builds, run with -Z macro-backtrace for more info)
2023-02-25T18:57:14.9514007Z ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
2023-02-25T18:57:14.9514325Z note: If the actual output is the correct output you can bless it by rerunning
2023-02-25T18:57:14.9514657Z       your test with the environment variable TRYBUILD=overwrite

Here, the normalization of /rustc/c5c7d2b37780dac1092e75f12ab97dd56c30861d/library/core/src/fmt/mod.rs:786:1 to $RUST/core/src/fmt/mod.rs fails, because only /rustlib/src/rust/src/ is considered.

I suppose, the normalization step should be extended to also normalize /rustc/[0-9a-f]+/library/ to $RUST/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions