-
Notifications
You must be signed in to change notification settings - Fork 187
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
Use Rust-1.78 #[diagnostic::on_unimplemented]
to clarify push_next
trait
#915
base: master
Are you sure you want to change the base?
Conversation
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.
Awesome idea! The wording looks good to me. Could we link to e.g. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDeviceCreateInfo.html#VUID-VkDeviceCreateInfo-pNext-pNext? Not sure that's much more helpful than just linking the trait rustdoc, but it's authoritative and cross-referenced.
b0d679f
to
f74d7f0
Compare
Good one, I didn't realize that the |
…` trait When a user passes an invalid type into `push_next()`, [since Rust 1.78] we can now customize the diagnostics error to more clearly decsribe what and why they are not allowed to pass a certain type into this structure instead of having to refer to the trait definition (which contains no docs either). [since Rust 1.78]: https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html#diagnostic-attributes
f74d7f0
to
dced885
Compare
quote!(pub unsafe trait #extends_name {}) | ||
let message = format!("`{{Self}}` is not allowed in the `pNext` chain of `vk::{name}`"); | ||
let label = format!("`{{Self}}` does not extend `vk::{name}`"); | ||
let note = format!("See the list of allowed extension structs at <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/{}.html#VUID-{}-pNext-pNext>", struct_.name, struct_.name); |
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.
Unsure if the link should be wrapped in <>
, let me check some other diagnostics.
When a user passes an invalid type into
push_next()
, since Rust 1.78 we can now customize the diagnostics error to more clearly decsribe what and why they are not allowed to pass a certain type into this structure instead of having to refer to the trait definition (which contains no docs either).This turns the following, rather obnoxious error:
Into something more digestible:
Please help me bike-shed the wording though! I was also hoping to find some upstream documentation (or a list of current extensions) based on the
vk.xml
structextends
field, to reference in anote =
attribute.