Add regression test for #96530

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
This commit is contained in:
Yuki Okushi 2022-12-21 21:10:30 +09:00
parent 1d12c3cea3
commit 32a31d8aca
No known key found for this signature in database
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,20 @@
struct Person {
first_name: String,
age: u32,
}
fn first_woman(man: &Person) -> Person {
Person {
first_name: "Eve".to_string(),
..man.clone() //~ ERROR: mismatched types
}
}
fn main() {
let adam = Person {
first_name: "Adam".to_string(),
age: 0,
};
let eve = first_woman(&adam);
}

View file

@ -0,0 +1,9 @@
error[E0308]: mismatched types
--> $DIR/issue-96530.rs:9:11
|
LL | ..man.clone()
| ^^^^^^^^^^^ expected struct `Person`, found `&Person`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.