Description
We basically need to implement this logic from rustc to get the right coercions working in some cases, for example in this test (already added on master):
#[test]
fn coerce_unsize_expected_type_2() {
check_no_mismatches(
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));
}
"#,
);
}