Skip to content
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

Add explicit_reexport_of_matching_names test case. #100

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a260c15
Release v23.1.0. (#21)
obi1kenobi Jan 5, 2023
5aaf30e
Use the Swatinem/rust-cache@v2 action for caching. (#26) (#27)
obi1kenobi Jan 6, 2023
c075f09
Add fields to Variant interface (#32)
staniewzki Jan 6, 2023
a94ac93
Support renaming re-exports, glob re-exports, and type aliases used a…
obi1kenobi Jan 27, 2023
4b92627
Rely on the test crates instead of the manually-generated file. (#49)
obi1kenobi Jan 27, 2023
7dacacf
Release v23.2.0 with imports revamp. (#51)
obi1kenobi Jan 27, 2023
a0d35a1
Support omitting defaulted generic parameters. (#52) (#53)
obi1kenobi Jan 31, 2023
217e9f9
Release v23.2.1. (#57)
obi1kenobi Jan 31, 2023
75fc902
Add a test case where a type and a value have the same name. (#60) (#63)
obi1kenobi Jan 31, 2023
7c2f6b0
Clippy deny print statements. (#66) (#69)
obi1kenobi Feb 4, 2023
3581e6b
Add `renaming_reexport_of_reexport` test crate. (#70) (#75)
obi1kenobi Feb 5, 2023
29aee53
Extract a function for testing re-exports with matching names. (#71) …
obi1kenobi Feb 5, 2023
363cdd9
Fix error message text. (#79) (#82)
obi1kenobi Feb 5, 2023
a2c3fc9
Lint our rustdoc. (#83) (#84)
obi1kenobi Feb 14, 2023
84072e7
Don't fetch dependency info when reporting the current crate version.…
obi1kenobi Feb 22, 2023
3286cb1
Begin renaming items to match Trustfall v0.3 conventions. (#93)
obi1kenobi Mar 23, 2023
40cf897
Use the new helpers in Trustfall v0.3. (#95)
obi1kenobi Mar 23, 2023
d3da0d2
Add `explicit_reexport_of_matching_names` test case. (#72)
obi1kenobi Mar 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add fields to Variant interface (#32)
Signed-off-by: Michał Staniewski <m.staniewzki@gmail.com>

Signed-off-by: Michał Staniewski <m.staniewzki@gmail.com>
  • Loading branch information
staniewzki authored Jan 6, 2023
commit c075f095c26f768836a5dbe40c79ab139b2a524c
49 changes: 30 additions & 19 deletions src/adapter.rs
Original file line number Diff line number Diff line change
@@ -989,7 +989,9 @@ impl<'a> Adapter<'a> for RustdocAdapter<'a> {
unreachable!("project_neighbors {current_type_name} {edge_name} {parameters:?}")
}
},
"StructVariant" => match edge_name.as_ref() {
"Variant" | "PlainVariant" | "TupleVariant" | "StructVariant" => match edge_name
.as_ref()
{
"field" => {
let current_crate = self.current_crate;
let previous_crate = self.previous_crate;
@@ -1000,28 +1002,37 @@ impl<'a> Adapter<'a> for RustdocAdapter<'a> {
Some(token) => {
let origin = token.origin;
let item = token.as_variant().expect("token was not a Variant");
let item_index = match origin {
Origin::CurrentCrate => &current_crate.inner.index,
Origin::PreviousCrate => {
&previous_crate
.expect("no previous crate provided")
.inner
.index
}
};

match item {
Variant::Plain(_) => Box::new(std::iter::empty()),
Variant::Tuple(fields) => {
Box::new(fields.iter().filter(|x| x.is_some()).map(
move |field_id| {
origin.make_item_token(
item_index
.get(field_id.as_ref().unwrap())
.expect("missing item"),
)
},
))
}
Variant::Struct {
fields,
fields_stripped: _,
} => {
let item_index = match origin {
Origin::CurrentCrate => &current_crate.inner.index,
Origin::PreviousCrate => {
&previous_crate
.expect("no previous crate provided")
.inner
.index
}
};

Box::new(fields.iter().map(move |field_id| {
origin.make_item_token(
item_index.get(field_id).expect("missing item"),
)
}))
}
_ => unreachable!("the StructVariant token unexpectedly was not a struct variant: {token:?}")
} => Box::new(fields.iter().map(move |field_id| {
origin.make_item_token(
item_index.get(field_id).expect("missing item"),
)
})),
}
}
};
11 changes: 10 additions & 1 deletion src/rustdoc_schema.graphql
Original file line number Diff line number Diff line change
@@ -201,6 +201,9 @@ interface Variant implements Item {
# edges from Item
span: Span
attribute: [Attribute!]

# own edges
field: [StructField!]
}

"""
@@ -220,6 +223,9 @@ type PlainVariant implements Item & Variant {
# edges from Item
span: Span
attribute: [Attribute!]

# edges from Variant
field: [StructField!]
}

"""
@@ -239,6 +245,9 @@ type TupleVariant implements Item & Variant {
# edges from Item
span: Span
attribute: [Attribute!]

# edges from Variant
field: [StructField!]
}

"""
@@ -259,7 +268,7 @@ type StructVariant implements Item & Variant {
span: Span
attribute: [Attribute!]

# own edges
# edges from Variant
field: [StructField!]
}