-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Conversation
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 (
|
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:
The following commits are merge commits: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This fix looks good, but the tests need updated and the formatting needs fixed. The format needs fixed by running The tests can be updated by running |
src/librustdoc/html/format.rs
Outdated
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; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
@bors r=notriddle,fmease |
…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
Rollup merge of rust-lang#125946 - Sergi-Ferrez:master, r=notriddle,fmease Include trailing commas in wrapped function declarations [RustDoc] Fixes rust-lang#125901.
Fixes #125901.