Collect trait impls inside unnamed consts

This commit is contained in:
Jonas Schievink 2021-04-07 03:33:22 +02:00
parent f04f38d3d7
commit 7c1c0e6fea
3 changed files with 61 additions and 19 deletions

View file

@ -1292,3 +1292,25 @@ mod b {
"#]],
)
}
#[test]
fn impl_in_unnamed_const() {
check_types(
r#"
struct S;
trait Tr {
fn method(&self) -> u16;
}
const _: () = {
impl Tr for S {}
};
fn f() {
S.method();
//^^^^^^^^^^ u16
}
"#,
);
}