Skip to content

Commit 6c0dedb

Browse files
author
Yuki Okushi
authoredDec 21, 2022
Rollup merge of rust-lang#105995 - JohnTitor:issue-96530, r=compiler-errors
Add regression test for rust-lang#96530 Closes rust-lang#96530 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2 parents 5689a7b + 32a31d8 commit 6c0dedb

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)
Please sign in to comment.