-
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
Cleanup syntax::attr #63146
Cleanup syntax::attr #63146
Conversation
.decode((self, sess)) | ||
.map(|mut attr| { | ||
// Need new unique IDs: old thread-local IDs won't map to new threads. | ||
attr.id = attr::mk_attr_id(); |
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.
This is due to the related change which implement Decodable/Encodable on AttrId
via mk_attr_id
and encode_nil
. I'm not sure if they're actually equivalent, though. It feels like they should be.
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.
Is this the only place where attributes are decoded?
Perhaps incremental could decode them in the old way as an index, or something like that?
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.
AFAICT, this is the only place where attributes are decoded, but I'm not sure how to check (cc @eddyb?)
I'm not sure what you mean by "incremental could decode them in the old way" -- is that referring to a place where it'd be good to check whether we're doing the right decoding?
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.
AFAICT, this is the only place where attributes are decoded
Yeah, looks like that, at least from searching .decode(
and ::decode(
.
I thought about maybe commenting out the impl and trying to build, but looks like that's not feasible because everything including attributes derives RustcEncodable
and RustcDecodable
.
(By incremental I meant some place in incremental compilation that decodes things from cache.)
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
12766c9
to
b8ad424
Compare
Dropped ce34fd858a7a802a376f53789a34f9c844080a24 since I suspect it caused the test failure and is in any case sort of orthogonal to this PR's main thrust. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
/// Returns an outer attribute with the given value and span. | ||
pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute { | ||
pub fn mk_attr_outer(item: MetaItem) -> Attribute { |
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.
inner/outer are identical save for style -- consider a helper function that takes in the style.
Hm, okay, compilation failure looks to not be due to the attr id changes. I'll have to dig in to why that's happening... |
I didn't read the PR yet, but if the errors are about As I recently mentioned elsewhere, Some code using the builder relies, intentionally or not, on span contexts being lost or otherwise not preserved. |
There is no difference in the code/arguments, so go with the shorter name throughout the code.
MetaItem.span was always equivalent
Always the same as the passed MetaItem
fe72016
to
c146344
Compare
d4227f6 fixes the previous error. |
r=me with the question about attribute ID decoding answered |
@bors r+ |
📌 Commit c146344 has been approved by |
…chenkov Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
…chenkov Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
…chenkov Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
…chenkov Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
Rollup of 5 pull requests Successful merges: - #62954 (Fix typo in Delimited::open_tt) - #63146 (Cleanup syntax::attr) - #63218 (rustbuild: RISC-V is no longer an experimental LLVM target) - #63227 (dead_code: Properly inspect fields in struct patterns with type relative paths) - #63229 (A bit of Miri error cleanup) Failed merges: r? @ghost
Remove unused AstBuilder This was removed in a recent rustc PR (rust-lang/rust#63146), replaced with inherent impls.
Mostly removing needless arguments to constructors
r? @petrochenkov