-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Combine HasAttrs and HasTokens into AstLike #82448
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
cc @rust-lang/wg-rustfmt : This PR will break |
This comment has been minimized.
This comment has been minimized.
57cf192
to
f221432
Compare
|
I don't like the name, but I'm not sure how to name this better. |
Yeah, I wish I could come up with a better name. The fact that it's implemented on |
That's true. However, this PR combines two traits into one, so I would say that it's moving us closer towards an eventual 'AST unification'. |
From these three |
I considered doing this. However, this would require us to implement |
f221432
to
f52ea52
Compare
I've moved |
One more question - why is it necessary to implement I don't think these extra impls add much convenience, but they indeed move the trait further from representing an "AST node". |
We need the impl for The impl for |
f52ea52
to
de0a26e
Compare
@bors r+ |
📌 Commit de0a26e378a980633481b72dd25e2fc307ac1e73 has been approved by |
Rollup of 14 pull requests Successful merges: - rust-lang#81794 (update tracking issue for `relaxed_struct_unsize`) - rust-lang#82057 (Replace const_cstr with cstr crate) - rust-lang#82370 (Improve anonymous lifetime note to indicate the target span) - rust-lang#82394 (:arrow_up: rust-analyzer) - rust-lang#82396 (Add Future trait for doc_spotlight feature doc) - rust-lang#82404 (Test hexagon-enum only when llvm target is present) - rust-lang#82419 (expand: Preserve order of inert attributes during expansion) - rust-lang#82420 (Enable API documentation for `std::os::wasi`.) - rust-lang#82421 (Add a `size()` function to WASI's `MetadataExt`.) - rust-lang#82442 (Skip emitting closure diagnostic when closure_kind_origins has no entry) - rust-lang#82473 (Use libc::accept4 on Android instead of raw syscall.) - rust-lang#82482 (Use small hash set in `mir_inliner_callees`) - rust-lang#82490 (Update cargo) - rust-lang#82494 (Substitute erased lifetimes on bad placeholder type) Failed merges: - rust-lang#82448 (Combine HasAttrs and HasTokens into AstLike) r? `@ghost` `@rustbot` modify labels: rollup
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
When token-based attribute handling is implemeneted in rust-lang#80689, we will need to access tokens from `HasAttrs` (to perform cfg-stripping), and we will to access attributes from `HasTokens` (to construct a `PreexpTokenStream`). This PR merges the `HasAttrs` and `HasTokens` traits into a new `AstLike` trait. The previous `HasAttrs` impls from `Vec<Attribute>` and `AttrVec` are removed - they aren't attribute targets, so the impls never really made sense.
de0a26e
to
fb5fec0
Compare
@bors r=petrochenkov |
📌 Commit fb5fec0 has been approved by |
☀️ Test successful - checks-actions |
[Coverage][MCDC] Adapt mcdc to llvm 19 Related issue: rust-lang#126672 Also finish task 4 at rust-lang#124144 [llvm rust-lang#82448](llvm/llvm-project#82448) has introduced some break changes into mcdc, causing incompatibility between llvm 18 and 19. This draft adapts to that change and gives up supporting for llvm-18.
[Coverage][MCDC] Adapt mcdc to llvm 19 Related issue: rust-lang#126672 Also finish task 4 at rust-lang#124144 [llvm rust-lang#82448](llvm/llvm-project#82448) has introduced some break changes into mcdc, causing incompatibility between llvm 18 and 19. This draft adapts to that change and gives up supporting for llvm-18.
When token-based attribute handling is implemeneted in #80689,
we will need to access tokens from
HasAttrs
(to performcfg-stripping), and we will to access attributes from
HasTokens
(toconstruct a
PreexpTokenStream
).This PR merges the
HasAttrs
andHasTokens
traits into a newAstLike
trait. The previousHasAttrs
impls fromVec<Attribute>
andAttrVec
are removed - they aren't attribute targets, so the impls never really
made sense.