Specific sentence in the docs about auto traits

Hey guys,

I've read the following sentence in the Special types and traits section of the docs about auto traits:

"For generic types (counting the built-in types above as generic over T), if a generic implementation is available, then the compiler does not automatically implement it for types that could use the implementation except that they do not meet the requisite trait bounds."

The sentence somehow confuses me .

Doesn't this simply mean that no auto implementation for a specific type happens if it doesnt't fullfil what stands in the where-clause of the generic implementation!?

Regards
keks

It means if there's a generic implementation that a concrete type would match if there was no where clauses, but doesn't match due to a where clause, then the autotrait is not implemented for the concrete type -- even if it would have been if the generic implementation hadn't existed.

Or in other words the generic implementation should entirely replace the "auto" logic.

Example.

1 Like

Thank you very much for your quick und precise response! That makes it clear to me! :slightly_smiling_face:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.