Skip to content

Extraneous leading lower-than character (<) in after-member comment syntax #3172

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

Open
Enet4 opened this issue Mar 15, 2025 · 0 comments
Open

Comments

@Enet4
Copy link

Enet4 commented Mar 15, 2025

Context

Some C code may declare doc comments in the same line as the respective member with a special syntax for the effect.

enum ColorSpace {
    RGB = 0, /**< red green blue */
    YBR_FULL, /**< YCbCr, full chrominance */
    XYB = 2 /**< LMS XYB */
};

This seems to be correctly interpreted, as bindgen is associating these comment blocks with the correct item. Removing < from the input would have resulted in the comments being linked to the subsequent item. However, the leading < character is retained in the Rust doc comment.

/* automatically generated by rust-bindgen 0.71.1 */

#[doc = "< red green blue"]
pub const ColorSpace_RGB: ColorSpace = 0;
#[doc = "< YCbCr, full chrominance"]
pub const ColorSpace_YBR_FULL: ColorSpace = 1;
#[doc = "< LMS XYB"]
pub const ColorSpace_XYB: ColorSpace = 2;
pub type ColorSpace = ::std::os::raw::c_uint;

Expected behavior

Since the < is part of the comment syntax, it should not be included in the doc string.

/* automatically generated by rust-bindgen 0.71.1 */

#[doc = "red green blue"]
pub const ColorSpace_RGB: ColorSpace = 0;
#[doc = "YCbCr, full chrominance"]
pub const ColorSpace_YBR_FULL: ColorSpace = 1;
#[doc = "LMS XYB"]
pub const ColorSpace_XYB: ColorSpace = 2;
pub type ColorSpace = ::std::os::raw::c_uint;
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

No branches or pull requests

1 participant