diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-10 15:35:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-10 15:35:10 +0000 |
commit | b35559a2460e7f0b2b79a7029db0c5d4e0acdb44 (patch) | |
tree | b0aab1d4c84036dfdc27da40e15c96828cd9e9fd /crates/hir_ty/src | |
parent | 83280ea5746451f4580e6c32ba8a82be972cb786 (diff) | |
parent | c2622c922887368788674d1735a7705fc345a5b9 (diff) |
Merge #7959
7959: Prefer names from outer DefMap over extern prelude r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7919
Just one more special case, how bad could it be.
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/diagnostics.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs index 6bca7aa0d..86f937e1d 100644 --- a/crates/hir_ty/src/diagnostics.rs +++ b/crates/hir_ty/src/diagnostics.rs | |||
@@ -706,6 +706,35 @@ fn x(a: S) { | |||
706 | } | 706 | } |
707 | 707 | ||
708 | #[test] | 708 | #[test] |
709 | fn import_extern_crate_clash_with_inner_item() { | ||
710 | // This is more of a resolver test, but doesn't really work with the hir_def testsuite. | ||
711 | |||
712 | check_diagnostics( | ||
713 | r#" | ||
714 | //- /lib.rs crate:lib deps:jwt | ||
715 | mod permissions; | ||
716 | |||
717 | use permissions::jwt; | ||
718 | |||
719 | fn f() { | ||
720 | fn inner() {} | ||
721 | jwt::Claims {}; // should resolve to the local one with 0 fields, and not get a diagnostic | ||
722 | } | ||
723 | |||
724 | //- /permissions.rs | ||
725 | pub mod jwt { | ||
726 | pub struct Claims {} | ||
727 | } | ||
728 | |||
729 | //- /jwt/lib.rs crate:jwt | ||
730 | pub struct Claims { | ||
731 | field: u8, | ||
732 | } | ||
733 | "#, | ||
734 | ); | ||
735 | } | ||
736 | |||
737 | #[test] | ||
709 | fn break_outside_of_loop() { | 738 | fn break_outside_of_loop() { |
710 | check_diagnostics( | 739 | check_diagnostics( |
711 | r#" | 740 | r#" |