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

Lint: Check that every crate contains at most one export_lint_pass! call #207

Open
xFrednet opened this issue Jul 31, 2023 · 0 comments
Open
Labels
A-marker-lints Area: Lints for the marker API (marker_lints crate) C-enhancement Category: New feature or request E-good-first-issue Participation: Good for newcomers

Comments

@xFrednet
Copy link
Member

The export_lint_pass macro is required to load a lint crate by marker. The macro generates some functions which are marked as #[no_mangle]. If the macro would be called multiple times per crate, it would generate multiple functions with the name. This is unsound (I actually don't know what exactly happens).

A lint should check that each crate contains at most one call to export_lint_pass. It would be cool if we could check that each lint crate defines it exactly once, but I believe that we currently don't have a mechanism to determine if the compiled crate is a lint crate or just a library. Checking at most once, will be sufficient for now :)


Marker currently has no way to determine, which macro was written in the code. The lint should instead check that each crate contains at most one function called marker_api_version and one called marker_lint_crate_bindings

@xFrednet xFrednet added C-enhancement Category: New feature or request E-good-first-issue Participation: Good for newcomers A-marker-lints Area: Lints for the marker API (marker_lints crate) labels Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-marker-lints Area: Lints for the marker API (marker_lints crate) C-enhancement Category: New feature or request E-good-first-issue Participation: Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant