This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit f3fd6c6
committed
Auto merge of rust-lang#138379 - estebank:macro-backtrace-note, r=<try>
Do not suggest using `-Zmacro-backtrace` for builtin macros
For macros that are implemented on the compiler, or that are annotated with `rustc_diagnostic_item`, which have arbitrary implementations from the point of view of the user and might as well be intrinsics, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros like `panic!` and `format!`.
This PR adds a field to every `Span`'s `ExpnData` stating whether it comes from a builtin macro. This is determined by the macro being annotated with either `#[rustc_builtin_macro]` or `#[rustc_diagnostic_item]`. An alternative to using these attributes that already exist for other uses would be to introduce another attribute like `#[rustc_no_backtrace]` to have finer control on which macros are affected (for example, an error within `vec![]` now doesn't mention the backtrace, but one could make the case that it should). Ideally, instead of carrying this information in the `ExpnData` we'd instead try to query the `DefId` of the macro (that is already stored) to see if it is annotated in some way, but we do not have access to the `TyCtxt` from `rustc_errors`.
r? `@petrochenkov`File tree
283 files changed
+40
-713
lines changed- compiler
- rustc_errors/src
- rustc_expand/src
- rustc_span/src
- src/tools/clippy/tests/ui
- tests
- run-make/non-unicode-env
- rustdoc-ui/doctest
- ui
- alloc-error
- allocator
- asm
- x86_64
- associated-consts
- associated-types
- async-await
- attributes
- binop
- borrowck
- alias-liveness
- closures
- 2229_closure_analysis/diagnostics
- codemap_tests
- coherence
- const-generics/adt_const_params
- const-ptr
- consts
- const-blocks
- const-eval
- control-flow
- min_const_fn
- required-consts
- coroutine
- custom_test_frameworks
- derives
- deriving
- diagnostic-width
- env-macro
- error-codes
- explicit-tail-calls
- feature-gates
- fmt
- generic-associated-types
- generic-const-items
- generics
- impl-trait/precise-capturing
- include-macros
- inference/need_type_info
- inline-const
- issues
- lifetimes
- lint
- dead-code
- liveness
- loops
- macros
- malformed
- mismatched_types
- modules
- moves
- never_type
- on-unimplemented
- proc-macro
- quote
- range
- reachable
- resolve
- rfcs
- rfc-0000-never_patterns
- rfc-1937-termination-trait
- rfc-2361-dbg-macro
- simd
- span
- statics
- structs/default-field-values
- suggestions
- test-attrs
- custom-test-frameworks
- traits
- const-traits
- const_derives
- next-solver
- transmutability
- try-block
- type-alias-impl-trait
- typeck
- type
- pattern_types
- union
- use
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
283 files changed
+40
-713
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
| |||
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
312 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
313 | 320 | | |
314 | | - | |
| 321 | + | |
315 | 322 | | |
316 | 323 | | |
317 | 324 | | |
318 | | - | |
| 325 | + | |
319 | 326 | | |
320 | 327 | | |
321 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
760 | 765 | | |
761 | 766 | | |
762 | 767 | | |
| |||
792 | 797 | | |
793 | 798 | | |
794 | 799 | | |
| 800 | + | |
795 | 801 | | |
796 | 802 | | |
797 | 803 | | |
| |||
888 | 894 | | |
889 | 895 | | |
890 | 896 | | |
| 897 | + | |
| 898 | + | |
891 | 899 | | |
892 | | - | |
| 900 | + | |
893 | 901 | | |
894 | 902 | | |
895 | | - | |
| 903 | + | |
896 | 904 | | |
897 | 905 | | |
898 | 906 | | |
899 | 907 | | |
900 | 908 | | |
901 | | - | |
| 909 | + | |
902 | 910 | | |
903 | 911 | | |
904 | 912 | | |
| |||
912 | 920 | | |
913 | 921 | | |
914 | 922 | | |
915 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
916 | 927 | | |
917 | 928 | | |
918 | 929 | | |
| 930 | + | |
919 | 931 | | |
920 | 932 | | |
921 | 933 | | |
| |||
1000 | 1012 | | |
1001 | 1013 | | |
1002 | 1014 | | |
| 1015 | + | |
1003 | 1016 | | |
1004 | 1017 | | |
1005 | 1018 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
982 | 982 | | |
983 | 983 | | |
984 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
985 | 990 | | |
986 | 991 | | |
987 | 992 | | |
| |||
1000 | 1005 | | |
1001 | 1006 | | |
1002 | 1007 | | |
| 1008 | + | |
1003 | 1009 | | |
1004 | 1010 | | |
1005 | 1011 | | |
| |||
1014 | 1020 | | |
1015 | 1021 | | |
1016 | 1022 | | |
| 1023 | + | |
1017 | 1024 | | |
1018 | 1025 | | |
1019 | 1026 | | |
| |||
1038 | 1045 | | |
1039 | 1046 | | |
1040 | 1047 | | |
| 1048 | + | |
1041 | 1049 | | |
1042 | 1050 | | |
1043 | 1051 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | | - | |
46 | 43 | | |
47 | 44 | | |
48 | 45 | | |
| |||
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | | - | |
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | | - | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
88 | | - | |
89 | 86 | | |
90 | 87 | | |
91 | 88 | | |
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
17 | | - | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
24 | | - | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
30 | 26 | | |
31 | | - | |
32 | | - | |
33 | 27 | | |
34 | 28 | | |
35 | 29 | | |
36 | 30 | | |
37 | 31 | | |
38 | 32 | | |
39 | | - | |
40 | | - | |
41 | 33 | | |
42 | 34 | | |
43 | 35 | | |
44 | 36 | | |
45 | 37 | | |
46 | 38 | | |
47 | | - | |
48 | | - | |
49 | 39 | | |
50 | 40 | | |
51 | 41 | | |
52 | 42 | | |
53 | 43 | | |
54 | 44 | | |
55 | | - | |
56 | | - | |
57 | 45 | | |
58 | 46 | | |
59 | 47 | | |
60 | 48 | | |
61 | 49 | | |
62 | 50 | | |
63 | | - | |
64 | | - | |
65 | 51 | | |
66 | 52 | | |
67 | 53 | | |
68 | 54 | | |
69 | 55 | | |
70 | 56 | | |
71 | | - | |
72 | | - | |
73 | 57 | | |
74 | 58 | | |
75 | 59 | | |
76 | 60 | | |
77 | 61 | | |
78 | 62 | | |
79 | | - | |
80 | | - | |
81 | 63 | | |
82 | 64 | | |
83 | 65 | | |
0 commit comments