Closed
Description
On 1.45.0-nightly (a74d1862d 2020-05-14)
, this trait definition/impl works fine:
trait Bounded { const MAX: Self; }
impl Bounded for u32 {
const MAX: Self = u32::MAX;
}
Here, u32::MAX
resolves unambiguously to the associated const on u32
.
If I merely define a trait alias that uses Bounded
:
#![feature(trait_alias)]
trait Bounded { const MAX: Self; }
impl Bounded for u32 {
const MAX: Self = u32::MAX;
}
trait Num = Bounded + Copy;
I get this error:
error[E0034]: multiple applicable items in scope
--> src/lib.rs:6:28
|
6 | const MAX: Self = u32::MAX;
| -----^^^
| | |
| | multiple `MAX` found
| help: disambiguate the associated constant for candidate #1: `Bounded::MAX`
|
note: candidate #1 is defined in an impl of the trait `Bounded` for the type `u32`
--> src/lib.rs:6:5
|
6 | const MAX: Self = u32::MAX;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: candidate #2 is defined in an impl for the type `u32`