diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs index aecc482cfdc..8db1592c916 100644 --- a/crates/hir_ty/src/tests/coercion.rs +++ b/crates/hir_ty/src/tests/coercion.rs @@ -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; +impl InFile { + fn with_value(self, value: U) -> InFile { 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(