-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
JSON backend experimental impl #75114
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ac408e4
Add json backend
P1n3appl3 3506135
Respond to comments and start adding tests
P1n3appl3 8156b9a
Fix re-exports and extern-crate
P1n3appl3 c8b4e3c
Add expected output tests
P1n3appl3 ce4404a
Add restricted paths
P1n3appl3 5673bc5
Format
P1n3appl3 ad67aea
Fix: associated methods missing in output
P1n3appl3 e9af2d6
Ignore stripped items
P1n3appl3 5ff33ca
Mark stripped items
P1n3appl3 d99ec1d
Fix tests and update conversions
P1n3appl3 9ca0856
Don't panic if JSON backend fails to create a file
jyn514 99d4784
Fix attribute error in JSON testsuite
jyn514 a66a97a
Move rustdoc-json to rustdoc/
jyn514 338acee
Small cleanups
jyn514 47acf9a
Don't prettify json before printing
jyn514 cc85375
Add comments
jyn514 9147fd7
[BREAKING CHANGE] rename version -> crate_version
jyn514 463e8b8
[BREAKING CHANGE] rename source -> span
jyn514 ec7a660
Use exhaustive matches
jyn514 7ad40b5
Don't qualify imports for DefId
jyn514 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 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
This file contains 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 |
---|---|---|
|
@@ -287,6 +287,42 @@ pub enum ItemEnum { | |
} | ||
|
||
impl ItemEnum { | ||
/// Some items contain others such as structs (for their fields) and Enums | ||
/// (for their variants). This method returns those contained items. | ||
pub fn inner_items(&self) -> impl Iterator<Item = &Item> { | ||
match self { | ||
StructItem(s) => s.fields.iter(), | ||
UnionItem(u) => u.fields.iter(), | ||
VariantItem(Variant { kind: VariantKind::Struct(v) }) => v.fields.iter(), | ||
EnumItem(e) => e.variants.iter(), | ||
TraitItem(t) => t.items.iter(), | ||
ImplItem(i) => i.items.iter(), | ||
ModuleItem(m) => m.items.iter(), | ||
ExternCrateItem(_, _) | ||
| ImportItem(_) | ||
| FunctionItem(_) | ||
| TypedefItem(_, _) | ||
| OpaqueTyItem(_) | ||
| StaticItem(_) | ||
| ConstantItem(_) | ||
| TraitAliasItem(_) | ||
| TyMethodItem(_) | ||
| MethodItem(_) | ||
| StructFieldItem(_) | ||
| VariantItem(_) | ||
| ForeignFunctionItem(_) | ||
| ForeignStaticItem(_) | ||
| ForeignTypeItem | ||
| MacroItem(_) | ||
| ProcMacroItem(_) | ||
| PrimitiveItem(_) | ||
| AssocConstItem(_, _) | ||
| AssocTypeItem(_, _) | ||
| StrippedItem(_) | ||
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. I don't think this is correct? |
||
| KeywordItem(_) => [].iter(), | ||
} | ||
} | ||
|
||
pub fn is_type_alias(&self) -> bool { | ||
match *self { | ||
ItemEnum::TypedefItem(_, _) | ItemEnum::AssocTypeItem(_, _) => true, | ||
|
@@ -1576,6 +1612,11 @@ impl Path { | |
pub fn last_name(&self) -> &str { | ||
self.segments.last().expect("segments were empty").name.as_str() | ||
} | ||
|
||
crate fn whole_name(&self) -> String { | ||
String::from(if self.global { "::" } else { "" }) | ||
+ &self.segments.iter().map(|s| s.name.clone()).collect::<Vec<_>>().join("::") | ||
} | ||
} | ||
|
||
#[derive(Clone, PartialEq, Eq, Debug, Hash)] | ||
|
Oops, something went wrong.
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.
Why did this change?