Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-def/src/expr_store/tests/body/block.rs244
-rw-r--r--crates/hir-def/src/item_scope.rs63
-rw-r--r--crates/hir-def/src/nameres.rs4
-rw-r--r--crates/hir-def/src/nameres/tests.rs246
-rw-r--r--crates/hir-def/src/nameres/tests/globs.rs214
-rw-r--r--crates/hir-def/src/nameres/tests/macros.rs384
-rw-r--r--crates/hir-def/src/nameres/tests/mod_resolution.rs264
-rw-r--r--crates/hir-def/src/nameres/tests/primitives.rs6
8 files changed, 757 insertions, 668 deletions
diff --git a/crates/hir-def/src/expr_store/tests/body/block.rs b/crates/hir-def/src/expr_store/tests/body/block.rs
index c7707378a5..e8334cd973 100644
--- a/crates/hir-def/src/expr_store/tests/body/block.rs
+++ b/crates/hir-def/src/expr_store/tests/body/block.rs
@@ -12,12 +12,12 @@ fn outer() {
}
"#,
expect![[r#"
- block scope
- inner: v
+ (block scope)
+ - inner : value
crate
- inner: t
- outer: v
+ - inner : type
+ - outer : value
"#]],
);
}
@@ -37,16 +37,16 @@ fn outer() {
}
"#,
expect![[r#"
- block scope
- CrateStruct: ti
- PlainStruct: ti vi
- SelfStruct: ti
- Struct: v
- SuperStruct: _
+ (block scope)
+ - CrateStruct : type (import)
+ - PlainStruct : type (import) value (import)
+ - SelfStruct : type (import)
+ - Struct : value
+ - SuperStruct : _
crate
- Struct: t
- outer: v
+ - Struct : type
+ - outer : value
"#]],
);
}
@@ -65,13 +65,13 @@ fn outer() {
}
"#,
expect![[r#"
- block scope
- imported: ti vi
- name: v
+ (block scope)
+ - imported : type (import) value (import)
+ - name : value
crate
- name: t
- outer: v
+ - name : type
+ - outer : value
"#]],
);
}
@@ -91,17 +91,17 @@ fn outer() {
}
"#,
expect![[r#"
- block scope
- inner1: ti
- inner2: v
- outer: vi
+ (block scope)
+ - inner1 : type (import)
+ - inner2 : value
+ - outer : value (import)
- block scope
- inner: v
- inner1: t
+ (block scope)
+ - inner : value
+ - inner1 : type
crate
- outer: v
+ - outer : value
"#]],
);
}
@@ -120,15 +120,15 @@ mod module {
struct Struct {}
"#,
expect![[r#"
- block scope
- Struct: ti
+ (block scope)
+ - Struct : type (import)
crate
- Struct: t
- module: t
+ - Struct : type
+ - module : type
crate::module
- f: v
+ - f : value
"#]],
);
}
@@ -152,24 +152,24 @@ fn outer() {
}
"#,
expect![[r#"
- block scope
- ResolveMe: ti
+ (block scope)
+ - ResolveMe : type (import)
- block scope
- m2: t
+ (block scope)
+ - m2 : type
- block scope::m2
- inner: v
+ (block scope)::m2
+ - inner : value
- block scope
- m: t
+ (block scope)
+ - m : type
- block scope::m
- ResolveMe: t
- middle: v
+ (block scope)::m
+ - ResolveMe : type
+ - middle : value
crate
- outer: v
+ - outer : value
"#]],
);
}
@@ -213,21 +213,21 @@ fn f() {
}
"#,
expect![[r#"
- block scope
- ResolveMe: ti
+ (block scope)
+ - ResolveMe : type (import)
- block scope
- h: v
+ (block scope)
+ - h : value
- block scope
- m: t
+ (block scope)
+ - m : type
- block scope::m
- ResolveMe: t
- g: v
+ (block scope)::m
+ - ResolveMe : type
+ - g : value
crate
- f: v
+ - f : value
"#]],
);
}
@@ -250,11 +250,12 @@ fn f() {
}
"#,
expect![[r#"
- block scope
- Hit: t
+ (block scope)
+ - Hit : type
crate
- f: v
+ - f : value
+ - (legacy) mark : macro!
"#]],
);
}
@@ -285,15 +286,15 @@ pub mod cov_mark {
}
"#,
expect![[r#"
- block scope
- Hit: t
+ (block scope)
+ - Hit : type
- block scope
- nested: v
+ (block scope)
+ - nested : value
crate
- cov_mark: ti
- f: v
+ - cov_mark : type (import)
+ - f : value
"#]],
);
}
@@ -318,16 +319,18 @@ fn main() {
}
"#,
expect![[r#"
- block scope
- module: t
+ (block scope)
+ - module : type
- block scope::module
- BarWorks: t v
- FooWorks: t v
+ (block scope)::module
+ - BarWorks : type value
+ - FooWorks : type value
crate
- foo: m
- main: v
+ - foo : macro!
+ - main : value
+ - (legacy) bar : macro!
+ - (legacy) foo : macro!
"#]],
);
}
@@ -354,14 +357,15 @@ fn f() {
}
"#,
expect![[r#"
- block scope
- Def: t
+ (block scope)
+ - Def : type
crate
- module: t
+ - module : type
crate::module
- f: v
+ - f : value
+ - (legacy) m : macro!
"#]],
)
}
@@ -380,16 +384,16 @@ fn main() {
}
"#,
expect![[r#"
- block scope
- Struct: t
- module: t
+ (block scope)
+ - Struct : type
+ - module : type
- block scope::module
- Struct: _
+ (block scope)::module
+ - Struct : _
- crate
- main: v
- "#]],
+ crate
+ - main : value
+ "#]],
);
}
@@ -408,16 +412,16 @@ mod m {
}
"#,
expect![[r#"
- block scope
- _: t
- Tr: t
+ (block scope)
+ - _ : type
+ - Tr : type
- crate
- m: t
+ crate
+ - m : type
- crate::m
- main: v
- "#]],
+ crate::m
+ - main : value
+ "#]],
);
}
@@ -444,11 +448,13 @@ fn foo() {
}
"#,
expect![[r#"
- block scope
- bar: v
+ (block scope)
+ - bar : value
crate
- foo: v
+ - foo : value
+ - (legacy) declare : macro!
+ - (legacy) inner_declare : macro!
"#]],
)
}
@@ -467,16 +473,16 @@ fn outer() {
}
"#,
expect![[r#"
- block scope
- name: _
- tests: t
+ (block scope)
+ - name : _
+ - tests : type
- block scope::tests
- name: _
- outer: vg
+ (block scope)::tests
+ - name : _
+ - outer : value (glob)
crate
- outer: v
+ - outer : value
"#]],
);
}
@@ -496,11 +502,12 @@ fn foo() {
}
"#,
expect![[r#"
- block scope
- inner: v
+ (block scope)
+ - inner : value
crate
- foo: v
+ - foo : value
+ - (legacy) mac : macro!
"#]],
)
}
@@ -517,12 +524,13 @@ fn f() {$0
};
"#,
expect![[r#"
- block scope
- BAR: v
- FOO: v
+ (block scope)
+ - BAR : value
+ - FOO : value
crate
- f: v
+ - f : value
+ - (legacy) foo : macro!
"#]],
)
}
@@ -543,14 +551,14 @@ fn main() {
pub struct S;
"#,
expect![[r#"
- block scope
- f: t
+ (block scope)
+ - f : type
- block scope::f
- S: ti vi
+ (block scope)::f
+ - S : type (import) value (import)
crate
- main: v
+ - main : value
"#]],
)
}
@@ -573,18 +581,18 @@ fn main() {
pub const S;
"#,
expect![[r#"
- block scope
- S: ti vi
- inner: v
+ (block scope)
+ - S : type (import) value (import)
+ - inner : value
- block scope
- core: t
+ (block scope)
+ - core : type
- block scope::core
- S: t v
+ (block scope)::core
+ - S : type value
crate
- main: v
+ - main : value
"#]],
)
}
diff --git a/crates/hir-def/src/item_scope.rs b/crates/hir-def/src/item_scope.rs
index 77ed664f44..51c42c995c 100644
--- a/crates/hir-def/src/item_scope.rs
+++ b/crates/hir-def/src/item_scope.rs
@@ -1,10 +1,10 @@
//! Describes items defined or visible (ie, imported) in a certain scope.
//! This is shared between modules and blocks.
-use std::sync::LazyLock;
+use std::{fmt, sync::LazyLock};
use base_db::Crate;
-use hir_expand::{AstId, MacroCallId, attrs::AttrId, db::ExpandDatabase, name::Name};
+use hir_expand::{AstId, MacroCallId, attrs::AttrId, name::Name};
use indexmap::map::Entry;
use itertools::Itertools;
use la_arena::Idx;
@@ -19,6 +19,7 @@ use crate::{
AdtId, BuiltinType, ConstId, ExternBlockId, ExternCrateId, FxIndexMap, HasModule, ImplId,
LocalModuleId, Lookup, MacroId, ModuleDefId, ModuleId, TraitId, UseId,
db::DefDatabase,
+ nameres::MacroSubNs,
per_ns::{Item, MacrosItem, PerNs, TypesItem, ValuesItem},
visibility::Visibility,
};
@@ -735,40 +736,47 @@ impl ItemScope {
}
}
- pub(crate) fn dump(&self, db: &dyn ExpandDatabase, buf: &mut String) {
+ pub(crate) fn dump(&self, db: &dyn DefDatabase, buf: &mut String) {
let mut entries: Vec<_> = self.resolutions().collect();
entries.sort_by_key(|(name, _)| name.clone());
+ let print_macro_sub_ns =
+ |buf: &mut String, macro_id: MacroId| match MacroSubNs::from_id(db, macro_id) {
+ MacroSubNs::Bang => buf.push('!'),
+ MacroSubNs::Attr => buf.push('#'),
+ };
+
for (name, def) in entries {
- format_to!(
- buf,
- "{}:",
- name.map_or("_".to_owned(), |name| name.display(db, Edition::LATEST).to_string())
- );
+ let display_name: &dyn fmt::Display = match &name {
+ Some(name) => &name.display(db, Edition::LATEST),
+ None => &"_",
+ };
+ format_to!(buf, "- {display_name} :");
if let Some(Item { import, .. }) = def.types {
- buf.push_str(" t");
+ buf.push_str(" type");
match import {
- Some(ImportOrExternCrate::Import(_)) => buf.push('i'),
- Some(ImportOrExternCrate::Glob(_)) => buf.push('g'),
- Some(ImportOrExternCrate::ExternCrate(_)) => buf.push('e'),
+ Some(ImportOrExternCrate::Import(_)) => buf.push_str(" (import)"),
+ Some(ImportOrExternCrate::Glob(_)) => buf.push_str(" (glob)"),
+ Some(ImportOrExternCrate::ExternCrate(_)) => buf.push_str(" (extern)"),
None => (),
}
}
if let Some(Item { import, .. }) = def.values {
- buf.push_str(" v");
+ buf.push_str(" value");
match import {
- Some(ImportOrGlob::Import(_)) => buf.push('i'),
- Some(ImportOrGlob::Glob(_)) => buf.push('g'),
+ Some(ImportOrGlob::Import(_)) => buf.push_str(" (import)"),
+ Some(ImportOrGlob::Glob(_)) => buf.push_str(" (glob)"),
None => (),
}
}
- if let Some(Item { import, .. }) = def.macros {
- buf.push_str(" m");
+ if let Some(Item { def: macro_id, import, .. }) = def.macros {
+ buf.push_str(" macro");
+ print_macro_sub_ns(buf, macro_id);
match import {
- Some(ImportOrExternCrate::Import(_)) => buf.push('i'),
- Some(ImportOrExternCrate::Glob(_)) => buf.push('g'),
- Some(ImportOrExternCrate::ExternCrate(_)) => buf.push('e'),
+ Some(ImportOrExternCrate::Import(_)) => buf.push_str(" (import)"),
+ Some(ImportOrExternCrate::Glob(_)) => buf.push_str(" (glob)"),
+ Some(ImportOrExternCrate::ExternCrate(_)) => buf.push_str(" (extern)"),
None => (),
}
}
@@ -778,6 +786,21 @@ impl ItemScope {
buf.push('\n');
}
+
+ // Also dump legacy-textual-scope macros visible at the _end_ of the scope.
+ //
+ // For tests involving a cursor position, this might include macros that
+ // are _not_ visible at the cursor position.
+ let mut legacy_macros = self.legacy_macros().collect::<Vec<_>>();
+ legacy_macros.sort_by(|(a, _), (b, _)| Ord::cmp(a, b));
+ for (name, macros) in legacy_macros {
+ format_to!(buf, "- (legacy) {} :", name.display(db, Edition::LATEST));
+ for &macro_id in macros {
+ buf.push_str(" macro");
+ print_macro_sub_ns(buf, macro_id);
+ }
+ buf.push('\n');
+ }
}
pub(crate) fn shrink_to_fit(&mut self) {
diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs
index 7d5e627964..f44187ec59 100644
--- a/crates/hir-def/src/nameres.rs
+++ b/crates/hir-def/src/nameres.rs
@@ -602,7 +602,7 @@ impl DefMap {
let mut arc;
let mut current_map = self;
while let Some(block) = current_map.block {
- go(&mut buf, db, current_map, "block scope", Self::ROOT);
+ go(&mut buf, db, current_map, "(block scope)", Self::ROOT);
buf.push('\n');
arc = block.parent.def_map(db, self.krate);
current_map = arc;
@@ -814,7 +814,7 @@ pub enum MacroSubNs {
}
impl MacroSubNs {
- fn from_id(db: &dyn DefDatabase, macro_id: MacroId) -> Self {
+ pub(crate) fn from_id(db: &dyn DefDatabase, macro_id: MacroId) -> Self {
let expander = match macro_id {
MacroId::Macro2Id(it) => it.lookup(db).expander,
MacroId::MacroRulesId(it) => it.lookup(db).expander,
diff --git a/crates/hir-def/src/nameres/tests.rs b/crates/hir-def/src/nameres/tests.rs
index 4a7974c4fa..23d60d58f0 100644
--- a/crates/hir-def/src/nameres/tests.rs
+++ b/crates/hir-def/src/nameres/tests.rs
@@ -61,22 +61,22 @@ extern {
"#,
expect![[r#"
crate
- E: _
- S: t v
- V: _
- foo: t
+ - E : _
+ - S : type value
+ - V : _
+ - foo : type
crate::foo
- bar: t
- f: v
+ - bar : type
+ - f : value
crate::foo::bar
- Baz: t v
- E: t
- EXT: v
- Ext: t
- U: t
- ext: v
+ - Baz : type value
+ - E : type
+ - EXT : value
+ - Ext : type
+ - U : type
+ - ext : value
"#]],
);
}
@@ -97,19 +97,19 @@ mod a {
"#,
expect![[r#"
crate
- a: t
+ - a : type
crate::a
- A: v
- b: t
+ - A : value
+ - b : type
crate::a::b
- B: v
- c: t
+ - B : value
+ - c : type
crate::a::b::c
- A: vg
- b: tg
+ - A : value (glob)
+ - b : type (glob)
"#]],
);
}
@@ -125,10 +125,10 @@ mod m {
"#,
expect![[r#"
crate
- m: t
+ - m : type
crate::m
- z: t v
+ - z : type value
crate::m::z
"#]],
@@ -151,8 +151,8 @@ use crate;
"#,
expect![[r#"
crate
- S: t v
- foo: t
+ - S : type value
+ - foo : type
crate::foo
"#]],
@@ -172,11 +172,11 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Foo: ti vi
- foo: t
+ - Foo : type (import) value (import)
+ - foo : type
crate::foo
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -198,16 +198,16 @@ pub enum Quux {};
"#,
expect![[r#"
crate
- Baz: ti vi
- Quux: ti
- foo: t
+ - Baz : type (import) value (import)
+ - Quux : type (import)
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
- Quux: t
+ - Baz : type value
+ - Quux : type
"#]],
);
}
@@ -229,15 +229,15 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: ti vi
- foo: t
+ - Baz : type (import) value (import)
+ - foo : type
crate::foo
- Baz: ti vi
- bar: t
+ - Baz : type (import) value (import)
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -261,8 +261,8 @@ pub enum Foo { Bar, Baz }
"#,
expect![[r#"
crate
- Bar: tg vg
- Baz: tg vg
+ - Bar : type (glob) value (glob)
+ - Baz : type (glob) value (glob)
"#]],
);
}
@@ -277,8 +277,8 @@ use self::E::V;
"#,
expect![[r#"
crate
- E: t
- V: ti vi
+ - E : type
+ - V : type (import) value (import)
"#]],
);
}
@@ -303,15 +303,15 @@ pub struct FromLib;
"#,
expect![[r#"
crate
- bar: t
- foo: t
+ - bar : type
+ - foo : type
crate::bar
- Bar: t v
+ - Bar : type value
crate::foo
- Bar: _
- FromLib: ti vi
+ - Bar : _
+ - FromLib : type (import) value (import)
"#]],
);
}
@@ -332,14 +332,14 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: ti
- foo: t
+ - Baz : type (import)
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -356,7 +356,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: ti vi
+ - Baz : type (import) value (import)
"#]],
);
}
@@ -378,14 +378,14 @@ pub struct Arc;
"#,
expect![[r#"
crate
- alloc: t
- alloc_crate: te
- sync: t
+ - alloc : type
+ - alloc_crate : type (extern)
+ - sync : type
crate::alloc
crate::sync
- Arc: ti vi
+ - Arc : type (import) value (import)
"#]],
);
}
@@ -426,12 +426,12 @@ pub struct NotExported;
"#,
expect![[r#"
crate
- Exported: tg vg
- PublicItem: tg vg
- allowed_reexport: tg
- exported: tg
- not_allowed_reexport1: _
- not_allowed_reexport2: _
+ - Exported : type (glob) value (glob)
+ - PublicItem : type (glob) value (glob)
+ - allowed_reexport : type (glob)
+ - exported : type (glob)
+ - not_allowed_reexport1 : _
+ - not_allowed_reexport2 : _
"#]],
);
}
@@ -453,14 +453,14 @@ pub struct Arc;
"#,
expect![[r#"
crate
- alloc: t
- alloc_crate: te
- sync: t
+ - alloc : type
+ - alloc_crate : type (extern)
+ - sync : type
crate::alloc
crate::sync
- Arc: ti vi
+ - Arc : type (import) value (import)
"#]],
);
}
@@ -475,7 +475,7 @@ extern crate self as bla;
"#,
expect![[r#"
crate
- bla: te
+ - bla : type (extern)
"#]],
);
}
@@ -496,7 +496,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: ti vi
+ - Baz : type (import) value (import)
"#]],
);
}
@@ -514,8 +514,8 @@ pub struct Bar;
"#,
expect![[r#"
crate
- Bar: ti vi
- foo: v
+ - Bar : type (import) value (import)
+ - foo : value
"#]],
);
}
@@ -542,7 +542,7 @@ fn no_std_prelude() {
"#,
expect![[r#"
crate
- Rust: ti vi
+ - Rust : type (import) value (import)
"#]],
);
}
@@ -566,7 +566,7 @@ fn edition_specific_preludes() {
"#,
expect![[r#"
crate
- Rust2018: ti vi
+ - Rust2018 : type (import) value (import)
"#]],
);
check(
@@ -583,7 +583,7 @@ fn edition_specific_preludes() {
"#,
expect![[r#"
crate
- Rust2021: ti vi
+ - Rust2021 : type (import) value (import)
"#]],
);
}
@@ -612,8 +612,8 @@ pub mod prelude {
"#,
expect![[r#"
crate
- Bar: ti vi
- Foo: ti vi
+ - Bar : type (import) value (import)
+ - Foo : type (import) value (import)
"#]],
);
}
@@ -639,9 +639,9 @@ pub mod prelude {
"#,
expect![[r#"
crate
- Bar: ti vi
- Baz: _
- Foo: _
+ - Bar : type (import) value (import)
+ - Baz : _
+ - Foo : _
"#]],
);
}
@@ -667,9 +667,9 @@ pub mod prelude {
"#,
expect![[r#"
crate
- Bar: _
- Baz: ti vi
- Foo: ti vi
+ - Bar : _
+ - Baz : type (import) value (import)
+ - Foo : type (import) value (import)
"#]],
);
}
@@ -692,15 +692,15 @@ mod b {
"#,
expect![[r#"
crate
- T: ti vi
- a: t
- b: t
+ - T : type (import) value (import)
+ - a : type
+ - b : type
crate::a
- T: t vg
+ - T : type value (glob)
crate::b
- T: v
+ - T : value
"#]],
);
}
@@ -720,13 +720,13 @@ mod tr {
"#,
expect![[r#"
crate
- _: t
- _: t
- tr: t
+ - _ : type
+ - _ : type
+ - tr : type
crate::tr
- Tr: t
- Tr2: t
+ - Tr : type
+ - Tr2 : type
"#]],
);
}
@@ -748,17 +748,17 @@ use crate::reex::*;
"#,
expect![[r#"
crate
- _: t
- reex: t
- tr: t
+ - _ : type
+ - reex : type
+ - tr : type
crate::reex
- _: t
- _: t
+ - _ : type
+ - _ : type
crate::tr
- PrivTr: t
- PubTr: t
+ - PrivTr : type
+ - PubTr : type
"#]],
);
}
@@ -781,7 +781,7 @@ mod tr {
"#,
expect![[r#"
crate
- _: t
+ - _ : type
"#]],
);
}
@@ -800,12 +800,12 @@ use crate::m::{Struct as _, Enum as _, CONST as _};
"#,
expect![[r#"
crate
- m: t
+ - m : type
crate::m
- CONST: v
- Enum: t
- Struct: t v
+ - CONST : value
+ - Enum : type
+ - Struct : type value
"#]],
);
}
@@ -825,12 +825,12 @@ mod tr {
"#,
expect![[r#"
crate
- _: t
- Tr: t v
- tr: t
+ - _ : type
+ - Tr : type value
+ - tr : type
crate::tr
- Tr: t
+ - Tr : type
"#]],
);
}
@@ -864,9 +864,9 @@ fn bar() {}
"#,
expect![[r#"
crate
- bar: v
- baz: vi
- foo: ti
+ - bar : value
+ - baz : value (import)
+ - foo : type (import)
"#]],
);
}
@@ -885,11 +885,11 @@ use self::m::S::{self};
"#,
expect![[r#"
crate
- S: ti
- m: t
+ - S : type (import)
+ - m : type
crate::m
- S: t v m
+ - S : type value macro!
"#]],
);
}
@@ -909,8 +909,8 @@ pub const settings: () = ();
"#,
expect![[r#"
crate
- Settings: ti vi
- settings: vi
+ - Settings : type (import) value (import)
+ - settings : value (import)
"#]],
)
}
@@ -926,7 +926,7 @@ pub struct Struct;
"#,
expect![[r#"
crate
- Struct: _
+ - Struct : _
"#]],
);
check(
@@ -939,8 +939,8 @@ pub struct Struct;
"#,
expect![[r#"
crate
- Struct: ti vi
- dep: te
+ - Struct : type (import) value (import)
+ - dep : type (extern)
"#]],
);
}
@@ -964,18 +964,18 @@ use some_module::unknown_func;
"#,
expect![[r#"
crate
- other_module: t
- some_module: t
- unknown_func: vi
+ - other_module : type
+ - some_module : type
+ - unknown_func : value (import)
crate::other_module
- some_submodule: t
+ - some_submodule : type
crate::other_module::some_submodule
- unknown_func: vi
+ - unknown_func : value (import)
crate::some_module
- unknown_func: v
+ - unknown_func : value
"#]],
)
}
diff --git a/crates/hir-def/src/nameres/tests/globs.rs b/crates/hir-def/src/nameres/tests/globs.rs
index ddb9d4a134..62887e2941 100644
--- a/crates/hir-def/src/nameres/tests/globs.rs
+++ b/crates/hir-def/src/nameres/tests/globs.rs
@@ -18,18 +18,18 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: tg vg
- Foo: tg vg
- bar: tg
- foo: t
+ - Baz : type (glob) value (glob)
+ - Foo : type (glob) value (glob)
+ - bar : type (glob)
+ - foo : type
crate::foo
- Baz: ti vi
- Foo: t v
- bar: t
+ - Baz : type (import) value (import)
+ - Foo : type value
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -53,20 +53,20 @@ pub use super::*;
"#,
expect![[r#"
crate
- Baz: tg vg
- Foo: tg vg
- bar: tg
- foo: t
+ - Baz : type (glob) value (glob)
+ - Foo : type (glob) value (glob)
+ - bar : type (glob)
+ - foo : type
crate::foo
- Baz: tg vg
- Foo: t v
- bar: t
+ - Baz : type (glob) value (glob)
+ - Foo : type value
+ - bar : type
crate::foo::bar
- Baz: t v
- Foo: tg vg
- bar: tg
+ - Baz : type value
+ - Foo : type (glob) value (glob)
+ - bar : type (glob)
"#]],
);
}
@@ -91,20 +91,20 @@ pub use super::*;
",
expect![[r#"
crate
- Baz: tg vg
- bar: tg
- foo: t
+ - Baz : type (glob) value (glob)
+ - bar : type (glob)
+ - foo : type
crate::foo
- Baz: tg vg
- PrivateStructFoo: t v
- bar: t
+ - Baz : type (glob) value (glob)
+ - PrivateStructFoo : type value
+ - bar : type
crate::foo::bar
- Baz: t v
- PrivateStructBar: t v
- PrivateStructFoo: tg vg
- bar: tg
+ - Baz : type value
+ - PrivateStructBar : type value
+ - PrivateStructFoo : type (glob) value (glob)
+ - bar : type (glob)
"#]],
);
}
@@ -130,19 +130,19 @@ pub(crate) struct PubCrateStruct;
",
expect![[r#"
crate
- Foo: tg
- PubCrateStruct: tg vg
- bar: tg
- foo: t
+ - Foo : type (glob)
+ - PubCrateStruct : type (glob) value (glob)
+ - bar : type (glob)
+ - foo : type
crate::foo
- Foo: t v
- bar: t
+ - Foo : type value
+ - bar : type
crate::foo::bar
- PrivateBar: t v
- PrivateBaz: t v
- PubCrateStruct: t v
+ - PrivateBar : type value
+ - PrivateBaz : type value
+ - PubCrateStruct : type value
"#]],
);
}
@@ -160,7 +160,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: tg vg
+ - Baz : type (glob) value (glob)
"#]],
);
}
@@ -178,7 +178,7 @@ struct Foo;
"#,
expect![[r#"
crate
- Baz: tg vg
+ - Baz : type (glob) value (glob)
"#]],
);
}
@@ -193,9 +193,9 @@ use self::Foo::*;
"#,
expect![[r#"
crate
- Bar: tg vg
- Baz: tg vg
- Foo: t
+ - Bar : type (glob) value (glob)
+ - Baz : type (glob) value (glob)
+ - Foo : type
"#]],
);
}
@@ -210,9 +210,9 @@ use self::Foo::{*};
"#,
expect![[r#"
crate
- Bar: tg vg
- Baz: tg vg
- Foo: t
+ - Bar : type (glob) value (glob)
+ - Baz : type (glob) value (glob)
+ - Foo : type
"#]],
);
}
@@ -237,22 +237,22 @@ pub mod baz { pub struct Bar; }
"#,
expect![[r#"
crate
- Bar: ti vi
- bar: t
- baz: ti
- foo: t
+ - Bar : type (import) value (import)
+ - bar : type
+ - baz : type (import)
+ - foo : type
crate::bar
- baz: t
+ - baz : type
crate::bar::baz
- Bar: t v
+ - Bar : type value
crate::foo
- baz: t
+ - baz : type
crate::foo::baz
- Foo: t v
+ - Foo : type value
"#]],
);
}
@@ -276,22 +276,22 @@ pub mod baz { pub struct Bar; }
"#,
expect![[r#"
crate
- Bar: ti vi
- bar: t
- baz: ti
- foo: t
+ - Bar : type (import) value (import)
+ - bar : type
+ - baz : type (import)
+ - foo : type
crate::bar
- baz: t
+ - baz : type
crate::bar::baz
- Bar: t v
+ - Bar : type value
crate::foo
- baz: t
+ - baz : type
crate::foo::baz
- Foo: t v
+ - Foo : type value
"#]],
);
}
@@ -311,29 +311,29 @@ mod d {
"#,
expect![[r#"
crate
- a: t
- b: t
- c: t
- d: t
+ - a : type
+ - b : type
+ - c : type
+ - d : type
crate::a
- foo: t
+ - foo : type
crate::a::foo
- X: t v
+ - X : type value
crate::b
- foo: ti
+ - foo : type (import)
crate::c
- foo: t
+ - foo : type
crate::c::foo
- Y: t v
+ - Y : type value
crate::d
- Y: ti vi
- foo: ti
+ - Y : type (import) value (import)
+ - foo : type (import)
"#]],
);
}
@@ -355,15 +355,15 @@ use event::Event;
"#,
expect![[r#"
crate
- Event: ti
- event: t
+ - Event : type (import)
+ - event : type
crate::event
- Event: t vg
- serenity: t
+ - Event : type value (glob)
+ - serenity : type
crate::event::serenity
- Event: v
+ - Event : value
"#]],
);
}
@@ -388,27 +388,27 @@ use reexport::*;
"#,
expect![[r#"
crate
- Trait: tg
- defs: t
- function: vg
- makro: mg
- reexport: t
+ - Trait : type (glob)
+ - defs : type
+ - function : value (glob)
+ - makro : macro! (glob)
+ - reexport : type
crate::defs
- Trait: t
- function: v
- makro: m
+ - Trait : type
+ - function : value
+ - makro : macro!
crate::reexport
- Trait: tg
- function: vg
- inner: t
- makro: mg
+ - Trait : type (glob)
+ - function : value (glob)
+ - inner : type
+ - makro : macro! (glob)
crate::reexport::inner
- Trait: ti
- function: vi
- makro: mi
+ - Trait : type (import)
+ - function : value (import)
+ - makro : macro! (import)
"#]],
);
}
@@ -435,19 +435,19 @@ mod glob_target {
"#,
expect![[r#"
crate
- glob_target: t
- outer: t
+ - glob_target : type
+ - outer : type
crate::glob_target
- ShouldBePrivate: t v
+ - ShouldBePrivate : type value
crate::outer
- ShouldBePrivate: tg vg
- inner_superglob: t
+ - ShouldBePrivate : type (glob) value (glob)
+ - inner_superglob : type
crate::outer::inner_superglob
- ShouldBePrivate: tg vg
- inner_superglob: tg
+ - ShouldBePrivate : type (glob) value (glob)
+ - inner_superglob : type (glob)
"#]],
);
}
@@ -473,20 +473,20 @@ use reexport_2::*;
"#,
expect![[r#"
crate
- Placeholder: tg vg
- libs: t
- reexport_1: tg
- reexport_2: t
+ - Placeholder : type (glob) value (glob)
+ - libs : type
+ - reexport_1 : type (glob)
+ - reexport_2 : type
crate::libs
- Placeholder: t v
+ - Placeholder : type value
crate::reexport_2
- Placeholder: tg vg
- reexport_1: t
+ - Placeholder : type (glob) value (glob)
+ - reexport_1 : type
crate::reexport_2::reexport_1
- Placeholder: tg vg
+ - Placeholder : type (glob) value (glob)
"#]],
);
}
diff --git a/crates/hir-def/src/nameres/tests/macros.rs b/crates/hir-def/src/nameres/tests/macros.rs
index 3cba88ec2f..43b6e12e13 100644
--- a/crates/hir-def/src/nameres/tests/macros.rs
+++ b/crates/hir-def/src/nameres/tests/macros.rs
@@ -23,12 +23,14 @@ structs!(Bar, Baz);
"#,
expect![[r#"
crate
- Foo: t
- nested: t
+ - Foo : type
+ - nested : type
+ - (legacy) structs : macro!
crate::nested
- Bar: t
- Baz: t
+ - Bar : type
+ - Baz : type
+ - (legacy) structs : macro!
"#]],
);
}
@@ -53,20 +55,25 @@ struct Y;
"#,
expect![[r#"
crate
- m: t
- n1: t
+ - m : type
+ - n1 : type
+ - (legacy) m : macro!
crate::m
- n3: t
+ - n3 : type
+ - (legacy) m : macro!
crate::m::n3
- Y: t v
+ - Y : type value
+ - (legacy) m : macro!
crate::n1
- n2: t
+ - n2 : type
+ - (legacy) m : macro!
crate::n1::n2
- X: t v
+ - X : type value
+ - (legacy) m : macro!
"#]],
);
}
@@ -92,14 +99,14 @@ macro_rules! structs {
"#,
expect![[r#"
crate
- Bar: t
- Foo: t
- bar: t
+ - Bar : type
+ - Foo : type
+ - bar : type
crate::bar
- Bar: tg
- Foo: tg
- bar: tg
+ - Bar : type (glob)
+ - Foo : type (glob)
+ - bar : type (glob)
"#]],
);
}
@@ -125,14 +132,14 @@ macro_rules! structs {
"#,
expect![[r#"
crate
- Bar: t
- Foo: t
- bar: t
+ - Bar : type
+ - Foo : type
+ - bar : type
crate::bar
- Bar: tg
- Foo: tg
- bar: tg
+ - Bar : type (glob)
+ - Foo : type (glob)
+ - bar : type (glob)
"#]],
);
}
@@ -164,14 +171,14 @@ macro_rules! inner {
"#,
expect![[r#"
crate
- Bar: t
- Foo: t
- bar: t
+ - Bar : type
+ - Foo : type
+ - bar : type
crate::bar
- Bar: tg
- Foo: tg
- bar: tg
+ - Bar : type (glob)
+ - Foo : type (glob)
+ - bar : type (glob)
"#]],
);
}
@@ -206,9 +213,10 @@ macro_rules! bar {
"#,
expect![[r#"
crate
- Foo: t
- bar: mi
- foo: mi
+ - Foo : type
+ - bar : macro! (import)
+ - foo : macro! (import)
+ - (legacy) baz : macro!
"#]],
);
}
@@ -252,13 +260,13 @@ mod priv_mod {
"#,
expect![[r#"
crate
- Bar: t v
- Foo: t v
- bar: t
- foo: te
+ - Bar : type value
+ - Foo : type value
+ - bar : type
+ - foo : type (extern)
crate::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -316,15 +324,15 @@ macro_rules! baz3 { () => { struct OkBaz3; } }
"#,
expect![[r#"
crate
- OkBar1: t v
- OkBar2: t v
- OkBar3: t v
- OkBaz1: t v
- OkBaz2: t v
- OkBaz3: t v
- all: te
- empty: te
- multiple: te
+ - OkBar1 : type value
+ - OkBar2 : type value
+ - OkBar3 : type value
+ - OkBaz1 : type value
+ - OkBaz2 : type value
+ - OkBaz3 : type value
+ - all : type (extern)
+ - empty : type (extern)
+ - multiple : type (extern)
"#]],
);
}
@@ -370,13 +378,13 @@ macro_rules! structs_outside {
"#,
expect![[r#"
crate
- Bar: t v
- Foo: t v
- Out: t v
- bar: t
+ - Bar : type value
+ - Foo : type value
+ - Out : type value
+ - bar : type
crate::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -398,9 +406,10 @@ mod prelude {
"#,
expect![[r#"
crate
- prelude: t
+ - prelude : type
crate::prelude
+ - (legacy) declare_mod : macro!
"#]],
);
}
@@ -419,7 +428,8 @@ macro_rules! m {
"#,
expect![[r#"
crate
- S: t v
+ - S : type value
+ - (legacy) m : macro!
"#]],
);
// FIXME: should not expand. legacy macro scoping is not implemented.
@@ -499,40 +509,55 @@ macro_rules! baz {
"#,
expect![[r#"
crate
- NotFoundBefore: t v
- Ok: t v
- OkAfter: t v
- OkShadowStop: t v
- m1: t
- m2: t
- m3: t
- m5: t
- m7: t
- ok_double_macro_use_shadow: v
+ - NotFoundBefore : type value
+ - Ok : type value
+ - OkAfter : type value
+ - OkShadowStop : type value
+ - m1 : type
+ - m2 : type
+ - m3 : type
+ - m5 : type
+ - m7 : type
+ - ok_double_macro_use_shadow : value
+ - (legacy) baz : macro!
+ - (legacy) foo : macro! macro! macro!
crate::m1
+ - (legacy) bar : macro!
crate::m2
crate::m3
- OkAfterInside: t v
- OkMacroUse: t v
- OkMacroUseInner: t v
- m4: t
- m5: t
- ok_shadow: v
+ - OkAfterInside : type value
+ - OkMacroUse : type value
+ - OkMacroUseInner : type value
+ - m4 : type
+ - m5 : type
+ - ok_shadow : value
+ - (legacy) bar : macro! macro!
+ - (legacy) baz : macro!
+ - (legacy) foo : macro! macro! macro! macro!
crate::m3::m4
- ok_shadow_deep: v
+ - ok_shadow_deep : value
+ - (legacy) bar : macro!
+ - (legacy) foo : macro! macro!
crate::m3::m5
+ - (legacy) bar : macro!
+ - (legacy) baz : macro!
+ - (legacy) foo : macro! macro! macro!
crate::m5
- m6: t
+ - m6 : type
+ - (legacy) foo : macro! macro!
crate::m5::m6
+ - (legacy) foo : macro! macro!
crate::m7
+ - (legacy) baz : macro!
+ - (legacy) foo : macro! macro!
"#]],
);
// FIXME: should not see `NotFoundBefore`
@@ -555,9 +580,10 @@ fn baz() {}
"#,
expect![[r#"
crate
- bar: ti mi
- baz: ti v mi
- foo: t m
+ - bar : type (import) macro! (import)
+ - baz : type (import) value macro! (import)
+ - foo : type macro!
+ - (legacy) foo : macro!
"#]],
);
}
@@ -585,9 +611,9 @@ mod m {
"#,
expect![[r#"
crate
- Alias: t v
- Direct: t v
- foo: te
+ - Alias : type value
+ - Direct : type value
+ - foo : type (extern)
"#]],
);
}
@@ -623,19 +649,22 @@ mod m {
"#,
expect![[r#"
crate
- OkAliasCrate: t v
- OkAliasPlain: t v
- OkAliasSuper: t v
- OkCrate: t v
- OkPlain: t v
- bar: m
- m: t
+ - OkAliasCrate : type value
+ - OkAliasPlain : type value
+ - OkAliasSuper : type value
+ - OkCrate : type value
+ - OkPlain : type value
+ - bar : macro!
+ - m : type
+ - (legacy) foo : macro!
crate::m
- alias1: mi
- alias2: mi
- alias3: mi
- not_found: _
+ - alias1 : macro! (import)
+ - alias2 : macro! (import)
+ - alias3 : macro! (import)
+ - not_found : _
+ - (legacy) bar : macro!
+ - (legacy) foo : macro!
"#]],
);
}
@@ -686,14 +715,16 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Bar: ti vi
- Baz: ti vi
- Foo: t v
- FooSelf: ti vi
- foo: te
- m: t
+ - Bar : type (import) value (import)
+ - Baz : type (import) value (import)
+ - Foo : type value
+ - FooSelf : type (import) value (import)
+ - foo : type (extern)
+ - m : type
+ - (legacy) current : macro!
crate::m
+ - (legacy) current : macro!
"#]],
);
}
@@ -729,7 +760,7 @@ pub struct bar;
"#,
expect![[r#"
crate
- bar: ti vi
+ - bar : type (import) value (import)
"#]],
);
}
@@ -794,7 +825,7 @@ pub trait Clone {}
"#,
expect![[r#"
crate
- Clone: tg mg
+ - Clone : type (glob) macro# (glob)
"#]],
);
}
@@ -842,11 +873,11 @@ fn unresolved_attributes_fall_back_track_per_file_moditems() {
"#,
expect![[r#"
crate
- Foo: t v
- submod: t
+ - Foo : type value
+ - submod : type
crate::submod
- Bar: t v
+ - Bar : type value
"#]],
);
}
@@ -863,9 +894,9 @@ extern "C" {
}
"#,
expect![[r#"
- crate
- f: v
- "#]],
+ crate
+ - f : value
+ "#]],
);
}
@@ -883,7 +914,8 @@ extern {
"#,
expect![[r#"
crate
- S: v
+ - S : value
+ - (legacy) m : macro!
"#]],
);
}
@@ -909,8 +941,8 @@ fn derive() {}
"#,
expect![[r#"
crate
- S: t v
- derive: m
+ - S : type value
+ - derive : macro#
"#]],
);
}
@@ -932,7 +964,7 @@ enum E {
"#,
expect![[r#"
crate
- E: t
+ - E : type
"#]],
);
}
@@ -947,7 +979,7 @@ struct S;
"#,
expect![[r#"
crate
- S: t v
+ - S : type value
"#]],
);
}
@@ -975,6 +1007,8 @@ b! { static = #[] ();}
"#,
expect![[r#"
crate
+ - (legacy) a : macro!
+ - (legacy) b : macro!
"#]],
);
}
@@ -995,7 +1029,9 @@ indirect_macro!();
"#,
expect![[r#"
crate
- S: t
+ - S : type
+ - (legacy) indirect_macro : macro!
+ - (legacy) item : macro!
"#]],
);
}
@@ -1029,13 +1065,13 @@ pub fn derive_macro_2(_item: TokenStream) -> TokenStream {
"#,
expect![[r#"
crate
- AnotherTrait: m
- DummyTrait: m
- TokenStream: t v
- attribute_macro: v m
- derive_macro: v
- derive_macro_2: v
- function_like_macro: v m
+ - AnotherTrait : macro#
+ - DummyTrait : macro#
+ - TokenStream : type value
+ - attribute_macro : value macro#
+ - derive_macro : value
+ - derive_macro_2 : value
+ - function_like_macro : value macro!
"#]],
);
}
@@ -1075,9 +1111,9 @@ macro_rules! mbe {
"#,
expect![[r#"
crate
- DummyTrait: mg
- attribute_macro: mg
- function_like_macro: mg
+ - DummyTrait : macro# (glob)
+ - attribute_macro : macro# (glob)
+ - function_like_macro : macro! (glob)
"#]],
);
}
@@ -1119,8 +1155,8 @@ structs!(Foo);
"#,
expect![[r#"
crate
- Foo: t
- structs: m
+ - Foo : type
+ - structs : macro!
"#]],
);
}
@@ -1143,7 +1179,7 @@ pub mod prelude {
"#,
expect![[r#"
crate
- S: t v
+ - S : type value
"#]],
)
}
@@ -1161,6 +1197,7 @@ m!(
"#,
expect![[r#"
crate
+ - (legacy) m : macro!
"#]],
)
}
@@ -1193,12 +1230,15 @@ struct A;
struct B;
"#,
expect![[r#"
- crate
- A: t v
- B: t v
- inner_a: m
- inner_b: m
- "#]],
+ crate
+ - A : type value
+ - B : type value
+ - inner_a : macro!
+ - inner_b : macro!
+ - (legacy) include : macro!
+ - (legacy) inner_a : macro!
+ - (legacy) inner_b : macro!
+ "#]],
);
}
@@ -1227,8 +1267,11 @@ struct A;
"#,
expect![[r#"
crate
- A: t v
- inner: m
+ - A : type value
+ - inner : macro!
+ - (legacy) include : macro!
+ - (legacy) inner : macro!
+ - (legacy) m : macro!
"#]],
);
// eager -> MBE -> $crate::mbe
@@ -1256,8 +1299,11 @@ struct A;
"#,
expect![[r#"
crate
- A: t v
- inner: m
+ - A : type value
+ - inner : macro!
+ - (legacy) include : macro!
+ - (legacy) inner : macro!
+ - (legacy) n : macro!
"#]],
);
}
@@ -1292,20 +1338,20 @@ pub mod ip_address {
"#,
expect![[r#"
crate
- company_name: t
+ - company_name : type
crate::company_name
- network: t
+ - network : type
crate::company_name::network
- v1: t
+ - v1 : type
crate::company_name::network::v1
- IpAddress: t
- ip_address: t
+ - IpAddress : type
+ - ip_address : type
crate::company_name::network::v1::ip_address
- IpType: t
+ - IpType : type
"#]],
);
}
@@ -1338,20 +1384,20 @@ pub mod ip_address {
"#,
expect![[r#"
crate
- company_name: t
+ - company_name : type
crate::company_name
- network: t
+ - network : type
crate::company_name::network
- v1: t
+ - v1 : type
crate::company_name::network::v1
- IpAddress: t
- ip_address: t
+ - IpAddress : type
+ - ip_address : type
crate::company_name::network::v1::ip_address
- IpType: t
+ - IpType : type
"#]],
);
}
@@ -1392,30 +1438,38 @@ pub struct Url {}
"#,
expect![[r#"
crate
- nested: t
+ - nested : type
+ - (legacy) include : macro!
crate::nested
- company_name: t
- different_company: t
- util: t
+ - company_name : type
+ - different_company : type
+ - util : type
+ - (legacy) include : macro!
crate::nested::company_name
- network: t
+ - network : type
+ - (legacy) include : macro!
crate::nested::company_name::network
- v1: t
+ - v1 : type
+ - (legacy) include : macro!
crate::nested::company_name::network::v1
- IpAddress: t
+ - IpAddress : type
+ - (legacy) include : macro!
crate::nested::different_company
- network: t
+ - network : type
+ - (legacy) include : macro!
crate::nested::different_company::network
- Url: t
+ - Url : type
+ - (legacy) include : macro!
crate::nested::util
- Helper: t
+ - Helper : type
+ - (legacy) include : macro!
"#]],
);
}
@@ -1500,11 +1554,11 @@ pub mod prelude {
"#,
expect![[r#"
crate
- Ok: t v
- bar: m
- dep: te
- foo: m
- ok: v
+ - Ok : type value
+ - bar : macro!
+ - dep : type (extern)
+ - foo : macro!
+ - ok : value
"#]],
);
}
@@ -1533,11 +1587,13 @@ macro_rules! mk_foo {
"#,
expect![[r#"
crate
- a: t
- lib: te
+ - a : type
+ - lib : type (extern)
+ - (legacy) foo : macro!
crate::a
- Ok: t v
+ - Ok : type value
+ - (legacy) foo : macro!
"#]],
);
}
@@ -1588,10 +1644,10 @@ pub mod prelude {
"#,
expect![[r#"
crate
- Ok: t v
- bar: mi
- foo: mi
- ok: v
+ - Ok : type value
+ - bar : macro# (import)
+ - foo : macro# (import)
+ - ok : value
"#]],
);
}
diff --git a/crates/hir-def/src/nameres/tests/mod_resolution.rs b/crates/hir-def/src/nameres/tests/mod_resolution.rs
index 9c97e42f4f..e54bcc28d2 100644
--- a/crates/hir-def/src/nameres/tests/mod_resolution.rs
+++ b/crates/hir-def/src/nameres/tests/mod_resolution.rs
@@ -18,8 +18,8 @@ pub struct Baz;
",
expect![[r#"
crate
- Baz: _
- foo: t
+ - Baz : _
+ - foo : type
crate::foo
"#]],
@@ -41,13 +41,13 @@ struct X;
"#,
expect![[r#"
crate
- n1: t
+ - n1 : type
crate::n1
- n2: t
+ - n2 : type
crate::n1::n2
- X: t v
+ - X : type value
"#]],
);
}
@@ -76,22 +76,22 @@ pub trait Iterator;
"#,
expect![[r#"
crate
- iter: t
- prelude: t
+ - iter : type
+ - prelude : type
crate::iter
- Iterator: ti
- traits: t
+ - Iterator : type (import)
+ - traits : type
crate::iter::traits
- Iterator: ti
- iterator: t
+ - Iterator : type (import)
+ - iterator : type
crate::iter::traits::iterator
- Iterator: t
+ - Iterator : type
crate::prelude
- Iterator: ti
+ - Iterator : type (import)
"#]],
);
}
@@ -109,11 +109,11 @@ pub struct Bar;
"#,
expect![[r#"
crate
- Bar: ti vi
- foo: t
+ - Bar : type (import) value (import)
+ - foo : type
crate::foo
- Bar: t v
+ - Bar : type value
"#]],
);
}
@@ -139,19 +139,19 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Bar: ti vi
- r#async: t
+ - Bar : type (import) value (import)
+ - r#async : type
crate::r#async
- Bar: t v
- r#async: t
- foo: t
+ - Bar : type value
+ - r#async : type
+ - foo : type
crate::r#async::r#async
- Baz: t v
+ - Baz : type value
crate::r#async::foo
- Foo: t v
+ - Foo : type value
"#]],
);
}
@@ -176,19 +176,19 @@ pub struct Bar;
"#,
expect![[r#"
crate
- Bar: ti vi
- Foo: ti vi
- r#async: t
+ - Bar : type (import) value (import)
+ - Foo : type (import) value (import)
+ - r#async : type
crate::r#async
- a: t
- r#async: t
+ - a : type
+ - r#async : type
crate::r#async::a
- Foo: t v
+ - Foo : type value
crate::r#async::r#async
- Bar: t v
+ - Bar : type value
"#]],
);
}
@@ -207,11 +207,11 @@ pub struct Bar;
"#,
expect![[r#"
crate
- Bar: ti vi
- foo: t
+ - Bar : type (import) value (import)
+ - foo : type
crate::foo
- Bar: t v
+ - Bar : type value
"#]],
);
}
@@ -233,14 +233,14 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: ti vi
- bar: t
+ - Baz : type (import) value (import)
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -262,14 +262,14 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: ti vi
- bar: t
+ - Baz : type (import) value (import)
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -288,11 +288,11 @@ use super::Baz;
"#,
expect![[r#"
crate
- Baz: t v
- foo: t
+ - Baz : type value
+ - foo : type
crate::foo
- Baz: ti vi
+ - Baz : type (import) value (import)
"#]],
);
}
@@ -310,10 +310,10 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -334,13 +334,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- foo_bar: t
+ - foo_bar : type
crate::foo::foo_bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -361,13 +361,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- foo_bar: t
+ - foo_bar : type
crate::foo::foo_bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -388,14 +388,14 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
-"#]],
+ - Baz : type value
+ "#]],
);
}
@@ -412,10 +412,10 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -433,10 +433,10 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -454,13 +454,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -477,13 +477,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -501,13 +501,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -528,13 +528,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -555,13 +555,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -579,7 +579,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
"#]],
@@ -599,13 +599,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -626,14 +626,14 @@ pub struct Baz;
"#,
expect![[r#"
crate
- Baz: ti vi
- foo: t
+ - Baz : type (import) value (import)
+ - foo : type
crate::foo
- bar: t
+ - bar : type
crate::foo::bar
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -657,17 +657,17 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: ti vi
- bar: t
+ - Baz : type (import) value (import)
+ - bar : type
crate::foo::bar
- baz: t
+ - baz : type
crate::foo::bar::baz
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -691,17 +691,17 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: ti vi
- bar: t
+ - Baz : type (import) value (import)
+ - bar : type
crate::foo::bar
- baz: t
+ - baz : type
crate::foo::bar::baz
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -725,17 +725,17 @@ pub struct Baz;
"#,
expect![[r#"
crate
- foo: t
+ - foo : type
crate::foo
- Baz: ti vi
- bar: t
+ - Baz : type (import) value (import)
+ - bar : type
crate::foo::bar
- baz: t
+ - baz : type
crate::foo::bar::baz
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -756,13 +756,13 @@ pub struct Baz;
"#,
expect![[r#"
crate
- module: t
+ - module : type
crate::module
- submod: t
+ - submod : type
crate::module::submod
- Baz: t v
+ - Baz : type value
"#]],
);
}
@@ -783,16 +783,16 @@ struct X;
"#,
expect![[r#"
crate
- a: t
+ - a : type
crate::a
- b: t
+ - b : type
crate::a::b
- c: t
+ - c : type
crate::a::b::c
- X: t v
+ - X : type value
"#]],
);
}
@@ -814,16 +814,16 @@ struct X;
"#,
expect![[r#"
crate
- a: t
+ - a : type
crate::a
- b: t
+ - b : type
crate::a::b
- c: t
+ - c : type
crate::a::b::c
- X: t v
+ - X : type value
"#]],
);
}
@@ -870,8 +870,8 @@ pub mod hash { pub trait Hash {} }
"#,
expect![[r#"
crate
- Hash: ti
- core: t
+ - Hash : type (import)
+ - core : type
crate::core
"#]],
@@ -921,16 +921,16 @@ pub enum Enum {
"#,
expect![[r#"
crate
- NoAssoc: _
- const_based: _
- module: t
- new: _
- unresolved: _
+ - NoAssoc : _
+ - const_based : _
+ - module : type
+ - new : _
+ - unresolved : _
crate::module
- C: v
- Enum: t
- S: t v
+ - C : value
+ - Enum : type
+ - S : type value
"#]],
);
}
@@ -957,14 +957,15 @@ pub trait Trait {
"#,
expect![[r#"
crate
- ASSOC_CONST: _
- AssocType: _
- MACRO_CONST: _
- method: _
- module: t
+ - ASSOC_CONST : _
+ - AssocType : _
+ - MACRO_CONST : _
+ - method : _
+ - module : type
crate::module
- Trait: t
+ - Trait : type
+ - (legacy) m : macro!
"#]],
);
check(
@@ -987,10 +988,11 @@ pub trait Trait {
"#,
expect![[r#"
crate
- module: t
+ - module : type
crate::module
- Trait: t
+ - Trait : type
+ - (legacy) m : macro!
"#]],
);
}
@@ -1015,10 +1017,10 @@ pub trait Trait {
"#,
expect![[r#"
crate
- ASSOC_CONST: _
- AssocType: _
- MACRO_CONST: _
- method: _
+ - ASSOC_CONST : _
+ - AssocType : _
+ - MACRO_CONST : _
+ - method : _
"#]],
);
check(
diff --git a/crates/hir-def/src/nameres/tests/primitives.rs b/crates/hir-def/src/nameres/tests/primitives.rs
index 271eb1c79b..861690238d 100644
--- a/crates/hir-def/src/nameres/tests/primitives.rs
+++ b/crates/hir-def/src/nameres/tests/primitives.rs
@@ -13,11 +13,11 @@ pub use i32 as int;
"#,
expect![[r#"
crate
- foo: t
- int: ti
+ - foo : type
+ - int : type (import)
crate::foo
- int: ti
+ - int : type (import)
"#]],
);
}