Point at struct field if possible

This commit is contained in:
Michael Goulet 2022-08-17 04:57:17 +00:00
parent c0c6603c79
commit 292ab399b3
10 changed files with 246 additions and 188 deletions

View file

@ -15,8 +15,8 @@ fn main() {
x: 5,
};
let s = S { //~ ERROR the trait bound `{float}: Foo` is not satisfied
x: 5.0,
let s = S {
x: 5.0, //~ ERROR the trait bound `{float}: Foo` is not satisfied
};
let s = S {

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `{float}: Foo` is not satisfied
--> $DIR/type_wf.rs:18:13
--> $DIR/type_wf.rs:19:9
|
LL | let s = S {
| ^ the trait `Foo` is not implemented for `{float}`
LL | x: 5.0,
| ^^^^^^ the trait `Foo` is not implemented for `{float}`
|
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `S`

View file

@ -27,7 +27,7 @@ error[E0277]: the size for values of type `[{integer}]` cannot be known at compi
--> $DIR/range-1.rs:14:17
|
LL | let range = *arr..;
| ^^^^^^ doesn't have a size known at compile-time
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[{integer}]`
note: required by a bound in `RangeFrom`

View file

@ -8,8 +8,8 @@ struct Foo<T:Trait> {
fn main() {
let foo = Foo {
//~^ ERROR E0277
x: 3
//~^ ERROR E0277
};
let baz: Foo<usize> = loop { };

View file

@ -11,10 +11,10 @@ LL | struct Foo<T:Trait> {
| ^^^^^ required by this bound in `Foo`
error[E0277]: the trait bound `{integer}: Trait` is not satisfied
--> $DIR/on-structs-and-enums-locals.rs:10:15
--> $DIR/on-structs-and-enums-locals.rs:11:9
|
LL | let foo = Foo {
| ^^^ the trait `Trait` is not implemented for `{integer}`
LL | x: 3
| ^^^^ the trait `Trait` is not implemented for `{integer}`
|
note: required by a bound in `Foo`
--> $DIR/on-structs-and-enums-locals.rs:5:14

View file

@ -6,8 +6,8 @@ use on_structs_and_enums_xc::{Bar, Foo, Trait};
fn main() {
let foo = Foo {
//~^ ERROR E0277
x: 3
//~^ ERROR E0277
};
let bar: Bar<f64> = return;
//~^ ERROR E0277

View file

@ -11,10 +11,10 @@ LL | pub enum Bar<T:Trait> {
| ^^^^^ required by this bound in `Bar`
error[E0277]: the trait bound `{integer}: Trait` is not satisfied
--> $DIR/on-structs-and-enums-xc1.rs:8:15
--> $DIR/on-structs-and-enums-xc1.rs:9:9
|
LL | let foo = Foo {
| ^^^ the trait `Trait` is not implemented for `{integer}`
LL | x: 3
| ^^^^ the trait `Trait` is not implemented for `{integer}`
|
note: required by a bound in `Foo`
--> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18

View file

@ -11,10 +11,10 @@ LL | union U<T: Copy> {
| ^^^^ required by this bound in `U`
error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
--> $DIR/union-generic.rs:13:13
--> $DIR/union-generic.rs:13:17
|
LL | let u = U::<Rc<u32>> { a: Default::default() };
| ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc<u32>`
| ^^^^^^^ the trait `Copy` is not implemented for `Rc<u32>`
|
note: required by a bound in `U`
--> $DIR/union-generic.rs:6:12

View file

@ -11,10 +11,10 @@ LL | union U<T: Copy> {
| ^^^^ required by this bound in `U`
error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
--> $DIR/union-generic.rs:13:13
--> $DIR/union-generic.rs:13:17
|
LL | let u = U::<Rc<u32>> { a: Default::default() };
| ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc<u32>`
| ^^^^^^^ the trait `Copy` is not implemented for `Rc<u32>`
|
note: required by a bound in `U`
--> $DIR/union-generic.rs:6:12