-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
To reproduce, build any kind of code that triggers a future breakage report in a crate that allow
s that warning. For instance:
#![allow(const_patterns_without_partial_eq)]
trait EnumSetType {
type Repr;
}
enum Enum8 { }
impl EnumSetType for Enum8 {
type Repr = u8;
}
#[derive(PartialEq, Eq)]
struct EnumSet<T: EnumSetType> {
__enumset_underlying: T::Repr,
}
const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
fn main() {
match CONST_SET {
CONST_SET => { /* ok */ } //~ERROR: must implement `PartialEq`
_ => panic!("match fell through?"),
}
}
Build this with cargo, then run cargo report future-incompatibilities --id 1
:
The package `fut v0.1.0 (/home/r/src/rust/tmp/fut)` currently triggers the following future incompatibility lints:
> warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
> --> src/main.rs:21:9
> |
> 21 | CONST_SET => { /* ok */ } //~ERROR: must implement `PartialEq`
> | ^^^^^^^^^
> |
> = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
> = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122>
> note: the lint level is defined here
> --> src/main.rs:1:10
> |
> 1 | #![allow(const_patterns_without_partial_eq)]
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
That is quite confusing obviously, since it points at an allow
lint level to justify a warning!
It seems to me like these future compat reports shouldn't display that "lint level is defined here" at all, after all, their entire point is that they are not affected by the lint levels in the crate.
Cc @rust-lang/wg-diagnostics
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.