refactor(embedded): Switch to syn for parsing doc comments#12258
Merged
bors merged 1 commit intorust-lang:masterfrom Jun 17, 2023
Merged
refactor(embedded): Switch to syn for parsing doc comments#12258bors merged 1 commit intorust-lang:masterfrom
syn for parsing doc comments#12258bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
r? @weihanglo (rustbot has picked a reviewer for you, use r? to override) |
The hope is this will result in more resilient comment handling, being more consistent with rustdoc. I also hoped for less code but `syn` is doing less than I had expected, requiring us to copy code over from other parts of rust. It seems every proc macro has to do this but there is no guide to it, so they all do it differently, only covering the cases they thought to test for. Note that this still won't support `include_str!()`.
weihanglo
reviewed
Jun 16, 2023
Member
weihanglo
left a comment
There was a problem hiding this comment.
Could we have some more test cases:
- A mix of normal and inner comment. This didn't work for the
clapexample
with the regex implementation, but with syn it works. For example,// I am a normal comment //! ```cargo //! ...
- A mix of multi single and multi-line docs. For example
rustdocallows this:/// ``` /// assert!(true); /** * assert!(false, "you shall not pass"); * ``` */
- Should we add tests for raw
#[doc]attirbutes? Not really a blocker though.
d40ffa4 to
bae8b9d
Compare
39 tasks
weihanglo
approved these changes
Jun 17, 2023
Member
weihanglo
left a comment
There was a problem hiding this comment.
Thanks for adding those tests. Looks good to me.
Member
|
@bors r+ |
Contributor
Contributor
bors
added a commit
that referenced
this pull request
Jun 17, 2023
refactor(embedded): Switch to `syn` for parsing doc comments This is a follow up to #12245 which is working to resolve #12207 The hope is this will result in more resilient comment handling, being more consistent with rustdoc. I also hoped for less code but `syn` is doing less than I had expected, requiring us to copy code over from other parts of rust. It seems every proc macro has to do this but there is no guide to it, so they all do it differently, only covering the cases they thought to test for. Note that this still won't support `include_str!()`.
Contributor
|
💔 Test failed - checks-actions |
Member
Spurious I guess? @bors retry |
Contributor
Contributor
|
☀️ Test successful - checks-actions |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 20, 2023
Update cargo 12 commits in 0c14026aa84ee2ec4c67460c0a18abc8519ca6b2..dead4b8740c4b6a8ed5211e37c99cf81d01c3b1c 2023-06-14 18:43:05 +0000 to 2023-06-20 20:07:17 +0000 - Convert valid feature name warning to an error. (rust-lang/cargo#12291) - fix(embedded): Don't pollute script dir with lockfile (rust-lang/cargo#12284) - fix: remove `-Zjobserver-per-rustc` again (rust-lang/cargo#12285) - docs: some tweaks around `cargo test` (rust-lang/cargo#12288) - Enable `doctest-in-workspace` by default (rust-lang/cargo#12221) - fix(embedded): Don't auto-discover build.rs files (rust-lang/cargo#12283) - fix(embeded): Don't pollute the scripts dir with `target/` (rust-lang/cargo#12282) - feat: prepare for the next lockfile bump (rust-lang/cargo#12279) - fix(embedded): Don't create an intermediate manifest (rust-lang/cargo#12268) - refactor(embedded): Switch to `syn` for parsing doc comments (rust-lang/cargo#12258) - fix(embedded): Align package name sanitization with cargo-new (rust-lang/cargo#12255) - Clarify the default behavior of cargo-install. (rust-lang/cargo#12276) r? `@ghost`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow up to #12245 which is working to resolve #12207
The hope is this will result in more resilient comment handling, being more consistent with rustdoc.
I also hoped for less code but
synis doing less than I had expected, requiring us to copy code over from other parts of rust. It seems every proc macro has to do this but there is no guide to it, so they all do it differently, only covering the cases they thought to test for.See https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.E2.9C.94.20Stripping.20of.20doc-comment.20leading.20characters for some technical conversation on using
synand the gap betweensynand what rustc does.Note that this still won't support
include_str!().