Skip to content

explicitly track inherent const generic args kind - #161929

Open
khyperia wants to merge 1 commit into
rust-lang:mainfrom
khyperia:explicitly-track-inherent-args
Open

explicitly track inherent const generic args kind#161929
khyperia wants to merge 1 commit into
rust-lang:mainfrom
khyperia:explicitly-track-inherent-args

Conversation

@khyperia

@khyperia khyperia commented Aug 28, 2026

Copy link
Copy Markdown
Member

in doing so, and as an exercise of this new code, implement regular (non-type-const) inherent consts in the type system under feature(generic_const_args)

see the new big doc comment in compiler/rustc_type_ir/src/const_kind.rs if you dunno what the heck I'm on about with "self args" vs "impl args" ✨

on a small note, the FIXME on alias_term_kind_from_def_id becomes even more relevant with this PR, ty::AliasConstInherentArgsKind is kinda gross tbh. explicitly not refactoring that in this PR though, to keep scope/the diff manageable.

also, check_args_compatible is very spooky scary in that if you have a ty::Alias, you ought to use check_term_args_compatible, but nothing's stopping you from calling check_args_compatible with the term's DefId. I was unable to think up a clever API that would prevent this misuse.

and finally, I think some of these match statements could theoretically bug! on one form or the other of InherentSelf/InherentImpl, but for now I'm intentionally being a bit conservative here, we can tighten up later.


relevant tracking issue: rust-lang/project-const-generics#98

also very related to feature(inherent_associated_types): #8995 rust-lang/project-const-generics#71

relevant PR that intentionally failed to implement inherent consts in the type system due to not tracking this: #155341

implementing support for a trait with a regular const being refined with an impl that has a directly represented RHS is extremely annoying and difficult without this, the lack of support of which causes #161264 (was working on adding support when I got sidetracked with this PR), see also this zulip thread: #project-const-generics > implementing assoc consts as direct args (is there an issue for this?)

r? @BoxyUwU

@rustbot

rustbot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

changes to the core type system

cc @lcnr

Some changes occurred in match checking

cc @Nadrieril

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

Some changes occurred in rustc_ty_utils::consts.rs

cc @BoxyUwU

HIR ty lowering was modified

cc @fmease

changes to the core type system

cc @lcnr

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2026
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 28, 2026
@rust-log-analyzer

This comment has been minimized.

@khyperia

Copy link
Copy Markdown
Member Author

it is mildly annoying that ./x test tidy does not spellcheck, instead, tidy fails on CI the moment I push :c

(will fix later in a batch update with any PR feedback)

@khyperia
khyperia force-pushed the explicitly-track-inherent-args branch from ebbc13d to 7d5a1c7 Compare August 30, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants