6

Split some functions with many arguments into builder pattern functions by oli-o...

 9 months ago
source link: https://github.com/rust-lang/rust/pull/114054
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

Merged

Conversation

Contributor

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

Collaborator

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

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

Collaborator

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

This comment has been minimized.

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

Collaborator

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.

Contributor

Author

This comment has been minimized.

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

Jul 25, 2023

Contributor

hourglass Trying commit 8d7b358 with merge 9440ad6...

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()));

Contributor

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

Contributor

Author

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

estebank reacted with thumbs up emoji

Contributor

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

pub struct EmitterWriter {

#[setters(skip)]

dst: Destination,

sm: Option<Lrc<SourceMap>>,

Contributor

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

Contributor

sunny Try build successful - checks-actions
Build commit: 9440ad6 (9440ad6c48d595f71c9f4ac67f3ed9f3bba31321)

This comment has been minimized.

This comment has been minimized.

Contributor

Author

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

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

Collaborator

Finished benchmarking commit (9440ad6): comparison URL.

Overall result: white_check_mark 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 x
(primary)
- - 0
Regressions x
(secondary)
- - 0
Improvements white_check_mark
(primary)
-0.7% [-0.7%, -0.7%] 1
Improvements white_check_mark
(secondary)
-0.5% [-0.5%, -0.5%] 1
All xwhite_check_mark (primary) -0.7% [-0.7%, -0.7%] 1

Max RSS (memory usage)

Results

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

removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

Jul 26, 2023

Contributor

Author

@bors r=estebank

Contributor

pushpin Commit 841f8dc has been approved by estebank

It is now in the queue for this repository.

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

Contributor

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

Contributor

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

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

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");

@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?

Contributor

Author

This is currently being worked on in #113298

calebcartwright reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

estebank

estebank left review comments

calebcartwright

calebcartwright left review comments
Assignees

estebank

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

Milestone

1.73.0

Development

Successfully merging this pull request may close these issues.

None yet

7 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK