diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-06-04 19:50:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 19:50:27 +0200 |
| commit | e0815883cf5b3e749ce22a99f031a02e60db4f62 (patch) | |
| tree | 0f8106dc19dc89e76b5cc9ed260b41ea78cffb24 | |
| parent | 8375ab01b781b7cece564774df78785b1a432e6e (diff) | |
| parent | da2e33b4065c3356260a0c1671a945a3bf0a2f35 (diff) | |
| download | rust-e0815883cf5b3e749ce22a99f031a02e60db4f62.tar.gz rust-e0815883cf5b3e749ce22a99f031a02e60db4f62.zip | |
Rollup merge of #142024 - m-ou-se:what-tail-expression, r=petrochenkov
Don't refer to 'this tail expression' in expansion. The user has no clue what the compiler is talking about when it says "this tail expression". It is an implementation detail of the macro that it uses a block with tail expression.
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs | 4 | ||||
| -rw-r--r-- | tests/ui/never_type/feature-gate-never_type_fallback.stderr | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index c4f1f7d712a..9c301373cf9 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -3841,7 +3841,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { .expr_ty_adjusted_opt(inner_expr) .unwrap_or(Ty::new_misc_error(tcx)); let span = inner_expr.span; - if Some(span) != err.span.primary_span() { + if Some(span) != err.span.primary_span() + && !span.in_external_macro(tcx.sess.source_map()) + { err.span_label( span, if ty.references_error() { diff --git a/tests/ui/never_type/feature-gate-never_type_fallback.stderr b/tests/ui/never_type/feature-gate-never_type_fallback.stderr index cbb670ea708..8dbd43e121b 100644 --- a/tests/ui/never_type/feature-gate-never_type_fallback.stderr +++ b/tests/ui/never_type/feature-gate-never_type_fallback.stderr @@ -2,10 +2,8 @@ error[E0277]: the trait bound `(): T` is not satisfied --> $DIR/feature-gate-never_type_fallback.rs:10:9 | LL | foo(panic!()) - | --- ^^^^^^^^ - | | | - | | the trait `T` is not implemented for `()` - | | this tail expression is of type `()` + | --- ^^^^^^^^ the trait `T` is not implemented for `()` + | | | required by a bound introduced by this call | help: this trait has no implementations, consider adding one |
