-
Notifications
You must be signed in to change notification settings - Fork 13.4k
lint direct use of rustc_type_ir #141614
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 direct use of rustc_type_ir #141614
Conversation
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
@compiler-errors : Do I keep the existing lints for usage_of_type_ir_inherent and usage_of_type_ir_traits ? Or do I remove these, as they will implicitly be part of the lint "direct_use_of_rustc_type_ir" ? I mean the purpose of this new lint is to prevent the use of all types/traits under rustc_type_ir in random crates, including rustc_type_ir::inherent and rustc_type_ir::Interner , so we would have "one lint to rule them all" :p . Also, diagnostic items seem to be only usable on exported modules, not the crate directly. So I gonna to add a diagnostic item on each public module exported by rustc_type_ir. |
Please don't do this. You should be able to put a
Yes, you should keep them. They can be implemented in the same lint pass, though. |
This won't be sufficient because the crate root of If |
Indeed, good point. The change itself is not too complicated, that's just I am discovering all in internal compiler types and architecture in the same time :D (but it's fun !) |
Sorry, bad manipulation |
You were right, it seems that `compiler/rustc_passes/src/diagnostic_items.rs' must be adapted to include the crate owner_id. I am still running non-regressions testing, it works now :) (otherwise the lint is not emitted at all) |
9fdb411
to
b408e48
Compare
@rustbot ready |
☔ The latest upstream changes (presumably #137944) made this pull request unmergeable. Please resolve the merge conflicts. |
b408e48
to
02239a1
Compare
This commit adds a lint to prevent the use of rustc_type_ir in random compiler crates, except for type system internals traits, which are explicitly allowed. Moreover, this fixes diagnostic_items() to include the CRATE_OWNER_ID, otherwise rustc_diagnostic_item attribute is ignored on the crate root.
02239a1
to
a1a3bef
Compare
@bors r+ rollup |
Rollup of 6 pull requests Successful merges: - #135656 (Add `-Z hint-mostly-unused` to tell rustc that most of a crate will go unused) - #138237 (Get rid of `EscapeDebugInner`.) - #141614 (lint direct use of rustc_type_ir ) - #142123 (Implement initial support for timing sections (`--json=timings`)) - #142377 (Try unremapping compiler sources) - #142674 (remove duplicate crash test) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 6 pull requests Successful merges: - rust-lang/rust#135656 (Add `-Z hint-mostly-unused` to tell rustc that most of a crate will go unused) - rust-lang/rust#138237 (Get rid of `EscapeDebugInner`.) - rust-lang/rust#141614 (lint direct use of rustc_type_ir ) - rust-lang/rust#142123 (Implement initial support for timing sections (`--json=timings`)) - rust-lang/rust#142377 (Try unremapping compiler sources) - rust-lang/rust#142674 (remove duplicate crash test) r? `@ghost` `@rustbot` modify labels: rollup
cc #138449
As previously discussed with @lcnr, it is a lint to prevent direct use of rustc_type_ir, except for some internal crates (like next_trait_solver or rustc_middle for example).