coerce fields to the expected field type
Fully fixes #31260. This needs a crater run.
This commit is contained in:
parent
03198da2ad
commit
7769c9a7ec
4 changed files with 29 additions and 39 deletions
|
|
@ -39,23 +39,25 @@ fn c() -> Result<Foo, Bar> {
|
|||
}
|
||||
|
||||
fn d() -> X<X<String, String>, String> {
|
||||
X {
|
||||
let x = X {
|
||||
x: X {
|
||||
x: "".to_string(),
|
||||
y: 2,
|
||||
},
|
||||
y: 3,
|
||||
}
|
||||
};
|
||||
x
|
||||
}
|
||||
|
||||
fn e() -> X<X<String, String>, String> {
|
||||
X {
|
||||
let x = X {
|
||||
x: X {
|
||||
x: "".to_string(),
|
||||
y: 2,
|
||||
},
|
||||
y: "".to_string(),
|
||||
}
|
||||
};
|
||||
x
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -35,31 +35,19 @@ error[E0308]: mismatched types
|
|||
found type `Foo`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:42:5
|
||||
--> $DIR/abridged.rs:49:5
|
||||
|
|
||||
42 | / X {
|
||||
43 | | x: X {
|
||||
44 | | x: "".to_string(),
|
||||
45 | | y: 2,
|
||||
46 | | },
|
||||
47 | | y: 3,
|
||||
48 | | }
|
||||
| |_____^ expected struct `std::string::String`, found integral variable
|
||||
49 | x
|
||||
| ^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
= note: expected type `X<X<_, std::string::String>, std::string::String>`
|
||||
found type `X<X<_, {integer}>, {integer}>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:52:5
|
||||
--> $DIR/abridged.rs:60:5
|
||||
|
|
||||
52 | / X {
|
||||
53 | | x: X {
|
||||
54 | | x: "".to_string(),
|
||||
55 | | y: 2,
|
||||
56 | | },
|
||||
57 | | y: "".to_string(),
|
||||
58 | | }
|
||||
| |_____^ expected struct `std::string::String`, found integral variable
|
||||
60 | x
|
||||
| ^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
= note: expected type `X<X<_, std::string::String>, _>`
|
||||
found type `X<X<_, {integer}>, _>`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue