Skip to content

While this might be correct for all usecases, this is not safe for 100% of host target scenarios. Quoting the docs: #237

@vireshk

Description

@vireshk
          While this might be correct for all usecases, this is not safe for 100% of host target scenarios. Quoting the docs:

The size of this primitive is how many bytes it takes to reference any location in memory. For example, on a 32 bit target, this is 4 bytes and on a 64 bit target, this is 8 bytes.

What it is is undefined. That's why there's TryFrom which the compiler should remove if the target's error is infallible.

                usize::try_from(region.len()).expect("usize primitive too small or something like that"),

Originally posted by @epilys in #235 (comment)

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