Closed
Description
The test src/test/ui/type-alias-impl-trait/structural-match-no-leak.rs (copied below to preserve its state)
#![feature(type_alias_impl_trait)]
type Bar = impl Send;
// While i32 is structural-match, we do not want to leak this information.
// (See https://github.com/rust-lang/rust/issues/72156)
const fn leak_free() -> Bar {
7i32
}
const LEAK_FREE: Bar = leak_free();
fn leak_free_test() {
match LEAK_FREE {
LEAK_FREE => (),
//~^ ERROR constant pattern depends on a generic parameter
//~| ERROR constant pattern depends on a generic parameter
_ => (),
}
}
fn main() {}
reports an error about "depends on a generic parameter", when there are no generic parameters anywhere. The issue is that we only have a single TooGeneric
variant in https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/interpret/enum.ErrorHandled.html#variant.TooGeneric . We should change that fieldless variant to TooGeneric(TooGeneric)
and introduce an
enum TooGeneric {
/// The query encountered a generic parameter and could
/// not extract required information from it.
Param,
/// The query encountered an opaque type in `Reveal::Userfacing`
/// mode and was thus unable to reveal the hidden type.
OpaqueType,
}
Originally posted by @lcnr in #101478 (comment)
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Diagnostics: A diagnostic that is giving misleading or incorrect information.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#[feature(type_alias_impl_trait)]`Working group: Diagnostics
Type
Projects
Status
Done