You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
min_generic_const_args makes {u,i}*::{MIN, MAX} ambiguous #158506
Instead, this happened: fails to compile. (but compiles fine without mgca enabled)
error[E0223]: ambiguous associated constant
--> src/lib.rs:5:28
|
5 | const _:() = TAKES_U8::<{ u8::MAX}>;
| ^^^^^^^
|
help: you are looking for the module in `std`, not the primitive type
|
5 | const _:() = TAKES_U8::<{ std::u8::MAX}>;
| +++++
It also compiles fine if you add the const keyword like this:
const _:() = TAKES_U8::<const{ u8::MAX}>;
Meta
tested on playground, 1.98.0-nightly (2026-06-26 ce9954c0cfc4bf26b82a)
changed the title [-]`min_generic_const_args` makes `{u,i}*::{MIN, MAX}` ambigous[/-][+]`min_generic_const_args` makes `{u,i}*::{MIN, MAX}` ambiguous[/+]on Jun 28, 2026
seems the original issue was resolved by #158617
however, the underlying direct-representation issue remains: using direct_const_arg!(u8::MAX) or enabling macroless_generic_const_args still produces E0223 because HIR type lowering only probes inherent associated items for ADTs.
makes sense! seems this is a feature(inherent_associated_types) issue then, feature(generic_const_args) uses that for inherent consts (tbh it should maybe be called feature(inherent_associated_terms), haha). For example:
error[E0658]: inherent associated types are unstable
--> src/main.rs:9:39
|
9 | type C = [(); core::direct_const_arg!(S::MAX)];
| ^^^^^^
|
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
it's just that when you do u8::MAX, inherent_associated_types is so borked/unimplemented that we don't even get around to being able to emit a feature gate for it.
Activity
[-]`min_generic_const_args` makes `{u,i}*::{MIN, MAX}` ambigous[/-][+]`min_generic_const_args` makes `{u,i}*::{MIN, MAX}` ambiguous[/+]peter-lyons-kehl commentedon Jul 14, 2026
Another example:
with
rustc 1.97.0 (2d8144b78 2026-07-07)Feature tracking issue: min_generic_const_args.
chenyukang commentedon Aug 31, 2026
@khyperia
seems the original issue was resolved by #158617
however, the underlying direct-representation issue remains: using
direct_const_arg!(u8::MAX)or enablingmacroless_generic_const_argsstill produces E0223 because HIR type lowering only probes inherent associated items for ADTs.https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1e454a3a903bc8f77a779caf651c4740
khyperia commentedon Aug 31, 2026
makes sense! seems this is a
feature(inherent_associated_types)issue then,feature(generic_const_args)uses that for inherent consts (tbh it should maybe be calledfeature(inherent_associated_terms), haha). For example:produces
it's just that when you do
u8::MAX,inherent_associated_typesis so borked/unimplemented that we don't even get around to being able to emit a feature gate for it.