Skip to content

ml-kem/module-lattice: integer_extend_truncate warnings #308

@tarcieri

Description

@tarcieri

Just started getting these warnings:

warning: an associated function with this name may be added to the standard library in the future
   --> ml-kem/src/algebra.rs:123:27
    |
123 |         let N = start_n + u8::truncate(i);
    |                           ^^^^^^^^^^^^
    |
    = help: call with fully qualified syntax `truncate(...)` to keep using the current method
    = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
    = note: `#[warn(unstable_name_collisions)]` (part of `#[warn(future_incompatible)]`) on by default
help: add `#![feature(integer_extend_truncate)]` to the crate attributes to enable `core::num::<impl u8>::truncate`
   --> ml-kem/src/lib.rs:45:1
    |
 45 + #![feature(integer_extend_truncate)]

It seems we should at least switch to using Truncate::truncate as the invocation syntax, but also this seems like a case where we should perhaps consider a different API entirely, or at least a different method name, so as not to clash with the standard library.

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