-
Notifications
You must be signed in to change notification settings - Fork 2
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
attributes: implement checking and handling of attributes #930
Conversation
This file contains 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
feds01
added
core
Relating to the core internals of the compiler.
language
Issues that are language/compiler wide
landmark
labels
Aug 25, 2023
The `AttrTyMap` is used to store metadata about builtin compiler attributes. This information is used to check that the attributes are used correctly.
Additionally, introduce a `AstNodeId::null()` which is used to represent a null-node which is never taken up by any other node, and is used to represent the absence of a node.
`HasNodeId` is a helper trait which specifies that a certain type has an associated node-id on it, and hence `node_id()` can be called to retrieve it. This is useful for things like `TermId`, `FnDefId`, `Pat`, etc. With this change, handling of `#run`, `#dump_tir`, `#pure`, `#entry_point` have been re-implemented. Additionally, lots of code cleanup around other places because of this change.
This patch reworks the way `repr` attributes are checked by introducing a `hash-attrs` specific `ReprAttr` representation which is parsed from a `Attr`. During parsing, various semantic checks are perfomed, and can be emitted to the `AttrChecker`. Additionally, this logic is re-used in `hash-lower` to actually apply the attribute onto `Adt`s that specify a representation attribute. Furthemore, since `repr` supports `u8`, `u16`, ... as well, this meant that `discriminant` option on `AdtRepresentation` is now also supported.
They aren't used anywhere, and they slow down the testing process. We can re-enable them later if we want to.
kontheocharis
previously approved these changes
Aug 31, 2023
kontheocharis
approved these changes
Aug 31, 2023
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.
AttrTyMap
hash-expand
From<...>
for implementing conversion to Lit kindsattr_store()
for attributes and addInstance::has_attr
CompilerStageKind::DeSugar
toCompilerStageKind::Expand
AstNodeId
s to items, specifically sequences of idsParamError
diagnostic messagesprimitives.rs
intohash-tir
from `hash-intrinsicsHasNodeId
and re-implement directive handlingHasTarget
trait to query currenttarget()
from any implementor#layout_of
repr
and adddiscriminant
option#dump_ir
closes #924
closes #925
closes #926
closes #927
closes #896
closes #915