From 75614b126b0fb7c0f1f7da4b4f37c32c56712fc7 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 9 Apr 2021 15:25:12 +0200 Subject: Resolve prelude and crate root names in the root DefMap --- crates/hir_ty/src/tests/traits.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'crates/hir_ty/src') diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 65b71fdfa..1c1aa491d 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -3413,3 +3413,33 @@ fn foo() { "#]], ); } + +#[test] +fn renamed_extern_crate_in_block() { + check_types( + r#" +//- /lib.rs crate:lib deps:serde +use serde::Deserialize; + +struct Foo {} + +const _ : () = { + extern crate serde as _serde; + impl _serde::Deserialize for Foo { + fn deserialize() -> u8 { 0 } + } +}; + +fn foo() { + Foo::deserialize(); + //^^^^^^^^^^^^^^^^^^ u8 +} + +//- /serde.rs crate:serde + +pub trait Deserialize { + fn deserialize() -> u8; +} + "#, + ); +} -- cgit v1.2.3