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

Split some functions with many arguments into builder pattern functions #114054

Merged
merged 5 commits into from Jul 26, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 25, 2023

r? @estebank

This doesn't resolve all of the ones in rustc, mostly because I need to do other cleanups in order to be able to use some builder derives from crates.io

Works around #90672 by making x test rustfmt --bless format itself instead of testing that it is formatted

@rustbot
Copy link
Collaborator

rustbot commented Jul 25, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 25, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jul 25, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 25, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jul 25, 2023

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 25, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 25, 2023
@bors
Copy link
Contributor

bors commented Jul 25, 2023

⌛ Trying commit 8d7b358a11ca0ccdd1fb8c184f3f3a8dec75ea8f with merge 9440ad6c48d595f71c9f4ac67f3ed9f3bba31321...

@rust-log-analyzer

This comment has been minimized.

let handler = Handler::with_emitter(true, None, Box::new(emitter), None);
let emitter =
EmitterWriter::new(Box::new(Shared { data: output.clone() }), fallback_bundle, false)
.sm(Some(source_map.clone()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Surprised that .sm(Some(source_map)) is needed here, instead of .sm(source_map).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The macro supports this, but most of the callers actually provide an Option, so this is a tradeoff unless we wanna go generic

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, r=me after you're done with timer

pub struct EmitterWriter {
#[setters(skip)]
dst: Destination,
sm: Option<Lrc<SourceMap>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Re: my other comment, we can use #[setters(strip_option)] here.

@bors
Copy link
Contributor

bors commented Jul 25, 2023

☀️ Try build successful - checks-actions
Build commit: 9440ad6c48d595f71c9f4ac67f3ed9f3bba31321 (9440ad6c48d595f71c9f4ac67f3ed9f3bba31321)

@rust-timer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 25, 2023

ugh. in-tree rustfmt requires formatting, but doesn't get formatted with x fmt

@calebcartwright
Copy link
Member

ugh. in-tree rustfmt requires formatting, but doesn't get formatted with x fmt

yep, it's a consequence that's part of the tradeoffs of moving tools (including rustfmt) to subtrees, and this repo continuing the model of being pinned to an older version of rustfmt vs. using in-tree rustfmt.

more discussion in #90672

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9440ad6c48d595f71c9f4ac67f3ed9f3bba31321): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.7%, -0.7%] 1
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 1
All ❌✅ (primary) -0.7% [-0.7%, -0.7%] 1

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.1% [-2.1%, -2.1%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 651.438s -> 651.998s (0.09%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 26, 2023
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 26, 2023

@bors r=estebank

@bors
Copy link
Contributor

bors commented Jul 26, 2023

📌 Commit 841f8dc has been approved by estebank

It is now in the queue for this repository.

@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 Jul 26, 2023
@bors
Copy link
Contributor

bors commented Jul 26, 2023

⌛ Testing commit 841f8dc with merge 52bdc37...

@bors
Copy link
Contributor

bors commented Jul 26, 2023

☀️ Test successful - checks-actions
Approved by: estebank
Pushing 52bdc37 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 26, 2023
@bors bors merged commit 52bdc37 into rust-lang:master Jul 26, 2023
12 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Jul 26, 2023
@oli-obk oli-obk deleted the cleanups branch July 26, 2023 13:09
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (52bdc37): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
8.0% [7.0%, 9.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 652.439s -> 650.097s (-0.36%)

@@ -430,6 +430,10 @@ impl Step for Rustfmt {
&[],
);

if builder.config.cmd.bless() {
cargo.env("BLESS", "1");
Copy link
Member

Choose a reason for hiding this comment

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

@oli-obk - This seems reasonable to me, though I'd like to change the var name to be a little more explicit (perhaps something like RUSTC_BLESS?) so that it's somewhat more explicit especially when working with rustfmt out of tree.

Wanted to make sure you didn't have any objections or alternative naming suggestions before I opened a PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is currently being worked on in #113298

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 31, 2023
Split some functions with many arguments into builder pattern functions

r? `@estebank`

This doesn't resolve all of the ones in rustc, mostly because I need to do other cleanups in order to be able to use some builder derives from crates.io

Works around rust-lang#90672 by making `x test rustfmt --bless` format itself instead of testing that it is formatted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants