Skip to content

Commit 32a31d8

Browse files
committed
Add regression test for #96530
Signed-off-by: Yuki Okushi <[email protected]>
1 parent 1d12c3c commit 32a31d8

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/test/ui/typeck/issue-96530.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
struct Person {
2+
first_name: String,
3+
age: u32,
4+
}
5+
6+
fn first_woman(man: &Person) -> Person {
7+
Person {
8+
first_name: "Eve".to_string(),
9+
..man.clone() //~ ERROR: mismatched types
10+
}
11+
}
12+
13+
fn main() {
14+
let adam = Person {
15+
first_name: "Adam".to_string(),
16+
age: 0,
17+
};
18+
19+
let eve = first_woman(&adam);
20+
}

src/test/ui/typeck/issue-96530.stderr

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

0 commit comments

Comments
 (0)