Skip to content

Commit

Permalink
Don't add "in this macro invocation" label to desugared spans
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jan 26, 2018
1 parent f90c445 commit 106e5c5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ impl EmitterWriter {
}
// Check to make sure we're not in any <*macros>
if !cm.span_to_filename(def_site).is_macros() &&
!trace.macro_decl_name.starts_with("desugaring of ") &&
!trace.macro_decl_name.starts_with("#[") ||
always_backtrace {
new_labels.push((trace.call_site,
Expand Down
4 changes: 0 additions & 4 deletions src/test/ui/const-fn-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ error[E0015]: calls in constant functions are limited to constant functions, str
|
17 | for i in 0..x { //~ ERROR calls in constant functions
| ^^^^
| |
| in this macro invocation

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

error[E0080]: constant evaluation error
--> $DIR/const-fn-error.rs:21:5
Expand Down
5 changes: 1 addition & 4 deletions src/test/ui/suggestions/try-on-option.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Resu
--> $DIR/try-on-option.rs:23:5
|
23 | x?; //~ the `?` operator
| --
| |
| cannot use the `?` operator in a function that returns `u32`
| in this macro invocation
| ^^ cannot use the `?` operator in a function that returns `u32`
|
= help: the trait `std::ops::Try` is not implemented for `u32`
= note: required by `std::ops::Try::from_error`
Expand Down
15 changes: 3 additions & 12 deletions src/test/ui/suggestions/try-operator-on-main.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Resu
--> $DIR/try-operator-on-main.rs:19:5
|
19 | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
| ---------------------------
| |
| cannot use the `?` operator in a function that returns `()`
| in this macro invocation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()`
|
= help: the trait `std::ops::Try` is not implemented for `()`
= note: required by `std::ops::Try::from_error`
Expand All @@ -14,10 +11,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `std
--> $DIR/try-operator-on-main.rs:22:5
|
22 | ()?; //~ ERROR the `?` operator can only
| ---
| |
| the `?` operator cannot be applied to type `()`
| in this macro invocation
| ^^^ the `?` operator cannot be applied to type `()`
|
= help: the trait `std::ops::Try` is not implemented for `()`
= note: required by `std::ops::Try::into_result`
Expand All @@ -38,10 +32,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `std
--> $DIR/try-operator-on-main.rs:32:5
|
32 | ()?; //~ ERROR the `?` operator can only
| ---
| |
| the `?` operator cannot be applied to type `()`
| in this macro invocation
| ^^^ the `?` operator cannot be applied to type `()`
|
= help: the trait `std::ops::Try` is not implemented for `()`
= note: required by `std::ops::Try::into_result`
Expand Down

0 comments on commit 106e5c5

Please sign in to comment.