about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/lib.rs
diff options
context:
space:
mode:
authorThom Chiovoloni <chiovolonit@gmail.com>2020-12-02 15:16:12 -0800
committerJoshua Nelson <jyn514@gmail.com>2021-08-16 03:55:27 +0000
commit402a9c9f5e143baaf37ef8b68d84edaadda253dd (patch)
tree4da3f28014e6b29e48b130685fd0641babd80f25 /compiler/rustc_lint/src/lib.rs
parent7069a8c2b78c5d23205de1cabb4c2a65229dbd8f (diff)
downloadrust-402a9c9f5e143baaf37ef8b68d84edaadda253dd.tar.gz
rust-402a9c9f5e143baaf37ef8b68d84edaadda253dd.zip
Uplift the `invalid_atomic_ordering` lint from clippy to rustc
- Deprecate clippy::invalid_atomic_ordering
- Use rustc_diagnostic_item for the orderings in the invalid_atomic_ordering lint
- Reduce code duplication
- Give up on making enum variants diagnostic items and just look for
`Ordering` instead

  I ran into tons of trouble with this because apparently the change to
  store HIR attrs in a side table also gave the DefIds of the
  constructor instead of the variant itself. So I had to change
  `matches_ordering` to also check the grandparent of the defid as well.

- Rename `atomic_ordering_x` symbols to just the name of the variant
- Fix typos in checks - there were a few places that said "may not be
  Release" in the diagnostic but actually checked for SeqCst in the lint.
- Make constant items const
- Use fewer diagnostic items
- Only look at arguments after making sure the method matches

  This prevents an ICE when there aren't enough arguments.

- Ignore trait methods
- Only check Ctors instead of going through `qpath_res`

  The functions take values, so this couldn't ever be anything else.

- Add if_chain to allowed dependencies
- Fix grammar
- Remove unnecessary allow
Diffstat (limited to 'compiler/rustc_lint/src/lib.rs')
-rw-r--r--compiler/rustc_lint/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 1786f1e7034..79f850a781b 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -170,6 +170,7 @@ macro_rules! late_lint_passes {
                 TemporaryCStringAsPtr: TemporaryCStringAsPtr,
                 NonPanicFmt: NonPanicFmt,
                 NoopMethodCall: NoopMethodCall,
+                InvalidAtomicOrdering: InvalidAtomicOrdering,
             ]
         );
     };