diff options
| author | bors <bors@rust-lang.org> | 2023-10-01 16:33:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-01 16:33:04 +0000 |
| commit | aee3daf90ba36fb14e3b9f04ea0eea97fd2ec6ad (patch) | |
| tree | 0a99e7793294dc477f1dd7eccb805a2e0fa76561 | |
| parent | ec15630c5d44bd2620da932db10f894ac8a0b0d7 (diff) | |
| parent | 6f1a78ffa85b1fc67517a0522530907d0025a5f5 (diff) | |
| download | rust-aee3daf90ba36fb14e3b9f04ea0eea97fd2ec6ad.tar.gz rust-aee3daf90ba36fb14e3b9f04ea0eea97fd2ec6ad.zip | |
Auto merge of #11593 - koka831:fix/10511, r=xFrednet
Use Span#from_expansion instead of in_external_macro - fixes #10511 I checked [the reported repository](https://github.com/rust-lang/rust-clippy/issues/10511#issuecomment-1474271205) and found that clippy hangs at [py_sync.rs#L85](https://github.com/rigetti/qcs-sdk-rust/blob/842094068ed6174ba08b52a2fbae39dda77cbd00/crates/python/src/py_sync.rs#L85), where a macro(`py_function_sync_async`) defines type parameters. this macro is used in the same crate, so `in_external_macro` wouldn't catch them. This PR fixes the problem by using `Span#from_expansion`. --- changelog: ICE: [`implicit_hasher`]: No longer lints inside macros, which could cause ICEs [#11593](https://github.com/rust-lang/rust-clippy/pull/11593)
| -rw-r--r-- | clippy_lints/src/implicit_hasher.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clippy_lints/src/implicit_hasher.rs b/clippy_lints/src/implicit_hasher.rs index 64a4a3fa741..2b2ea156cd4 100644 --- a/clippy_lints/src/implicit_hasher.rs +++ b/clippy_lints/src/implicit_hasher.rs @@ -6,9 +6,8 @@ use rustc_hir as hir; use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor}; use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind}; use rustc_hir_analysis::hir_ty_to_ty; -use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::hir::nested_filter; -use rustc_middle::lint::in_external_macro; use rustc_middle::ty::{Ty, TypeckResults}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; @@ -162,7 +161,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher { vis.visit_ty(ty); for target in &vis.found { - if in_external_macro(cx.sess(), generics.span) { + if generics.span.from_expansion() { continue; } let generics_suggestion_span = generics.span.substitute_dummy({ |
