This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit d43714a
committed
Auto merge of rust-lang#10573 - Alexendoo:print-literal-file-macro, r=Jarcho
Ignore `file!()` macro in `print_literal`, `write_literal`
changelog: [`print_literal`], [`write_literal`]: Ignore the `file!()` macro
`file!()` expands to a string literal with its span set to that of the `file!()` callsite, but isn't marked as coming from an expansion. To fix this we make sure we actually find a string/char literal instead of assuming it's one and slicing
It would also ignore any other macros that result in the same situation, but that shouldn't be common as `proc_macro::Span::call_site()` returns a span that is marked as from expansion
Fixes rust-lang#10544File tree
3 files changed
+15
-5
lines changed- clippy_lints/src
- tests/ui
- auxiliary
3 files changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
470 | 473 | | |
471 | | - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
472 | 478 | | |
473 | 479 | | |
474 | 480 | | |
| |||
533 | 539 | | |
534 | 540 | | |
535 | 541 | | |
536 | | - | |
| 542 | + | |
537 | 543 | | |
538 | 544 | | |
539 | 545 | | |
540 | 546 | | |
541 | 547 | | |
542 | | - | |
| 548 | + | |
543 | 549 | | |
544 | 550 | | |
545 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
0 commit comments