-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Register target features in custom section when using xforms #3967
Conversation
|
||
// The first byte contains an integer describing the target feature count, which we increase by one. | ||
let mut data = Cursor::new(§ion.data); | ||
let count = leb128::read::unsigned(&mut data).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't use unwrap
, since it can fail if data
ends while it's still reading or the integer doesn't fit in a u64
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't fail because we already read it successfully beforehand (or return an error on failure) or inserted it correctly ourselves if no section was found.
Let me know if I missed something!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point, I didn't think about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I noticed that tools like
wasm-opt
don't like it when we use reference types but don't actually register them in the appropriate custom section as specified in the tooling convention(which is out of date).