We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1fac380 commit 5d7c24fCopy full SHA for 5d7c24f
clippy_lints/src/functions.rs
@@ -150,7 +150,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
150
151
let nodeid = cx.tcx.hir().hir_to_node_id(hir_id);
152
self.check_raw_ptr(cx, unsafety, decl, body, nodeid);
153
- self.check_line_number(cx, span);
+ self.check_line_number(cx, span, body);
154
}
155
156
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
@@ -181,12 +181,12 @@ impl<'a, 'tcx> Functions {
181
182
183
184
- fn check_line_number(self, cx: &LateContext<'_, '_>, span: Span) {
+ fn check_line_number(self, cx: &LateContext<'_, '_>, span: Span, body: &'tcx hir::Body) {
185
if in_external_macro(cx.sess(), span) {
186
return;
187
188
189
- let code_snippet = snippet(cx, span, "..");
+ let code_snippet = snippet(cx, body.value.span, "..");
190
let mut line_count: u64 = 0;
191
let mut in_comment = false;
192
let mut code_in_line;
tests/ui/crashes/ice-3747.rs
@@ -0,0 +1,17 @@
1
+/// Test for https://github.com/rust-lang/rust-clippy/issues/3747
2
+
3
+macro_rules! a {
4
+ ( $pub:tt $($attr:tt)* ) => {
5
+ $($attr)* $pub fn say_hello() {}
6
+ };
7
+}
8
9
+macro_rules! b {
10
+ () => {
11
+ a! { pub }
12
13
14
15
+b! {}
16
17
+fn main() {}
0 commit comments