Skip to content

Fix for handling empty code block in doc comments #4895

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

Conversation

davidBar-On
Copy link
Contributor

Suggested fix for issue #4793 for handling empty code block in doc comments. If the doc comments code block includes only empty lines than the output is one line with empty code (///). If no code line was included between the two ///''' then the output also does not include any code line.

A simpler solution could be to add trim() here, i.e to make it _ if self.code_block_buffer.trim().is_empty() =>.... however it seem that changing format_code_block() is more robust.

@davidBar-On
Copy link
Contributor Author

I need help to resolve the build errors, as it may be that there is a conflict between the "master" branch I used to make the changes and the toolchain used to build the PR.

Initially, I pulled the up to date master branch from the rustfmt GitHub. "master" is using "nightly-2021-05-26" by default, but its build failed (without any change) with the same errors I see in the automatic build of the PR for Linux. I tried building with some other toolchains but all failed on some error.

I realized that not as before (some months ago), the master branch I pulled is 1.x and not 2.x. Therefore I pulled branch rustfmt-2.0.0-rc.2 and was able to successfully built it using its default toolchain "nightly-2021-04-26". The changes I made are using this branch.

@calebcartwright
Copy link
Member

I realized that not as before (some months ago), the master branch I pulled is 1.x and not 2.x. Therefore I pulled branch rustfmt-2.0.0-rc.2 and was able to successfully built it using its default toolchain "nightly-2021-04-26". The changes I made are using this branch.

See #4801. Please be sure to get the branches in your fork back in alignment, and target the master branch for all changes.

I need help to resolve the build errors, as it may be that there is a conflict between the "master" branch I used to make the changes and the toolchain used to build the PR

Don't worry about it since we don't need to make changes against that branch anyway. The PR builds always use the latest nightly, not the specified toolchain fail, so it's not surprising that branch is failing against the latest nightly.

@davidBar-On
Copy link
Contributor Author

See #4801. Please be sure to get the branches in your fork back in alignment, and target the master branch for all changes.

Thanks for the response. I am now using the up to date master branch, but I continue getting the following errors on my local machine (using nightly-2021-05-26 as specified in rust-toochain file). This is even when I do cargo make clean before the cargo make build, so I am not able to test my changes before re-submitting the PR:

   --> /home/dbo/.cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/packed_simd_2-0.3.4/src/lib.rs:205:5
    |
205 |     const_fn,
    |     ^^^^^^^^ feature has been removed
    |
    = note: split into finer-grained feature gates

and several of this errors in the llvm.rs file:

error: attributes starting with `rustc` are reserved for use by the `rustc` compiler
  --> /home/dbo/.cargo/registry/src/github.1485827954.workers.dev-1ecc6299db9ec823/packed_simd_2-0.3.4/src/codegen/llvm.rs:43:7
   |
43 |     #[rustc_args_required_const(2)]

@davidBar-On
Copy link
Contributor Author

Found the compilation problem (I used cargo make build instead of cargo build), but closing this PR and will resubmit based on 1.x master branch.

@davidBar-On davidBar-On deleted the issue-4793-handling-empty-code-block-in-comments branch July 15, 2021 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants