From 7c1c0e6feadc017f5919f789f974405635fc25e3 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 7 Apr 2021 03:33:22 +0200 Subject: Collect trait impls inside unnamed consts --- crates/hir_ty/src/tests/method_resolution.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crates/hir_ty/src/tests') diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index 61f18b0d2..4b2c82b41 100644 --- a/crates/hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs @@ -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 +} + "#, + ); +} -- cgit v1.2.3