-
Notifications
You must be signed in to change notification settings - Fork 34
docgen/website: show deprecated function warnings on docs website #584
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
Open
cpu
wants to merge
10
commits into
rustls:main
Choose a base branch
from
cpu:ci/cpu-deprecate-notes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f8866ac
website: check-in generated api.json
cpu de4cfab
ci: check for uncommitted website/static/api.json diffs
cpu c6a848f
ci: run the docs workflow for more triggers
cpu 4adbb82
tools/docgen: simplify process_doc_item format string
cpu ad82ec9
tools/docgen: document comment_and_requirement
cpu 3fad732
tools/docgen: pull out prev_prev once
cpu f14ba77
tools/docgen: simplify comment_and_requirement
cpu 947d8b1
tools/docgen: lift out MetadataItem type, improve crosslinking
cpu 210a3e7
tools/docgen: parse function deprecation messages
cpu 968640d
website: annotate/decorate deprecated items
cpu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,31 +202,33 @@ fn comment_and_requirement( | |
src: &[u8], | ||
) -> Result<(Option<Comment>, Option<Feature>), Box<dyn Error>> { | ||
let prev_prev = prev.prev_named_sibling(); | ||
let mut maybe_comment = Comment::new(prev, src).ok(); | ||
|
||
// If node wasn't a comment, see if it was an expression_statement | ||
// that itself was preceded by a comment. This skips over | ||
// expression-like preprocessor attributes on function decls. | ||
if let (None, "expression_statement", Some(prev_prev)) = | ||
(&maybe_comment, prev.kind(), prev_prev) | ||
{ | ||
maybe_comment = Comment::new(prev_prev, src).ok(); | ||
// In the simple case, `prev` is a comment and `prev_prev` may | ||
// be a feature requirement. | ||
if let Ok(comment) = Comment::new(prev, src) { | ||
let feature = match prev_prev { | ||
Some(prev_prev) => Feature::new(prev_prev, src).ok(), | ||
None => None, | ||
}; | ||
return Ok((Some(comment), feature)); | ||
} | ||
|
||
// If prev wasn't a comment, see if it was a feature requirement. | ||
if maybe_comment.is_none() { | ||
return Ok(match Feature::new(prev, src).ok() { | ||
Some(feat_req) => (None, Some(feat_req)), | ||
None => (None, None), | ||
}); | ||
// If `prev` wasn't a comment, see if it was an expression_statement | ||
// that itself was preceded by a comment. This skips over | ||
// expression-like preprocessor attributes on function decls. | ||
if prev.kind() == "expression_statement" { | ||
return match prev_prev { | ||
Some(prev_prev) => comment_and_requirement(prev_prev, src), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The introduction of recursion seems kind of sudden, maybe deserves its own commit? |
||
None => Ok((None, None)), | ||
}; | ||
} | ||
|
||
// Otherwise, check the prev of the comment for a feature requirement | ||
let Some(prev_prev) = prev_prev else { | ||
return Ok((maybe_comment, None)); | ||
}; | ||
|
||
Ok((maybe_comment, Feature::new(prev_prev, src).ok())) | ||
// If `prev` wasn't a comment, or an expression_statement preceded by a comment, | ||
// then it's either a bare feature requirement or we have no metadata to return. | ||
Ok(match Feature::new(prev, src).ok() { | ||
Some(feat_req) => (None, Some(feat_req)), | ||
None => (None, None), | ||
}) | ||
} | ||
|
||
#[derive(Debug, Default, Serialize)] | ||
|
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.
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 commit is still a little confusing to me, it seems to have a bunch of things going on that interact, making it hard to understand what the logical changes are. Suggest at least splitting out a commit that only does the
maybe_comment.is_none()
inversion thing?