Skip to content

Commit

Permalink
Rollup merge of #101914 - aDotInTheVoid:rdj-path-union-docs, r=jsha
Browse files Browse the repository at this point in the history
rustdoc-json-types: Document that ResolvedPath can also be a union

r? rustdoc
  • Loading branch information
notriddle authored Sep 17, 2022
2 parents b1178af + cb6c923 commit bba939e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ pub enum Term {
#[serde(rename_all = "snake_case")]
#[serde(tag = "kind", content = "inner")]
pub enum Type {
/// Structs and enums
/// Structs, enums, and unions
ResolvedPath(Path),
DynTrait(DynTrait),
/// Parameterized types
Expand Down
8 changes: 8 additions & 0 deletions src/test/rustdoc-json/unions/union.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// @has "$.index[*][?(@.name=='Union')].visibility" \"public\"
// @has "$.index[*][?(@.name=='Union')].kind" \"union\"
// @!has "$.index[*][?(@.name=='Union')].inner.struct_type"
// @set Union = "$.index[*][?(@.name=='Union')].id"
pub union Union {
int: i32,
float: f32,
}


// @is "$.index[*][?(@.name=='make_int_union')].inner.decl.output.kind" '"resolved_path"'
// @is "$.index[*][?(@.name=='make_int_union')].inner.decl.output.inner.id" $Union
pub fn make_int_union(int: i32) -> Union {
Union { int }
}

0 comments on commit bba939e

Please sign in to comment.