about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-01-14 16:52:30 +0300
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-01-14 16:52:30 +0300
commitf9174e1d80c4672c288f59aa490a28d3463fd131 (patch)
tree2b39d308b93b10b770da53b33b320df3806ef6dd
parentc30ec5a6fd3ba5e742d14d0a2089b04e43ee4e32 (diff)
downloadrust-f9174e1d80c4672c288f59aa490a28d3463fd131.tar.gz
rust-f9174e1d80c4672c288f59aa490a28d3463fd131.zip
Do not use `HashSet` for `#[rustc_must_implement_one_of]`
-rw-r--r--compiler/rustc_typeck/src/check/check.rs6
-rw-r--r--compiler/rustc_typeck/src/check/mod.rs2
-rw-r--r--src/test/ui/traits/default-method/rustc_must_implement_one_of.rs2
-rw-r--r--src/test/ui/traits/default-method/rustc_must_implement_one_of.stderr4
4 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs
index a49c6bd2e80..88862ea83fd 100644
--- a/compiler/rustc_typeck/src/check/check.rs
+++ b/compiler/rustc_typeck/src/check/check.rs
@@ -980,8 +980,8 @@ fn check_impl_items_against_trait<'tcx>(
         // Check for missing items from trait
         let mut missing_items = Vec::new();
 
-        let mut must_implement_one_of: Option<FxHashSet<Ident>> =
-            trait_def.must_implement_one_of.as_deref().map(|slice| slice.iter().copied().collect());
+        let mut must_implement_one_of: Option<&[Ident]> =
+            trait_def.must_implement_one_of.as_deref();
 
         for &trait_item_id in tcx.associated_item_def_ids(impl_trait_ref.def_id) {
             let is_implemented = ancestors
@@ -1020,7 +1020,7 @@ fn check_impl_items_against_trait<'tcx>(
                 .find(|attr| attr.has_name(sym::rustc_must_implement_one_of))
                 .map(|attr| attr.span);
 
-            missing_items_must_implement_one_of_err(tcx, impl_span, &missing_items, attr_span);
+            missing_items_must_implement_one_of_err(tcx, impl_span, missing_items, attr_span);
         }
     }
 }
diff --git a/compiler/rustc_typeck/src/check/mod.rs b/compiler/rustc_typeck/src/check/mod.rs
index 17c4bc1b301..b26c4c89d6f 100644
--- a/compiler/rustc_typeck/src/check/mod.rs
+++ b/compiler/rustc_typeck/src/check/mod.rs
@@ -644,7 +644,7 @@ fn missing_items_err(
 fn missing_items_must_implement_one_of_err(
     tcx: TyCtxt<'_>,
     impl_span: Span,
-    missing_items: &FxHashSet<Ident>,
+    missing_items: &[Ident],
     annotation_span: Option<Span>,
 ) {
     let missing_items_msg =
diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of.rs b/src/test/ui/traits/default-method/rustc_must_implement_one_of.rs
index f98d3bdc3fa..5ba2f5ce334 100644
--- a/src/test/ui/traits/default-method/rustc_must_implement_one_of.rs
+++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of.rs
@@ -39,6 +39,6 @@ impl Equal for T2 {
 }
 
 impl Equal for T3 {}
-//~^ not all trait items implemented, missing one of: `neq`, `eq`
+//~^ not all trait items implemented, missing one of: `eq`, `neq`
 
 fn main() {}
diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of.stderr b/src/test/ui/traits/default-method/rustc_must_implement_one_of.stderr
index 53c4e71cf8b..5a4dd1388b2 100644
--- a/src/test/ui/traits/default-method/rustc_must_implement_one_of.stderr
+++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of.stderr
@@ -1,8 +1,8 @@
-error[E0046]: not all trait items implemented, missing one of: `neq`, `eq`
+error[E0046]: not all trait items implemented, missing one of: `eq`, `neq`
   --> $DIR/rustc_must_implement_one_of.rs:41:1
    |
 LL | impl Equal for T3 {}
-   | ^^^^^^^^^^^^^^^^^ missing one of `neq`, `eq` in implementation
+   | ^^^^^^^^^^^^^^^^^ missing one of `eq`, `neq` in implementation
    |
 note: required because of this annotation
   --> $DIR/rustc_must_implement_one_of.rs:3:1