diff options
| author | bors <bors@rust-lang.org> | 2021-10-11 17:12:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-11 17:12:14 +0000 |
| commit | 5b210643ebf2485aafdf2494de8cf41941a64e95 (patch) | |
| tree | 60ecf0b4cd6f526c9e5d02474b2c7e82ac233760 /compiler/rustc_lint/src/lib.rs | |
| parent | 1067e2ca5e9cfe5c79f956e49ffc684c5142d49b (diff) | |
| parent | f4836768be12a0cd3a6bd8afc551ae836a87d973 (diff) | |
| download | rust-5b210643ebf2485aafdf2494de8cf41941a64e95.tar.gz rust-5b210643ebf2485aafdf2494de8cf41941a64e95.zip | |
Auto merge of #83908 - Flying-Toast:master, r=davidtwco
Add enum_intrinsics_non_enums lint There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this. I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662). closes #83899
Diffstat (limited to 'compiler/rustc_lint/src/lib.rs')
| -rw-r--r-- | compiler/rustc_lint/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 17eb0054584..6f684a0fe51 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -47,6 +47,7 @@ mod array_into_iter; pub mod builtin; mod context; mod early; +mod enum_intrinsics_non_enums; mod internal; mod late; mod levels; @@ -76,6 +77,7 @@ use rustc_span::Span; use array_into_iter::ArrayIntoIter; use builtin::*; +use enum_intrinsics_non_enums::EnumIntrinsicsNonEnums; use internal::*; use methods::*; use non_ascii_idents::*; @@ -168,6 +170,7 @@ macro_rules! late_lint_passes { TemporaryCStringAsPtr: TemporaryCStringAsPtr, NonPanicFmt: NonPanicFmt, NoopMethodCall: NoopMethodCall, + EnumIntrinsicsNonEnums: EnumIntrinsicsNonEnums, InvalidAtomicOrdering: InvalidAtomicOrdering, NamedAsmLabels: NamedAsmLabels, ] |
