Skip to content

Add impl_tag! macro to implement Tag for tagged pointer easily - #110615

Merged
bors merged 6 commits into
rust-lang:masterfrom
WaffleLapkin:impl_tag
Apr 25, 2023
Merged

Add impl_tag! macro to implement Tag for tagged pointer easily#110615
bors merged 6 commits into
rust-lang:masterfrom
WaffleLapkin:impl_tag

Conversation

@WaffleLapkin

Copy link
Copy Markdown
Member

r? @Nilstrieb

This should also lifts the need to think about safety from the callers (impl_tag! is robust (ish, see the macro issue)) and removes the possibility of making a "weird" Tag impl.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 20, 2023
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment threadcompiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs Outdated
Comment threadcompiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs Outdated

@NoratriebNoratrieb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool. I didn't spot any issues except two nits, although I may want to take a second look when you've fixed those.

Comment threadcompiler/rustc_data_structures/src/tagged_ptr.rs Outdated
@rust-log-analyzer

This comment has been minimized.

(
impl Tag for $Self:ty;
$(
$($path:ident)::* $( { $( $fields:tt )* })? <=> $tag:literal,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is customization according to $tag useful?
If not, you can use ${index()} to generate it automatically, like rustc_metadata::rmeta::table does.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the answer is "it could, but probably isn't". I'll work on it next week.

@WaffleLapkinWaffleLapkin added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 21, 2023
@WaffleLapkin

Copy link
Copy Markdown
MemberAuthor

@rustbot ready

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 24, 2023
@cjgillot

Copy link
Copy Markdown
Contributor

Great!
@bors r+

@bors

bors commented Apr 25, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit bec7ce4 has been approved by cjgillot

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2023
…iaskrgr
Rollup of 6 pull requests
Successful merges:
- rust-lang#110556 (Switch to `EarlyBinder` for `explicit_item_bounds`)
- rust-lang#110615 (Add `impl_tag!` macro to implement `Tag` for tagged pointer easily)
- rust-lang#110649 (Fix no_global_oom_handling build)
- rust-lang#110671 (Consider polarity in new solver)
- rust-lang#110783 (Fix ICE on --print=... i/o errors)
- rust-lang#110796 (Updating Wake example to use new 'pin!' macro)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 8d00a8d into rust-lang:masterApr 25, 2023
@rustbotrustbot added this to the 1.71.0 milestone Apr 25, 2023
@WaffleLapkin
WaffleLapkin deleted the impl_tag branch May 7, 2023 17:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@WaffleLapkin@rust-log-analyzer@cjgillot@bors@klensy@Noratrieb@rustbot