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

[Feat]: Add marker::unknown_lints lint for marker aware name handling #291

Open
xFrednet opened this issue Oct 13, 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 S-blocked Status: Blocked

Comments

@xFrednet
Copy link
Member

xFrednet commented Oct 13, 2023

Summary

The unknown_lints lint from rustc is useful, for tools, which always have a static or increasing set of sets. Marker is a bit different, since it loads lint crates with lints, meaning that the set of lints is not static and might change between every run.

When we run Marker, I would like to replace the default unknown_lints lint with a marker version, like marker::unknown_lints, that is aware of Marker's context and lint naming structure. Since #288, lints have the following naming convention:

  1. They start with the marker:: prefix
  2. They have the lint crate, as their infix
  3. They end with the lint name, given in the lint crate

The lint would check lints in lint level attributes. It would run the following checks on the lint name:

  1. Ignore any lint, which doesn't have the marker:: prefix. Rustc can handle that during normal compilation.
  2. If it encounters a lint with the marker:: prefix, it checks if the specified lint crate is loaded.
    • If it's not loaded everything is fine, and we just accept the name, without any comment, since it might be in the lint crate
    • If the lint crate is loaded, we check if the name is included in the list of registered lints, we got from the lint crate during startup. If it's included, awesome. Otherwise, we emit a warning.

Then we would allow the rustc version of the lint via console arguments -A unknown_lints when we run Marker.

One thing we have to decide, is where we want to store such buildin lints. One option would be another lint crate, or we just store them in marker_adapter. If you want to pickup this issue, just drop a small question in the issue, and we'll make a decision then :)


This issue is currently blocked, since the API doesn't provide a representation for attributes. See #51

Inspired by a discussion in #283

@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) S-blocked Status: Blocked labels Oct 13, 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 S-blocked Status: Blocked
Projects
None yet
Development

No branches or pull requests

1 participant