Skip to content
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

Error patterns in UI tests do not allow normalized placeholders #90116

Open
pierwill opened this issue Oct 20, 2021 · 0 comments
Open

Error patterns in UI tests do not allow normalized placeholders #90116

pierwill opened this issue Oct 20, 2021 · 0 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.

Comments

@pierwill
Copy link
Member

pierwill commented Oct 20, 2021

For example, consider this test code:

#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs3_Csno73SFvQKx_1cINtB3_3StrKRef09f908af09fa688f09fa686f09f90ae20c2a720f09f90b6f09f9192e29895f09f94a520c2a720f09fa7a1f09f929bf09f929af09f9299f09f929c_E)
//~| ERROR demangling(<c[464da6a86cb672f]::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>)
//~| ERROR demangling-alt(<c::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>)
impl Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜"> {}

After normalization of this to read

 #[rustc_symbol_name] 
 //~^ ERROR symbol-name(_RMs3_CsCRATE_HASH_1cINtB3_3StrKRef09f908af09fa688f09fa686f09f90ae20c2a720f09f90b6f09f9192e29895f09f94a520c2a720f09fa7a1f09f929bf09f929af09f9299f09f929c_E) 
 //~| ERROR demangling(<c[HASH]::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>) 
 //~| ERROR demangling-alt(<c::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>) 
 impl Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜"> {} 

one must truncate the entire annotation, or the test will fail, even if the correct, normalized output is in the .stderr file.

See the discussion in #89836 (comment).

@pierwill pierwill changed the title Error patterns only allow truncating the suffix and not the prefix. Error patterns do not allow normalized placeholders Oct 20, 2021
@pierwill pierwill changed the title Error patterns do not allow normalized placeholders Error patterns in UI tests do not allow normalized placeholders Oct 21, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 21, 2021
…orn3

Include rustc version in `rustc_span::StableCrateId`

`rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design.

In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable.

In the UI tests, I had to truncate a signification amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See rust-lang#90116.)

Closes rust-lang#85142.
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 16, 2021
…eywiser

Include rustc version in `rustc_span::StableCrateId`

`rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design.

In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable.

In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See rust-lang#90116.)

Closes rust-lang#85142.
@Dylan-DPC Dylan-DPC added A-libtest Area: `#[test]` / the `test` library C-bug Category: This is a bug. A-testsuite Area: The testsuite used to check the correctness of rustc and removed A-libtest Area: `#[test]` / the `test` library labels Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants