Skip to content

Commit da2e33b

Browse files
committed
Don't refer to 'this tail expression' in expansion.
The user has no clue what tail expression the compiler is talking about: it is an implementation detail of the macro that it uses a block with tail expression.
1 parent d9a7393 commit da2e33b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3841,7 +3841,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
38413841
.expr_ty_adjusted_opt(inner_expr)
38423842
.unwrap_or(Ty::new_misc_error(tcx));
38433843
let span = inner_expr.span;
3844-
if Some(span) != err.span.primary_span() {
3844+
if Some(span) != err.span.primary_span()
3845+
&& !span.in_external_macro(tcx.sess.source_map())
3846+
{
38453847
err.span_label(
38463848
span,
38473849
if ty.references_error() {

tests/ui/never_type/feature-gate-never_type_fallback.stderr

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `(): T` is not satisfied
22
--> $DIR/feature-gate-never_type_fallback.rs:10:9
33
|
44
LL | foo(panic!())
5-
| --- ^^^^^^^^
6-
| | |
7-
| | the trait `T` is not implemented for `()`
8-
| | this tail expression is of type `()`
5+
| --- ^^^^^^^^ the trait `T` is not implemented for `()`
6+
| |
97
| required by a bound introduced by this call
108
|
119
help: this trait has no implementations, consider adding one

0 commit comments

Comments
 (0)