From 94c9d0c90f6bb6f7d8fdc6e326e148e7b5bb30cf Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 30 Jul 2023 12:12:26 +0000 Subject: [PATCH] Make non-zero check more obvious --- compiler/rustc_trait_selection/src/traits/object_safety.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index 5823b4508d9..1dbe3039107 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -464,7 +464,7 @@ fn virtual_call_violation_for_method<'tcx>( // We can't monomorphize things like `fn foo(...)`. let own_counts = tcx.generics_of(method.def_id).own_counts(); - if own_counts.types + own_counts.consts != 0 { + if own_counts.types > 0 || own_counts.consts > 0 { return Some(MethodViolationCode::Generic); }