Stream: t-compiler

Topic: Mark some lints as only usable at crate level


Charles Lew (May 10 2020 at 05:50, on Zulip):

What's the proper way to mark some lints as only usable at crate level? I want to emit a warning or an error when user attempts to tune its level at finer grained level.

oli (May 11 2020 at 10:02, on Zulip):

you can use https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/trait.LateLintPass.html#method.enter_lint_attrs to error on specific attributes. You'll need to store a flag in your lint pass struct so you don't lint on the crate attributes and then change that flag in check_crate at which point the first enter_lint_attrs will already have been called

Charles Lew (May 11 2020 at 17:34, on Zulip):

Thanks!

Last update: Jun 04 2020 at 18:45UTC