diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 58f851aea38..8a4fd24a29b 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -767,6 +767,7 @@ fn fix_multispan_in_std_macros(&mut self, } // 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, diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/const-fn-error.stderr index de2a9299473..4f4f8b5ad00 100644 --- a/src/test/ui/const-fn-error.stderr +++ b/src/test/ui/const-fn-error.stderr @@ -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 diff --git a/src/test/ui/suggestions/try-on-option.stderr b/src/test/ui/suggestions/try-on-option.stderr index b1be9ad3cf6..dfe950818e7 100644 --- a/src/test/ui/suggestions/try-on-option.stderr +++ b/src/test/ui/suggestions/try-on-option.stderr @@ -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` diff --git a/src/test/ui/suggestions/try-operator-on-main.stderr b/src/test/ui/suggestions/try-operator-on-main.stderr index 3b32b4a9eb7..e97823a3d5d 100644 --- a/src/test/ui/suggestions/try-operator-on-main.stderr +++ b/src/test/ui/suggestions/try-operator-on-main.stderr @@ -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` @@ -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` @@ -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`