Skip to content

Document that programmer can't use generic NonZero #142966

@ijackson

Description

@ijackson

Location

std::num::NonZero in the standard library rustdocs

Summary

Since #120257, we have had, on stable, NonZero<T>. But really it's NonZero<T: unnameable> (because ZeroablePrimitive is perma-unstrable).

The effect is that the programmer can talk about NonZero<SomeConcreteType>, but unlike most other generics in the standard library, they can't impl<T:...> MyTrait for NonZero<T>. (That's point 5 in "Other surface area not being proposed for stabilization right now" in #120257 (comment).)

It would be good if this were explicitly mentioned in the docs for NonZero. That might save people setting out to try to do the impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions