rust/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
Esteban Küber 6efddac288 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 |     <i32 as Foo>::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<T: Bar> Foo for T {}
  |         ---  ^^^     ^
  |         |
  |         unsatisfied trait bound introduced here
```

Fix #40120.
2024-01-30 21:28:18 +00:00

63 lines
2.1 KiB
Plaintext

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-sized-cond.rs:1:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the size for values of type `V` cannot be known at compilation time
--> $DIR/bad-sized-cond.rs:17:5
|
LL | foo();
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `V`
note: required by a bound in `foo`
--> $DIR/bad-sized-cond.rs:6:15
|
LL | pub fn foo()
| --- required by a bound in this function
LL | where
LL | for<V> V: Sized,
| ^^^^^ required by this bound in `foo`
error[E0277]: `V` is not an iterator
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
| ^^^^^ `V` is not an iterator
|
= help: the trait `Iterator` is not implemented for `V`, which is required by `V: IntoIterator`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
|
LL | pub fn bar()
| --- required by a bound in this function
LL | where
LL | for<V> V: IntoIterator,
| ^^^^^^^^^^^^ required by this bound in `bar`
error[E0277]: the size for values of type `V` cannot be known at compilation time
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `V`, which is required by `V: IntoIterator`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
|
LL | pub fn bar()
| --- required by a bound in this function
LL | where
LL | for<V> V: IntoIterator,
| ^^^^^^^^^^^^ required by this bound in `bar`
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.