Skip to content

Delete "$message_type" special case from with_json_contains_unordered #13017

@dtolnay

Description

@dtolnay

#13016 added the following hack to accommodate rust-lang/rust#115691, because for now, some compilers supported by Cargo emit "$message_type" in their diagnostics and some do not.

// Compilers older than 1.76 do not produce $message_type.
// Treat it as optional for now.
let mut expected_entries_without_message_type;
let expected_entries: &mut dyn Iterator<Item = _> =
if l.contains_key("$message_type") && !r.contains_key("$message_type") {
expected_entries_without_message_type =
expected_entries.filter(|entry| entry.0 != "$message_type");
&mut expected_entries_without_message_type
} else {
&mut expected_entries
};

As soon as Cargo's MSRV increases past 1.76, this should be deleted.

According to @epage, the JSON testing infrastructure is intended to be independent of rustc in the long term. Compiler-specific special cases run counter to this effort to switch to a generic third-party library.

Of course deleting the special case only defers the issue until some other JSON change happens in a future release. We still need to figure out how the generic tool should accommodate this in a principled way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testing-cargo-itselfArea: cargo's testsS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions