-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Constify trait aliases #144291
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
Constify trait aliases #144291
Conversation
|
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt HIR ty lowering was modified cc @fmease Changes to the size of AST and/or HIR nodes. cc @nnethercote Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
| static_assert_size!(Item, 144); | ||
| static_assert_size!(ItemKind, 80); | ||
| static_assert_size!(Item, 136); | ||
| static_assert_size!(ItemKind, 72); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
Clippy changes are approved. |
|
☔ The latest upstream changes (presumably #143897) made this pull request unmergeable. Please resolve the merge conflicts. |
cb809b6 to
7508ac9
Compare
|
☔ The latest upstream changes (presumably #143843) made this pull request unmergeable. Please resolve the merge conflicts. |
7508ac9 to
5d3eb69
Compare
|
☔ The latest upstream changes (presumably #143884) made this pull request unmergeable. Please resolve the merge conflicts. |
|
r? fee1-dead or re-roll perhaps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick review because i didn't get enough time
Didn't look at the solver parts yet, will do later
|
The commits should probably be squashed. |
Hmm... I split them on purpose to only make atomic testable changes |
5d3eb69 to
4591683
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4591683 to
156e480
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after nit
| ecx.add_goals(GoalSource::Misc, where_clause_bounds); | ||
|
|
||
| let const_conditions = cx | ||
| .const_conditions(goal.predicate.def_id().into()) | ||
| .iter_instantiated(cx, goal.predicate.trait_ref.args) | ||
| .map(|bound_trait_ref| { | ||
| goal.with( | ||
| cx, | ||
| bound_trait_ref.to_host_effect_clause(cx, goal.predicate.constness), | ||
| ) | ||
| }); | ||
| // While you could think of trait aliases to have a single builtin impl | ||
| // which uses its implied trait bounds as where-clauses, using | ||
| // `GoalSource::ImplWhereClause` here would be incorrect, as we also | ||
| // impl them, which means we're "stepping out of the impl constructor" | ||
| // again. To handle this, we treat these cycles as ambiguous for now. | ||
| ecx.add_goals(GoalSource::Misc, const_conditions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment really applies to both of those lines, so
| ecx.add_goals(GoalSource::Misc, where_clause_bounds); | |
| let const_conditions = cx | |
| .const_conditions(goal.predicate.def_id().into()) | |
| .iter_instantiated(cx, goal.predicate.trait_ref.args) | |
| .map(|bound_trait_ref| { | |
| goal.with( | |
| cx, | |
| bound_trait_ref.to_host_effect_clause(cx, goal.predicate.constness), | |
| ) | |
| }); | |
| // While you could think of trait aliases to have a single builtin impl | |
| // which uses its implied trait bounds as where-clauses, using | |
| // `GoalSource::ImplWhereClause` here would be incorrect, as we also | |
| // impl them, which means we're "stepping out of the impl constructor" | |
| // again. To handle this, we treat these cycles as ambiguous for now. | |
| ecx.add_goals(GoalSource::Misc, const_conditions); | |
| let const_conditions = cx | |
| .const_conditions(goal.predicate.def_id().into()) | |
| .iter_instantiated(cx, goal.predicate.trait_ref.args) | |
| .map(|bound_trait_ref| { | |
| goal.with( | |
| cx, | |
| bound_trait_ref.to_host_effect_clause(cx, goal.predicate.constness), | |
| ) | |
| }); | |
| // While you could think of trait aliases to have a single builtin impl | |
| // which uses its implied trait bounds as where-clauses, using | |
| // `GoalSource::ImplWhereClause` here would be incorrect, as we also | |
| // impl them, which means we're "stepping out of the impl constructor" | |
| // again. To handle this, we treat these cycles as ambiguous for now. | |
| ecx.add_goals(GoalSource::Misc, where_clause_bounds); | |
| ecx.add_goals(GoalSource::Misc, const_conditions); |
|
☔ The latest upstream changes (presumably #147957) made this pull request unmergeable. Please resolve the merge conflicts. |
82973ed to
906e528
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
906e528 to
ebb249d
Compare
|
@bors r=fee1-dead |
…dead Constify trait aliases Allow `const trait Foo = Bar + [const] Baz;` trait alias declarations. Their rules are the same as with super traits of const traits. So `[const] Baz` or `const Baz` is only required for `[const] Foo` or `const Foo` bounds respectively. tracking issue rust-lang#41517 (part of the general trait alias feature gate, but I can split it out into a separate const trait alias feature gate. I just assumed that const traits would stabilize before trait aliases, and we'd want to stabilize trait aliases together with const trait aliases at the same time) r? `@compiler-errors` `@fee1-dead`
Rollup of 4 pull requests Successful merges: - #144291 (Constify trait aliases) - #147633 (Add new `--bypass-ignore-backends` option) - #148262 (Fix types being marked as dead when they are inferred generic arguments) - #148268 (rustdoc: fix `--emit=dep-info` on scraped examples) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 4 pull requests Successful merges: - #144291 (Constify trait aliases) - #147633 (Add new `--bypass-ignore-backends` option) - #148252 (Improve diagnose for unconditional panic when resource limit) - #148262 (Fix types being marked as dead when they are inferred generic arguments) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #144291 - oli-obk:const_trait_alias, r=fee1-dead Constify trait aliases Allow `const trait Foo = Bar + [const] Baz;` trait alias declarations. Their rules are the same as with super traits of const traits. So `[const] Baz` or `const Baz` is only required for `[const] Foo` or `const Foo` bounds respectively. tracking issue #41517 (part of the general trait alias feature gate, but I can split it out into a separate const trait alias feature gate. I just assumed that const traits would stabilize before trait aliases, and we'd want to stabilize trait aliases together with const trait aliases at the same time) r? ``@compiler-errors`` ``@fee1-dead``
Allow
const trait Foo = Bar + [const] Baz;trait alias declarations. Their rules are the same as with super traits of const traits. So[const] Bazorconst Bazis only required for[const] Fooorconst Foobounds respectively.tracking issue #41517 (part of the general trait alias feature gate, but I can split it out into a separate const trait alias feature gate. I just assumed that const traits would stabilize before trait aliases, and we'd want to stabilize trait aliases together with const trait aliases at the same time)
r? @compiler-errors @fee1-dead