Skip to content

Error wrongly trying to assign assoc const to primitive speaks of methods #79760

Closed
@jnqnfe

Description

@jnqnfe

Imperfection in error output.

I just tried adding an associated constant to a type alias of a primitive (to see if it was allowed or whether I'd need a wrapper) and noticed an imperfection in the error output in that it says "help: consider using a trait to implement these methods" pointing to the impl block that actually just contains an constant.

error[E0390]: only a single inherent implementation marked with `#[lang = "u64"]` is allowed for the `u64` primitive
  --> pulse-binding/src/channelmap.rs:50:1
   |
50 | / impl PositionMask {
51 | |     pub const POSITION_MASK_ALL: PositionMask = 0xffffffffffffffffu64;
52 | | }
   | |_^
   |
help: consider using a trait to implement these methods
  --> pulse-binding/src/channelmap.rs:50:1
   |
50 | / impl PositionMask {
51 | |     pub const POSITION_MASK_ALL: PositionMask = 0xffffffffffffffffu64;
52 | | }
   | |_^

Metadata

Metadata

Assignees

Labels

A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`A-trait-systemArea: Trait systemC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions