-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Rework the entire const trait system #96077
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors rollup=never |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #96473) made this pull request unmergeable. Please resolve the merge conflicts. |
I didn't write a correct |
rebased over master |
Status update on libcore (will dig into it now):
|
For now we could also append the |
ah good idea. I'm currently looking at
This means we'll end up with multiple constness params in the generics list, that seems odd(-ish)? |
this exactly means that we don't want to end up with multiple constness params. The constness param from the parent must not be cloned to the child, and the child has to push the constness param after their generics is built. We can also talk on Zulip if you have more questions :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #95562) made this pull request unmergeable. Please resolve the merge conflicts. |
…rrors Replace `#[default_method_body_is_const]` with `#[const_trait]` pulled out of rust-lang#96077 related issues: rust-lang#67792 and rust-lang#92158 cc `@fee1-dead` This is groundwork to only allowing `impl const Trait` for traits that are marked with `#[const_trait]`. This is necessary to prevent adding a new default method from becoming a breaking change (as it could be a non-const fn).
this makes debugging much easier, as all examples are limited to ui tests
This can help with typeck and fixes ui tests.
…libstd" This reverts commit 7dc2fab2895041f82fabc6525c895cc574b3d044.
We learned a lot in this PR, and I'm rewriting it from scratch with what we learned in #101900 The most notable difference will be that instead of eagerly figuring out what kind of constness parameter is needed, we create inference variables and let the inference engine figure it out where it can. Then, at fallback time, we insert the right kind of constness depending on which scope we're in (which fallback does know, in contrast to all the other sites where we had to thread stuff through in this PR) Thanks @fee1-dead for pushing on this! |
Instead of storing constness in trait predicates and tracking the environment in the ParamEnv, we store it as substitutions to a trait.
r? @ghost
cc @oli-obk
This is a work in progress. I opened this draft such that we can track the progress and have something that can be pointed to when this blocks other PRs.
GenericArgKind::Constness
Enforce that all traits automatically get the generic argument= default to non-const if not presentgenerics_of
is correct#[min_specialization]
#[default_method_body_is_const]
#[const_trait]
~const
super traits