Skip to content

Commit

Permalink
Add regression test for rust-lang#96530
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor authored and MaciejWas committed Dec 27, 2022
1 parent a76ce87 commit 0fda6e1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/ui/typeck/issue-96530.rs
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions src/test/ui/typeck/issue-96530.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 0fda6e1

Please sign in to comment.