-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add internal lint for detecting non-glob imports of rustc_type_ir::inherent
#127854
Add internal lint for detecting non-glob imports of rustc_type_ir::inherent
#127854
Conversation
match cx.tcx.sess.source_map().span_to_snippet(path.span).as_deref() { | ||
Ok("self") => (path.span, "*"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super gross but I couldn't think of anything better w/o tweaking AST lowering (e.g., to use mark_with_reason
in this case). This is for dealing with use path::to::{self};
properly.
In HIR, there's no way to tell whether use path::to;
comes from use path::{to};
or use path::to::{self};
but it matters for diagnostics (need to suggest ::*
vs. *
+ differing spans partly cuz use path::to::{self::*};
isn't allowed). Span etc. doesn't help.
report_in_external_macro: true | ||
} | ||
|
||
declare_lint_pass!(TypeIr => [NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm inclined to consolidate the lint passes TypeIr
and TyTyKind
to reduce bloat. I'd just need to think of a good name 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"opinionated imports"?
@@ -1,4 +1,4 @@ | |||
use crate::inherent::{AdtDef, IntoKind, Ty}; | |||
use crate::inherent::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omfg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks
@bors r+ rollup |
…t-lint, r=compiler-errors Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent` rust-lang#127627 (comment) r? compiler-errors
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#127542 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#127652 (Unignore cg_gcc fmt) - rust-lang#127664 (Fix precise capturing suggestion for hidden regions when we have APITs) - rust-lang#127806 (Some parser improvements) - rust-lang#127828 (Commonize `uname -m` results for `aarch64` in docker runner) - rust-lang#127845 (unix: break `stack_overflow::install_main_guard` into smaller fn) - rust-lang#127854 (Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`) - rust-lang#127861 (Document the column numbers for the dbg! macro) - rust-lang#127875 (style-guide: Clarify version-sorting) r? `@ghost` `@rustbot` modify labels: rollup
@bors r- failed the rollup in #127876 (comment). Lint didn't get registered? |
adc48b0
to
bd6a408
Compare
It's registered … in a stage2 compiler but apparently we also run @bors try |
…lint, r=<try> Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent` rust-lang#127627 (comment) r? compiler-errors
☀️ Try build successful - checks-actions |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
bd6a408
to
ee27b4c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
ee27b4c
to
2507301
Compare
@bors r=compiler-errors |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#124881 (Use ThreadId instead of TLS-address in `ReentrantLock`) - rust-lang#127656 (make pub_use_of_private_extern_crate show up in cargo's future breakage reports) - rust-lang#127748 (Use Option's discriminant as its size hint) - rust-lang#127854 (Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`) - rust-lang#127908 (Update extern linking documentation) - rust-lang#127919 (Allow a git command for getting the current branch in bootstrap to fail) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127854 - fmease:glob-import-type_ir_inherent-lint, r=compiler-errors Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent` rust-lang#127627 (comment) r? compiler-errors
#127627 (comment)
r? compiler-errors