explicitly track inherent const generic args kind - #161929
Open
khyperia wants to merge 1 commit into
Open
Conversation
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 cc @BoxyUwU HIR ty lowering was modified cc @fmease changes to the core type system cc @lcnr |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Member
Author
|
it is mildly annoying that (will fix later in a batch update with any PR feedback) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rsif 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_idbecomes even more relevant with this PR,ty::AliasConstInherentArgsKindis kinda gross tbh. explicitly not refactoring that in this PR though, to keep scope/the diff manageable.also,
check_args_compatibleis very spooky scary in that if you have aty::Alias, you ought to usecheck_term_args_compatible, but nothing's stopping you from callingcheck_args_compatiblewith 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#71relevant 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