-
Notifications
You must be signed in to change notification settings - Fork 14k
mgca: Add ConstArg representation for const items #139558
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
fa42f86 to
6054bd5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ac73a4a to
4f6c9ab
Compare
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.
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #141343) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@oli-obk I've assigned you to this PR alongside me because I'd definitely want you to review it before it lands since its so CTFE involved 🤔 I don't think it needs reviewing rn though, things are so up in the air and we're not bootstrapping yet :3 |
|
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the CTFE machinery Some changes occurred in compiler/rustc_passes/src/check_attr.rs HIR ty lowering was modified cc @fmease Some changes occurred to constck cc @fee1-dead This PR changes a file inside |
50bca8f to
1e02824
Compare
|
(rustfmt changes seem to have been accidental and have since been removed) |
54f75ca to
f53cba0
Compare
This comment has been minimized.
This comment has been minimized.
f53cba0 to
6fc668a
Compare
This comment has been minimized.
This comment has been minimized.
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 with rustdoc and some cleanups and docs
747f4ae to
4b9afa2
Compare
When mgca is enabled, const rhs's that are paths may have false negatives with the lints in non_copy_const.rs. But these should probably be using the trait solver anyway, and it only happens under mgca.
Also removed a test that was literally a duplicate of the one I kept.
1897527 to
8d22925
Compare
|
r=me with the oli-review commit |
tracking issue: #132980
fixes #131046
fixes #134641
As part of implementing
min_generic_const_args, we need to distinguish const items that can be used in the type system, such as in associated const equality projections, from const items containing arbitrary const code, which must be kept out of the type system. Specifically, all "type consts" must be either concrete (no generics) or generic with a trivial expression likeNor a path to another type const item.To syntactically distinguish these cases, we require, for now at least, that users annotate all type consts with the
#[type_const]attribute. Then, we validate that the const's right-hand side is indeed eligible to be a type const and represent it differently in the HIR.We accomplish this representation using a new
ConstItemRhsenum in the HIR, and a similar but simpler enum in the AST. When#[type_const]is not applied to a const (e.g. on stable), we represent const item right-hand sides (rhs's) as HIR bodies, like before. However, when the attribute is applied, we instead lower to ahir::ConstArg. This syntactically distinguishes between trivial const args (paths) and arbitrary expressions, which are represented usingAnonConsts. Then ingenerics_of, we can take advantage of the existing machinery to bar theAnonConstrhs's from using parent generics.