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

Include trailing commas in wrapped function declarations [RustDoc] #125946

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

Sergi-Ferrez
Copy link
Contributor

@Sergi-Ferrez Sergi-Ferrez commented Jun 4, 2024

Fixes #125901.

@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @notriddle (or someone else) some time within the next two weeks.

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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2024
@rust-log-analyzer

This comment has been minimized.

@notriddle
Copy link
Contributor

This fix looks good, but the tests need updated and the formatting needs fixed.

The format needs fixed by running ./x.py test tidy --bless

The tests can be updated by running ./x.py test tests/rustdoc --bless

write!(f, "(")?;
if let Some(n) = line_wrapping_indent
&& !self.inputs.values.is_empty()
{
write!(f, "\n{}", Indent(n + 4))?;
}

let last_input_index = self.inputs.values.len() - 1;
Copy link
Member

Choose a reason for hiding this comment

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

this crashes in debug builds when self.inputs.values.is_empty() due to negative overflow (it wraps around in release)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry, but i can't understand this comment, last_input_index would be -1 if the inputs vector is empty, but since is only used to compare indexes inside the for loop i can't see the problem.
There is something i'm not noticing?

Copy link
Contributor

Choose a reason for hiding this comment

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

last_input_index is usize, so it doesn’t have negative values.

As an alternative to using negatives, maybe it could use checked_sub?

Copy link
Member

@fmease fmease Jun 4, 2024

Choose a reason for hiding this comment

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

since [it's] only used to compare indexes inside the for loop i can't see the problem

It's not inside a for-loop, therefore it can indeed trigger. Otherwise you'd be right (apart from "-1usize" as mentioned).

@notriddle
Copy link
Contributor

@bors r=notriddle,fmease

@bors
Copy link
Contributor

bors commented Jun 4, 2024

📌 Commit 744dc8c has been approved by notriddle,fmease

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 Jun 4, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 4, 2024
…llaumeGomez

Rollup of 11 pull requests

Successful merges:

 - rust-lang#106186 (Add function `core::iter::chain`)
 - rust-lang#125596 (Convert `proc_macro_back_compat` lint to an unconditional error.)
 - rust-lang#125696 (Explain differences between `{Once,Lazy}{Cell,Lock}` types)
 - rust-lang#125917 (Create `run-make` `env_var` and `env_var_os` helpers)
 - rust-lang#125927 (Ignore `vec_deque_alloc_error::test_shrink_to_unwind` test on non-unwind targets)
 - rust-lang#125930 (feat(opt-dist): new flag `--benchmark-cargo-config`)
 - rust-lang#125932 (Fix typo in the docs of `HashMap::raw_entry_mut`)
 - rust-lang#125933 (Update books)
 - rust-lang#125944 (Update fuchsia maintainers)
 - rust-lang#125946 (Include trailing commas in wrapped function declarations [RustDoc])
 - rust-lang#125973 (Remove `tests/run-make-fulldeps/pretty-expanded`)

Failed merges:

 - rust-lang#125815 (`rustc_parse` top-level cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 532aa9a into rust-lang:master Jun 4, 2024
6 checks passed
@rustbot rustbot added this to the 1.80.0 milestone Jun 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 4, 2024
Rollup merge of rust-lang#125946 - Sergi-Ferrez:master, r=notriddle,fmease

Include trailing commas in wrapped function declarations [RustDoc]

Fixes rust-lang#125901.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Include trailing commas in wrapped function declarations [RustDoc]
6 participants