Skip to content
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

Convert newtype_index to a proc macro #93878

Merged
merged 4 commits into from
Feb 25, 2022
Merged

Conversation

Aaron1011
Copy link
Member

The macro_rules! implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain #[derive]s)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 10, 2022
@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 10, 2022
@rust-log-analyzer

This comment has been minimized.

///
/// - The `From` impls are the preferred way. So you can do
/// `S::from(v)` with a `usize` or `u32`. And you can convert back
/// to an integer with `u32::from(s)`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this comment is pre-existing, but while we're here: is this advice correct? I personally prefer S::new(v) and s.index(), and I feel like I've seen those forms more often.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure - I think this could be dealt with in a follow-up issue, since it's just a style reccomendation.

@jackh726 jackh726 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 Feb 12, 2022
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

This is a great simplification to the expansion!

compiler/rustc_macros/src/newtype.rs Outdated Show resolved Hide resolved
compiler/rustc_macros/src/newtype.rs Outdated Show resolved Hide resolved
compiler/rustc_macros/src/newtype.rs Outdated Show resolved Hide resolved
compiler/rustc_macros/src/newtype.rs Outdated Show resolved Hide resolved
@Aaron1011
Copy link
Member Author

@cjgillot I've addressed your comments

@cjgillot
Copy link
Contributor

r? @cjgillot
@bors r+

@bors
Copy link
Contributor

bors commented Feb 19, 2022

📌 Commit cb2e4ee has been approved by cjgillot

@rust-highfive rust-highfive assigned cjgillot and unassigned jackh726 Feb 19, 2022
@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 19, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 19, 2022
Convert `newtype_index` to a proc macro

The `macro_rules!` implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain `#[derive]`s)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 19, 2022
Convert `newtype_index` to a proc macro

The `macro_rules!` implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain `#[derive]`s)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 19, 2022
Convert `newtype_index` to a proc macro

The `macro_rules!` implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain `#[derive]`s)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 19, 2022
Convert `newtype_index` to a proc macro

The `macro_rules!` implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain `#[derive]`s)
@matthiaskrgr
Copy link
Member

might be reponsible for these ci failures: #94167 (comment)
@bors rollup=never

@bors
Copy link
Contributor

bors commented Feb 20, 2022

⌛ Testing commit cb2e4ee with merge 0525b7fa548f72c821ac5997db8da88ca7b685e9...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 20, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 20, 2022
@bors
Copy link
Contributor

bors commented Feb 23, 2022

☔ The latest upstream changes (presumably #93984) made this pull request unmergeable. Please resolve the merge conflicts.

The `macro_rules!` implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain `#[derive]`s)
These links never worked, but the lint was suppressed due to the fact
that the span was pointing into the macro. With the new macro
implementation, the span now points directly to the doc comment in the
macro invocation, so it's no longer suppressed.
@Aaron1011
Copy link
Member Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Feb 24, 2022

📌 Commit 7b7b0f1 has been approved by cjgillot

@bors bors 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 Feb 24, 2022
@bors
Copy link
Contributor

bors commented Feb 25, 2022

⌛ Testing commit 7b7b0f1 with merge f6a7993...

@bors
Copy link
Contributor

bors commented Feb 25, 2022

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing f6a7993 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 25, 2022
@bors bors merged commit f6a7993 into rust-lang:master Feb 25, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 25, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f6a7993): comparison url.

Summary: This benchmark run shows 4 relevant improvements 🎉 to instruction counts.

  • Arithmetic mean of relevant improvements: -0.8%
  • Largest improvement in instruction counts: -0.8% on incr-unchanged builds of externs debug

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@Mark-Simulacrum
Copy link
Member

Likely just noise -- externs is currently a little noisy (and we haven't absorbed that noisiness into our statistical estimation yet). Seems to be due to #93839, which makes me suspect this is related to PGO or inlining decisions of some kind. #94373 might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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.