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

Draft support for VARIANT and PROPVARIANT #2780

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading