-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |