Skip to content

Commit f9174e1

Browse files
committed
Do not use HashSet for #[rustc_must_implement_one_of]
1 parent c30ec5a commit f9174e1

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

compiler/rustc_typeck/src/check/check.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,8 @@ fn check_impl_items_against_trait<'tcx>(
980980
// Check for missing items from trait
981981
let mut missing_items = Vec::new();
982982

983-
let mut must_implement_one_of: Option<FxHashSet<Ident>> =
984-
trait_def.must_implement_one_of.as_deref().map(|slice| slice.iter().copied().collect());
983+
let mut must_implement_one_of: Option<&[Ident]> =
984+
trait_def.must_implement_one_of.as_deref();
985985

986986
for &trait_item_id in tcx.associated_item_def_ids(impl_trait_ref.def_id) {
987987
let is_implemented = ancestors
@@ -1020,7 +1020,7 @@ fn check_impl_items_against_trait<'tcx>(
10201020
.find(|attr| attr.has_name(sym::rustc_must_implement_one_of))
10211021
.map(|attr| attr.span);
10221022

1023-
missing_items_must_implement_one_of_err(tcx, impl_span, &missing_items, attr_span);
1023+
missing_items_must_implement_one_of_err(tcx, impl_span, missing_items, attr_span);
10241024
}
10251025
}
10261026
}

compiler/rustc_typeck/src/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ fn missing_items_err(
644644
fn missing_items_must_implement_one_of_err(
645645
tcx: TyCtxt<'_>,
646646
impl_span: Span,
647-
missing_items: &FxHashSet<Ident>,
647+
missing_items: &[Ident],
648648
annotation_span: Option<Span>,
649649
) {
650650
let missing_items_msg =

src/test/ui/traits/default-method/rustc_must_implement_one_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ impl Equal for T2 {
3939
}
4040

4141
impl Equal for T3 {}
42-
//~^ not all trait items implemented, missing one of: `neq`, `eq`
42+
//~^ not all trait items implemented, missing one of: `eq`, `neq`
4343

4444
fn main() {}

src/test/ui/traits/default-method/rustc_must_implement_one_of.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0046]: not all trait items implemented, missing one of: `neq`, `eq`
1+
error[E0046]: not all trait items implemented, missing one of: `eq`, `neq`
22
--> $DIR/rustc_must_implement_one_of.rs:41:1
33
|
44
LL | impl Equal for T3 {}
5-
| ^^^^^^^^^^^^^^^^^ missing one of `neq`, `eq` in implementation
5+
| ^^^^^^^^^^^^^^^^^ missing one of `eq`, `neq` in implementation
66
|
77
note: required because of this annotation
88
--> $DIR/rustc_must_implement_one_of.rs:3:1

0 commit comments

Comments
 (0)