diff options
| author | Yuki Okushi <huyuumi.dev+love@gmail.com> | 2022-12-22 08:32:12 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-22 08:32:12 +0900 |
| commit | 6c0dedb445db61ba47d6d07f033c19f1d7631189 (patch) | |
| tree | 3c95fd98084383665c70ab9655b6d4abd7fb801c | |
| parent | 5689a7b372e5a7c53862cea1cb019c37d90a2821 (diff) | |
| parent | 32a31d8acaf8521712a49f53feabd7d98844ef73 (diff) | |
| download | rust-6c0dedb445db61ba47d6d07f033c19f1d7631189.tar.gz rust-6c0dedb445db61ba47d6d07f033c19f1d7631189.zip | |
Rollup merge of #105995 - JohnTitor:issue-96530, r=compiler-errors
Add regression test for #96530 Closes #96530 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
| -rw-r--r-- | src/test/ui/typeck/issue-96530.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/typeck/issue-96530.stderr | 9 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/typeck/issue-96530.rs b/src/test/ui/typeck/issue-96530.rs new file mode 100644 index 00000000000..4ab93ab4938 --- /dev/null +++ b/src/test/ui/typeck/issue-96530.rs @@ -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); +} diff --git a/src/test/ui/typeck/issue-96530.stderr b/src/test/ui/typeck/issue-96530.stderr new file mode 100644 index 00000000000..4b4568b1de9 --- /dev/null +++ b/src/test/ui/typeck/issue-96530.stderr @@ -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`. |
