mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Add test for #9560
This commit is contained in:
parent
b7bd45574a
commit
44d3c32922
1 changed files with 27 additions and 1 deletions
|
@ -500,7 +500,7 @@ fn main() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn coerce_unsize_expected_type() {
|
||||
fn coerce_unsize_expected_type_1() {
|
||||
check_no_mismatches(
|
||||
r#"
|
||||
//- minicore: coerce_unsized
|
||||
|
@ -520,6 +520,32 @@ fn main() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coerce_unsize_expected_type_2() {
|
||||
// FIXME: this is wrong, #9560
|
||||
check(
|
||||
r#"
|
||||
//- minicore: coerce_unsized
|
||||
struct InFile<T>;
|
||||
impl<T> InFile<T> {
|
||||
fn with_value<U>(self, value: U) -> InFile<U> { InFile }
|
||||
}
|
||||
struct RecordField;
|
||||
trait AstNode {}
|
||||
impl AstNode for RecordField {}
|
||||
|
||||
fn takes_dyn(it: InFile<&dyn AstNode>) {}
|
||||
|
||||
fn test() {
|
||||
let x: InFile<()> = InFile;
|
||||
let n = &RecordField;
|
||||
takes_dyn(x.with_value(n));
|
||||
// ^^^^^^^^^^^^^^^ expected InFile<&dyn AstNode>, got InFile<&RecordField>
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coerce_array_elems_lub() {
|
||||
check_no_mismatches(
|
||||
|
|
Loading…
Reference in a new issue