Skip to content

Rust: add QL doc annotations to schema #17527

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

Merged
merged 9 commits into from
Sep 20, 2024
Merged

Conversation

aibaars
Copy link
Contributor

@aibaars aibaars commented Sep 19, 2024

This pull request puts the QL docs with code examples back into the schema and generate the corresponding QL tests.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Sep 19, 2024
@aibaars aibaars force-pushed the aibaars/rust-annotations branch from a7835ef to eade815 Compare September 20, 2024 09:15
@aibaars aibaars marked this pull request as ready for review September 20, 2024 09:15
@aibaars aibaars requested a review from redsun82 September 20, 2024 09:17
Comment on lines 173 to 183
# @annotate(ConstExpr)
# @rust.doc_test_signature("() -> bool")
# class _:
# """
# A `const` block expression. For example:
# ```rust
# if const { SRC::IS_ZST || DEST::IS_ZST || mem::align_of::<SRC>() != mem::align_of::<DEST>() } {
# return false;
# }
# ```
# """
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this commented out? Might be worth a TODO unless it's an oversight

"""
The base class for expressions.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: pass is not required, and currently the file is not very consistent on it :)

Comment on lines 540 to 558
# @annotate(ElementListExpr)
# class _:
# """
# An element list expression. For example:
# ```rust
# [1, 2, 3, 4, 5];
# [1, 2, 3, 4, 5][0] = 6;
# ```
# """


# @annotate(RepeatExpr)
# class _:
# """
# A repeat expression. For example:
# ```rust
# [1; 10];
# ```
# """
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is what because of what you mentioned on https://github.com/github/codeql-team/issues/3378, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but I can remove this for now.

@aibaars
Copy link
Contributor Author

aibaars commented Sep 20, 2024

@redsun82 The QL test generator seems to ignore the function signatures somehow, did we break something in the schema generator?

@redsun82
Copy link
Contributor

@redsun82 The QL test generator seems to ignore the function signatures somehow, did we break something in the schema generator?

seems like it, but also seems like #17533 fixes it 🙂

@aibaars aibaars force-pushed the aibaars/rust-annotations branch from 121d212 to 45d9d8a Compare September 20, 2024 15:53
Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

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

🚀

@redsun82 redsun82 merged commit e48e18a into main Sep 20, 2024
14 checks passed
@redsun82 redsun82 deleted the aibaars/rust-annotations branch September 20, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants