Skip to content

Commit 106e5c5

Browse files
committed
Don't add "in this macro invocation" label to desugared spans
1 parent f90c445 commit 106e5c5

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

src/librustc_errors/emitter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ impl EmitterWriter {
767767
}
768768
// Check to make sure we're not in any <*macros>
769769
if !cm.span_to_filename(def_site).is_macros() &&
770+
!trace.macro_decl_name.starts_with("desugaring of ") &&
770771
!trace.macro_decl_name.starts_with("#[") ||
771772
always_backtrace {
772773
new_labels.push((trace.call_site,

src/test/ui/const-fn-error.stderr

-4
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ error[E0015]: calls in constant functions are limited to constant functions, str
1717
|
1818
17 | for i in 0..x { //~ ERROR calls in constant functions
1919
| ^^^^
20-
| |
21-
| in this macro invocation
2220

2321
error[E0019]: constant function contains unimplemented expression type
2422
--> $DIR/const-fn-error.rs:17:14
2523
|
2624
17 | for i in 0..x { //~ ERROR calls in constant functions
2725
| ^^^^
28-
| |
29-
| in this macro invocation
3026

3127
error[E0080]: constant evaluation error
3228
--> $DIR/const-fn-error.rs:21:5

src/test/ui/suggestions/try-on-option.stderr

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Resu
1010
--> $DIR/try-on-option.rs:23:5
1111
|
1212
23 | x?; //~ the `?` operator
13-
| --
14-
| |
15-
| cannot use the `?` operator in a function that returns `u32`
16-
| in this macro invocation
13+
| ^^ cannot use the `?` operator in a function that returns `u32`
1714
|
1815
= help: the trait `std::ops::Try` is not implemented for `u32`
1916
= note: required by `std::ops::Try::from_error`

src/test/ui/suggestions/try-operator-on-main.stderr

+3-12
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Resu
22
--> $DIR/try-operator-on-main.rs:19:5
33
|
44
19 | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
5-
| ---------------------------
6-
| |
7-
| cannot use the `?` operator in a function that returns `()`
8-
| in this macro invocation
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()`
96
|
107
= help: the trait `std::ops::Try` is not implemented for `()`
118
= note: required by `std::ops::Try::from_error`
@@ -14,10 +11,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `std
1411
--> $DIR/try-operator-on-main.rs:22:5
1512
|
1613
22 | ()?; //~ ERROR the `?` operator can only
17-
| ---
18-
| |
19-
| the `?` operator cannot be applied to type `()`
20-
| in this macro invocation
14+
| ^^^ the `?` operator cannot be applied to type `()`
2115
|
2216
= help: the trait `std::ops::Try` is not implemented for `()`
2317
= note: required by `std::ops::Try::into_result`
@@ -38,10 +32,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `std
3832
--> $DIR/try-operator-on-main.rs:32:5
3933
|
4034
32 | ()?; //~ ERROR the `?` operator can only
41-
| ---
42-
| |
43-
| the `?` operator cannot be applied to type `()`
44-
| in this macro invocation
35+
| ^^^ the `?` operator cannot be applied to type `()`
4536
|
4637
= help: the trait `std::ops::Try` is not implemented for `()`
4738
= note: required by `std::ops::Try::into_result`

0 commit comments

Comments
 (0)