about summary refs log tree commit diff
path: root/compiler/rustc_span/src
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_span/src
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_span/src')
-rw-r--r--compiler/rustc_span/src/symbol.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 1ac489f600a..3e458778a7f 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -121,6 +121,8 @@ symbols! {
     // There is currently no checking that all symbols are used; that would be
     // nice to have.
     Symbols {
+        AcqRel,
+        Acquire,
         Alignment,
         Any,
         Arc,
@@ -129,6 +131,20 @@ symbols! {
         Arguments,
         AsMut,
         AsRef,
+        AtomicBool,
+        AtomicI128,
+        AtomicI16,
+        AtomicI32,
+        AtomicI64,
+        AtomicI8,
+        AtomicIsize,
+        AtomicPtr,
+        AtomicU128,
+        AtomicU16,
+        AtomicU32,
+        AtomicU64,
+        AtomicU8,
+        AtomicUsize,
         BTreeEntry,
         BTreeMap,
         BTreeSet,
@@ -215,12 +231,15 @@ symbols! {
         Rc,
         Ready,
         Receiver,
+        Relaxed,
+        Release,
         Result,
         Return,
         Right,
         RustcDecodable,
         RustcEncodable,
         Send,
+        SeqCst,
         Some,
         StructuralEq,
         StructuralPartialEq,
@@ -311,6 +330,8 @@ symbols! {
         assume_init,
         async_await,
         async_closure,
+        atomic,
+        atomic_mod,
         atomics,
         att_syntax,
         attr,
@@ -390,8 +411,12 @@ symbols! {
         coerce_unsized,
         cold,
         column,
+        compare_and_swap,
+        compare_exchange,
+        compare_exchange_weak,
         compile_error,
         compiler_builtins,
+        compiler_fence,
         concat,
         concat_idents,
         conservative_impl_trait,
@@ -575,6 +600,8 @@ symbols! {
         fadd_fast,
         fdiv_fast,
         feature,
+        fence,
+        fetch_update,
         ffi,
         ffi_const,
         ffi_pure,
@@ -728,6 +755,7 @@ symbols! {
         lint_reasons,
         literal,
         llvm_asm,
+        load,
         local,
         local_inner_macros,
         log10f32,
@@ -1217,6 +1245,7 @@ symbols! {
         stmt,
         stmt_expr_attributes,
         stop_after_dataflow,
+        store,
         str,
         str_alloc,
         string_type,