From 6efddac288643c4b0bc85ea317ea275e6cb4739f Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 29 Jan 2024 18:31:02 +0000 Subject: Provide more context on derived obligation error primary label Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | ::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120. --- tests/ui/mut/mutable-enum-indirect.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/ui/mut/mutable-enum-indirect.stderr') diff --git a/tests/ui/mut/mutable-enum-indirect.stderr b/tests/ui/mut/mutable-enum-indirect.stderr index 0b7783b3318..d7af327df5a 100644 --- a/tests/ui/mut/mutable-enum-indirect.stderr +++ b/tests/ui/mut/mutable-enum-indirect.stderr @@ -6,7 +6,7 @@ LL | bar(&x); | | | required by a bound introduced by this call | - = help: within `&Foo`, the trait `Sync` is not implemented for `NoSync` + = help: within `&Foo`, the trait `Sync` is not implemented for `NoSync`, which is required by `&Foo: Sync` note: required because it appears within the type `Foo` --> $DIR/mutable-enum-indirect.rs:11:6 | -- cgit 1.4.1-3-g733a5