Add test for #8931 and better checking

This commit is contained in:
Florian Diebold 2021-05-23 12:52:41 +02:00
parent bc1ba1549d
commit a5d85a6356
3 changed files with 114 additions and 13 deletions

View file

@ -454,4 +454,33 @@ mod foo {
"#]],
);
}
#[test]
fn issue_8931() {
check(
r#"
#[lang = "fn_once"]
trait FnOnce<Args> {
type Output;
}
struct S;
struct Foo;
impl Foo {
fn foo(&self) -> &[u8] { loop {} }
}
impl S {
fn indented(&mut self, f: impl FnOnce(&mut Self)) {
}
fn f(&mut self, v: Foo) {
self.indented(|this| v.$0)
}
}
"#,
expect![[r#"
"#]],
);
}
}