Skip to content

Size constraint traits implemented inconsistently across target platforms #12

@marshray

Description

@marshray

For example, AtLeast64 is implemented by usize but only if cfg(target_pointer_width = "64"). permalink This means that if I write code like <T: AtLeast64> it's likely to work fine on my box but then fail to compile on other target platforms.

A concrete example of this causing a problem is that the docs state that usize impl Is64 unequivocally, even though this is not always true.

People building software for 32- and 16-bit platforms are probably used to disappointment by now, but I believe that one of the reasons for Rust's success is that its developers tended to err on the side of consistency. For example, Range<u64> does not support .len(), even when targeting 64-bit platforms. playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions