rust-analyzer/crates/hir-def/src
bors 57cc2a6e27 Auto merge of #13602 - lowr:fix/nameres-transitive-visibility, r=Veykril
fix: check visibility of each path segment

Upon path resolution, we have not been checking if every def pointed to by each segment of the path is visible from the original module. This leads to incorrect import resolutions, in particular when one uses glob imports and names collide.

There is decent amount of changes in this PR because:
- some of our tests were not correct in terms of visibility
  - I left several basic nameres tests as-is (with expect test updated) since I thought it would be nice to ensure we don't resolve defs that are not visible.
- `fix_visibility` assist relied on `Semantics::resolve_path()`, which uses the name resolution procedure I'm fixing and wouldn't be able to "see through" the items with strict visibility with this patch

The first commit is the gist of the fix itself.

Fixes #10991
Fixes #11473
Fixes #13252
2022-11-11 12:32:21 +00:00
..
body Honor cfg attributes on params when lowering their patterns 2022-10-10 09:47:09 +02:00
item_tree Collect generic arguments in associated type bindings 2022-10-27 19:18:59 +09:00
macro_expansion_tests Fix tt::Punct's spacing calculation 2022-11-05 19:42:09 +09:00
nameres Fix tests that depended on loose visibility restriction 2022-11-11 20:31:46 +09:00
path Collect generic arguments in associated type bindings 2022-10-27 19:18:59 +09:00
adt.rs Use Arc<[DefDiagnostic]> instead of Arc<Vec<DefDiagnostic>> 2022-09-26 19:16:02 +01:00
attr.rs fix: Fix ast-id up when merging raw attributes 2022-07-30 09:43:30 +02:00
body.rs Honor cfg attributes on params when lowering their patterns 2022-10-10 09:47:09 +02:00
builtin_attr.rs internal: Update inert attribute list 2022-07-05 11:54:46 +02:00
builtin_type.rs Add an HIR pretty-printer 2022-08-15 13:51:45 +02:00
child_by_source.rs Properly support IDE functionality in enum variants 2022-09-24 02:33:59 +02:00
data.rs Use Arc<[DefDiagnostic]> instead of Arc<Vec<DefDiagnostic>> 2022-09-26 19:16:02 +01:00
db.rs Use Arc<[DefDiagnostic]> instead of Arc<Vec<DefDiagnostic>> 2022-09-26 19:16:02 +01:00
dyn_map.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
expr.rs Lower generator expression to HIR 2022-09-09 16:47:32 +09:00
find_path.rs Fix find_path using the wrong module for visibility calculations 2022-09-22 17:56:58 +02:00
generics.rs Returns the old value for la_arena::ArenaMap::insert 2022-08-07 04:53:23 +08:00
import_map.rs revert nightly rustfmt formatting that accidentally slipped in 2022-07-25 14:18:30 +02:00
intern.rs internal: Update dashmap and freeze its version 2022-06-10 16:19:52 +02:00
item_scope.rs Simplify 2022-09-18 19:44:38 +02:00
item_tree.rs Emit unconfigured code diagnostics for fields 2022-09-26 19:04:57 +01:00
keys.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
lang_item.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
lib.rs Parse more repr options 2022-09-20 17:12:27 +02:00
macro_expansion_tests.rs Update remaining GitHub URLs 2022-07-08 15:44:49 +02:00
nameres.rs Clarify the state of (extern) preludes for block def maps 2022-09-02 17:43:20 +02:00
path.rs Collect generic arguments in associated type bindings 2022-10-27 19:18:59 +09:00
per_ns.rs Make resolve_name_in_module a bit more lazy 2022-08-15 16:41:51 +02:00
pretty.rs Lower unsafety of fn pointer and fn item types 2022-11-04 21:07:15 +01:00
resolver.rs Implemented basic enum const eval 2022-09-12 20:19:13 +01:00
src.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
test_db.rs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
trace.rs style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
type_ref.rs Lower unsafety of fn pointer and fn item types 2022-11-04 21:07:15 +01:00
visibility.rs Returns the old value for la_arena::ArenaMap::insert 2022-08-07 04:53:23 +08:00