You shouldn't normally worry about special-casing Never
. If a generic method requires values of a certain associated type, and that associated type is Never
, then the method is already unavailable because it is impossible to call in the first place. Negative constraints become awkward when you want to invoke them from other generic contexts, because you would have to propagate the != Never
constraint onto all of the generic arguments that eventually call into the context with the constraint, or else you wouldn't be able to call into it. It's generally better to design your code so that the right thing falls out of the normal type system rules for Never
, Void
, or other common types; oftentimes there's no fundamental need for these to be special cases to begin with.
5 Likes