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/parser/struct-literal-in-for.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/ui/parser') diff --git a/tests/ui/parser/struct-literal-in-for.stderr b/tests/ui/parser/struct-literal-in-for.stderr index 1c91eba68e3..d2ef2ad7b5a 100644 --- a/tests/ui/parser/struct-literal-in-for.stderr +++ b/tests/ui/parser/struct-literal-in-for.stderr @@ -23,7 +23,7 @@ LL | | x: 3 LL | | }.hi() { | |__________^ `bool` is not an iterator | - = help: the trait `Iterator` is not implemented for `bool` + = help: the trait `Iterator` is not implemented for `bool`, which is required by `bool: IntoIterator` = note: required for `bool` to implement `IntoIterator` error: aborting due to 2 previous errors -- cgit 1.4.1-3-g733a5