Skip to content

Commit

Permalink
variant
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Jan 9, 2024
1 parent 3ee83d5 commit 1911d1f
Show file tree
Hide file tree
Showing 10 changed files with 1,569 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ jobs:
cargo clippy -p test_sys &&
cargo clippy -p test_targets &&
cargo clippy -p test_unions &&
cargo clippy -p test_variant &&
cargo clippy -p test_wdk &&
cargo clippy -p test_weak &&
cargo clippy -p test_weak_ref &&
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ jobs:
cargo test -p test_enums &&
cargo test -p test_error &&
cargo test -p test_event &&
cargo clean &&
cargo test -p test_extensions &&
cargo clean &&
cargo test -p test_handles &&
cargo test -p test_helpers &&
cargo test -p test_implement &&
Expand Down Expand Up @@ -129,6 +129,7 @@ jobs:
cargo test -p test_sys &&
cargo test -p test_targets &&
cargo test -p test_unions &&
cargo test -p test_variant &&
cargo test -p test_wdk &&
cargo test -p test_weak &&
cargo test -p test_weak_ref &&
Expand Down
10 changes: 4 additions & 6 deletions crates/libs/bindgen/src/rust/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,10 @@ fn type_collect_standalone(ty: &metadata::Type, set: &mut std::collections::BTre
return;
}

let metadata::Type::TypeDef(def, generics) = &ty else {
let metadata::Type::TypeDef(def, generics) = ty.to_underlying_type() else {
return;
};

let def = *def;

// Ensure that we collect all the typedefs of the same name. We need to
// do this in the case where the user specifies a top level item that
// references a typedef by name, but that name resolves to more than 1
Expand All @@ -167,7 +165,7 @@ fn type_collect_standalone(ty: &metadata::Type, set: &mut std::collections::BTre
}
}

for generic in generics {
for generic in &generics {
type_collect_standalone(generic, set);
}
for field in def.fields() {
Expand All @@ -184,7 +182,7 @@ fn type_collect_standalone(ty: &metadata::Type, set: &mut std::collections::BTre
if method.name() == ".ctor" {
continue;
}
let signature = metadata::method_def_signature(def.namespace(), method, generics);
let signature = metadata::method_def_signature(def.namespace(), method, &generics);
type_collect_standalone(&signature.return_type, set);
signature.params.iter().for_each(|param| type_collect_standalone(&param.ty, set));
}
Expand All @@ -204,7 +202,7 @@ fn type_collect_standalone_nested(td: metadata::TypeDef, set: &mut std::collecti

for field in nested.fields() {
let ty = field.ty(Some(nested));
if let metadata::Type::TypeDef(def, _) = &ty {
if let metadata::Type::TypeDef(def, _) = ty.to_underlying_type() {
// Skip the fields that actually refer to the anonymous nested
// type, otherwise it will get added to the typeset and emitted
if def.namespace().is_empty() {
Expand Down
Loading

0 comments on commit 1911d1f

Please sign in to comment.