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

Update metadata to 10.2.84-preview and regroup UseTrees #834

Merged
merged 1 commit into from
Jun 8, 2021

Conversation

MarijnS95
Copy link
Contributor

@MarijnS95 MarijnS95 commented Jun 5, 2021

The 10.2.84-preview win32metadata just dropped and only required few extra modifications since starting on this a few weeks ago, to regroup and clean up UseTrees. Not all are done yet, but it should look a lot better already (also keeping in mind #827/#828).

Note that this uses the file from https://github.com/microsoft/win32metadata/tree/v10.2.84-preview/scripts/BaselineWinmd because the nuget package appears to miss some types from the foundation namespace 🤔 - still investigating. The broken types switched from TypeRef to TypeDef.

@MarijnS95 MarijnS95 force-pushed the update-metadata branch 2 times, most recently from f2fbe29 to 9bca156 Compare June 5, 2021 21:14
@riverar
Copy link
Collaborator

riverar commented Jun 5, 2021

I didn't run into missing type issues; if there's anything here worth scavenging, feel free riverar@b2e0ade

@MarijnS95
Copy link
Contributor Author

@riverar I get the same Could not find type def `Windows.Win32.Foundation.HRESULT` error on your branch when running windows_bindings, have you ran that too?

@riverar
Copy link
Collaborator

riverar commented Jun 5, 2021

@MarijnS95 Are you on rustc nightly? I think they broke macro ABI recently, had to switch to stable. (Was fighting those same errors!)

@MarijnS95
Copy link
Contributor Author

@MarijnS95 Are you on rustc nightly? I think they broke macro ABI recently, had to switch to stable. (Was fighting those same errors!)

I'd be surprised if it's that, given that the baseline .winmd from the repo does work correctly. But no, the compiler is on stable 1.52.1. For good measure beta and nightly fail in the same way - likely something is wrong in the .winmd instead even though the types are successfully found with IlSpy.

@riverar
Copy link
Collaborator

riverar commented Jun 5, 2021

@MarijnS95 All my tests/build steps pass locally. Hm. OK, started fresh and yep, can reproduce now.

@riverar
Copy link
Collaborator

riverar commented Jun 5, 2021

@MarijnS95 Do we know why HRESULT is on the type exclusion list here? Removing this resolves the problem, but I'm wondering if that's just a hack covering up a problem.

("Windows.Win32.Foundation", "HRESULT"),

@kennykerr
Copy link
Collaborator

Do we know why HRESULT is on the type exclusion list here

Types that are represented both in WinRT and Win32 must be excluded and defined by the Windows crate directly.

MarijnS95 added a commit to MarijnS95/windows-rs that referenced this pull request Jun 6, 2021
@MarijnS95
Copy link
Contributor Author

Found the culrpit: HSTRING and HRESULT are a TypeDef now, not a TypeRef. Interesting how that changed between the baseline and the nuget release.

@riverar
Copy link
Collaborator

riverar commented Jun 6, 2021

@MarijnS95 Nice, looks good!

.resolve_type_def(type_def.namespace(), type_def.name())
.into()
}
TypeDefOrRef::TypeDef(type_def) => match type_def.full_name() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I still need to fix. There's no guarantee the types will be TypeDefs or TypeRefs. I was hoping in practice they'd only be TypeRefs as that's simpler but as long as the TypeDef resides in the same PE file then they can be TypeDefs. Ideally the arch-specific types would be TyepRefs though. That's a bug in the metadata (see comment below).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#845 deals with these issues.

Copy link
Contributor Author

@MarijnS95 MarijnS95 Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which of the two do you want to merge first? I think I can kick off the second commit if #845 goes in prior.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will complete 845.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, by kicking off the second commit the metadata import from nuget got lost as well, apologies. Thanks for pushing that back @kennykerr :)

@kennykerr
Copy link
Collaborator

Note that this uses the file from https://github.com/microsoft/win32metadata/tree/v10.2.84-preview/scripts/BaselineWinmd

I can only accept the winmd from the release.

@MarijnS95
Copy link
Contributor Author

MarijnS95 commented Jun 7, 2021

Note that this uses the file from https://github.com/microsoft/win32metadata/tree/v10.2.84-preview/scripts/BaselineWinmd

I can only accept the winmd from the release.

With aforementioned fix in the second commit this is now using the release blob - I'll remove that note from the description.

@@ -24,7 +24,7 @@ pub fn gen_bstr() -> TokenStream {
return 0;
}

unsafe { SysStringLen(self) as usize }
unsafe { super::System::OleAutomation::SysStringLen(self) as usize }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. Created an issue: microsoft/win32metadata#517

@kennykerr
Copy link
Collaborator

This looks good - I need to get the update in. Can you take care of the conflicts and then I'll merge this in.

@MarijnS95
Copy link
Contributor Author

This looks good - I need to get the update in. Can you take care of the conflicts and then I'll merge this in.

Self-induced conflicts with all the formatting 😬. Can we get #844 in first so that I can tackle them all at once?

@kennykerr
Copy link
Collaborator

Done.

@MarijnS95
Copy link
Contributor Author

@kennykerr Updated. Please give this some thorough scrutineering, most changes didn't survive autoformatting nor the removal of enum constants.

@MarijnS95
Copy link
Contributor Author

Note that some common paths in use trees have been merged, but not all/everywhere. What format is desired? Someone should do a pass to unify/normalize them all, both in build.rs as in the use bindings:: blocks in the source.

Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@kennykerr kennykerr merged commit 39eb4d2 into microsoft:master Jun 8, 2021
@MarijnS95 MarijnS95 deleted the update-metadata branch June 8, 2021 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants