diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-09 14:30:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-09 14:30:12 +0100 |
commit | c08e690c937bc19ab518a4ba4a6178218b20b69a (patch) | |
tree | ae2bce74a600ff461317f61e2882a7fe50cf8349 /crates/hir_ty/src/tests/traits.rs | |
parent | 3b1692c3e8b58e0f54e2f0e179c27de8ffb409dc (diff) | |
parent | 75614b126b0fb7c0f1f7da4b4f37c32c56712fc7 (diff) |
Merge #8447
8447: Resolve prelude and crate root names in the root DefMap r=jonas-schievink a=jonas-schievink
Should fix https://github.com/rust-analyzer/rust-analyzer/issues/8418
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests/traits.rs')
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 30 |
1 files changed, 30 insertions, 0 deletions
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() { | |||
3413 | "#]], | 3413 | "#]], |
3414 | ); | 3414 | ); |
3415 | } | 3415 | } |
3416 | |||
3417 | #[test] | ||
3418 | fn renamed_extern_crate_in_block() { | ||
3419 | check_types( | ||
3420 | r#" | ||
3421 | //- /lib.rs crate:lib deps:serde | ||
3422 | use serde::Deserialize; | ||
3423 | |||
3424 | struct Foo {} | ||
3425 | |||
3426 | const _ : () = { | ||
3427 | extern crate serde as _serde; | ||
3428 | impl _serde::Deserialize for Foo { | ||
3429 | fn deserialize() -> u8 { 0 } | ||
3430 | } | ||
3431 | }; | ||
3432 | |||
3433 | fn foo() { | ||
3434 | Foo::deserialize(); | ||
3435 | //^^^^^^^^^^^^^^^^^^ u8 | ||
3436 | } | ||
3437 | |||
3438 | //- /serde.rs crate:serde | ||
3439 | |||
3440 | pub trait Deserialize { | ||
3441 | fn deserialize() -> u8; | ||
3442 | } | ||
3443 | "#, | ||
3444 | ); | ||
3445 | } | ||