Add test for #9560
This commit is contained in:
parent
b7bd45574a
commit
44d3c32922
@ -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 New Issue
Block a user