Add import info to item scope dumps

This commit is contained in:
Lukas Wirth 2023-08-17 09:33:15 +02:00
parent af8048266c
commit c4e9b5ac64
8 changed files with 364 additions and 215 deletions

View file

@ -38,9 +38,9 @@ fn outer() {
"#,
expect![[r#"
block scope
CrateStruct: t
PlainStruct: t v
SelfStruct: t
CrateStruct: ti
PlainStruct: ti vi
SelfStruct: ti
Struct: v
SuperStruct: _
@ -66,7 +66,7 @@ fn outer() {
"#,
expect![[r#"
block scope
imported: t v
imported: ti vi
name: v
crate
@ -92,9 +92,9 @@ fn outer() {
"#,
expect![[r#"
block scope
inner1: t
inner1: ti
inner2: v
outer: v
outer: vi
block scope
inner: v
@ -121,7 +121,7 @@ struct Struct {}
"#,
expect![[r#"
block scope
Struct: t
Struct: ti
crate
Struct: t
@ -153,7 +153,7 @@ fn outer() {
"#,
expect![[r#"
block scope
ResolveMe: t
ResolveMe: ti
block scope
m2: t
@ -214,7 +214,7 @@ fn f() {
"#,
expect![[r#"
block scope
ResolveMe: t
ResolveMe: ti
block scope
h: v
@ -292,7 +292,7 @@ pub mod cov_mark {
nested: v
crate
cov_mark: t
cov_mark: ti
f: v
"#]],
);

View file

@ -20,12 +20,6 @@ use crate::{
UseId,
};
#[derive(Copy, Clone, Debug)]
pub(crate) enum ImportType {
Glob,
Named,
}
#[derive(Debug, Default)]
pub struct PerNsGlobImports {
types: FxHashSet<(LocalModuleId, Name)>,
@ -35,6 +29,12 @@ pub struct PerNsGlobImports {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ImportOrExternCrate {
Import(ImportId),
ExternCrate(ExternCrateId),
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ImportType {
Import(ImportId),
Glob(UseId),
ExternCrate(ExternCrateId),
@ -47,13 +47,6 @@ impl ImportOrExternCrate {
_ => None,
}
}
pub fn into_glob(self) -> Option<UseId> {
match self {
ImportOrExternCrate::Glob(it) => Some(it),
_ => None,
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@ -89,9 +82,9 @@ pub struct ItemScope {
unnamed_trait_imports: FxHashMap<TraitId, (Visibility, Option<ImportId>)>,
// the resolutions of the imports of this scope
use_imports_types: FxHashMap<UseId, ImportOrDef>,
use_imports_values: FxHashMap<UseId, ImportOrDef>,
use_imports_macros: FxHashMap<UseId, ImportOrDef>,
use_imports_types: FxHashMap<ImportOrExternCrate, ImportOrDef>,
use_imports_values: FxHashMap<ImportId, ImportOrDef>,
use_imports_macros: FxHashMap<ImportId, ImportOrDef>,
use_decls: Vec<UseId>,
extern_crate_decls: Vec<ExternCrateId>,
@ -347,51 +340,185 @@ impl ItemScope {
glob_imports: &mut PerNsGlobImports,
lookup: (LocalModuleId, Name),
def: PerNs,
def_import_type: ImportType,
import: Option<ImportType>,
) -> bool {
let mut changed = false;
macro_rules! check_changed {
(
$changed:ident,
( $this:ident / $def:ident ) . $field:ident,
$glob_imports:ident [ $lookup:ident ],
$def_import_type:ident
) => {{
if let Some(fld) = $def.$field {
let existing = $this.$field.entry($lookup.1.clone());
match existing {
Entry::Vacant(entry) => {
match $def_import_type {
ImportType::Glob => {
$glob_imports.$field.insert($lookup.clone());
}
ImportType::Named => {
$glob_imports.$field.remove(&$lookup);
}
}
entry.insert(fld);
$changed = true;
if let Some(mut fld) = def.types {
let existing = self.types.entry(lookup.1.clone());
match existing {
Entry::Vacant(entry) => {
match import {
Some(ImportType::Glob(_)) => {
glob_imports.types.insert(lookup.clone());
}
Entry::Occupied(mut entry)
if matches!($def_import_type, ImportType::Named) =>
{
if $glob_imports.$field.remove(&$lookup) {
cov_mark::hit!(import_shadowed);
entry.insert(fld);
$changed = true;
}
_ => _ = glob_imports.types.remove(&lookup),
}
let import = match import {
Some(ImportType::ExternCrate(extern_crate)) => {
Some(ImportOrExternCrate::ExternCrate(extern_crate))
}
_ => {}
Some(ImportType::Import(import)) => {
Some(ImportOrExternCrate::Import(import))
}
None | Some(ImportType::Glob(_)) => None,
};
let prev = std::mem::replace(&mut fld.2, import);
if let Some(ImportOrExternCrate::Import(import)) = import {
self.use_imports_values.insert(
import,
match prev {
Some(ImportOrExternCrate::Import(import)) => {
ImportOrDef::Import(import)
}
Some(ImportOrExternCrate::ExternCrate(import)) => {
ImportOrDef::ExternCrate(import)
}
None => ImportOrDef::Def(fld.0),
},
);
}
entry.insert(fld);
changed = true;
}
Entry::Occupied(mut entry) if !matches!(import, Some(ImportType::Glob(..))) => {
if glob_imports.types.remove(&lookup) {
let import = match import {
Some(ImportType::ExternCrate(extern_crate)) => {
Some(ImportOrExternCrate::ExternCrate(extern_crate))
}
Some(ImportType::Import(import)) => {
Some(ImportOrExternCrate::Import(import))
}
None | Some(ImportType::Glob(_)) => None,
};
let prev = std::mem::replace(&mut fld.2, import);
if let Some(ImportOrExternCrate::Import(import)) = import {
self.use_imports_values.insert(
import,
match prev {
Some(ImportOrExternCrate::Import(import)) => {
ImportOrDef::Import(import)
}
Some(ImportOrExternCrate::ExternCrate(import)) => {
ImportOrDef::ExternCrate(import)
}
None => ImportOrDef::Def(fld.0),
},
);
}
cov_mark::hit!(import_shadowed);
entry.insert(fld);
changed = true;
}
}
}};
_ => {}
}
}
check_changed!(changed, (self / def).types, glob_imports[lookup], def_import_type);
check_changed!(changed, (self / def).values, glob_imports[lookup], def_import_type);
check_changed!(changed, (self / def).macros, glob_imports[lookup], def_import_type);
if let Some(mut fld) = def.values {
let existing = self.values.entry(lookup.1.clone());
match existing {
Entry::Vacant(entry) => {
match import {
Some(ImportType::Glob(_)) => {
glob_imports.values.insert(lookup.clone());
}
_ => _ = glob_imports.values.remove(&lookup),
}
let import = match import {
Some(ImportType::Import(import)) => Some(import),
_ => None,
};
let prev = std::mem::replace(&mut fld.2, import);
if let Some(import) = import {
self.use_imports_values.insert(
import,
match prev {
Some(import) => ImportOrDef::Import(import),
None => ImportOrDef::Def(fld.0),
},
);
}
entry.insert(fld);
changed = true;
}
Entry::Occupied(mut entry) if !matches!(import, Some(ImportType::Glob(..))) => {
if glob_imports.values.remove(&lookup) {
cov_mark::hit!(import_shadowed);
let import = match import {
Some(ImportType::Import(import)) => Some(import),
_ => None,
};
let prev = std::mem::replace(&mut fld.2, import);
if let Some(import) = import {
self.use_imports_values.insert(
import,
match prev {
Some(import) => ImportOrDef::Import(import),
None => ImportOrDef::Def(fld.0),
},
);
}
entry.insert(fld);
changed = true;
}
}
_ => {}
}
}
if let Some(mut fld) = def.macros {
let existing = self.macros.entry(lookup.1.clone());
match existing {
Entry::Vacant(entry) => {
match import {
Some(ImportType::Glob(_)) => {
glob_imports.macros.insert(lookup.clone());
}
_ => _ = glob_imports.macros.remove(&lookup),
}
let import = match import {
Some(ImportType::Import(import)) => Some(import),
_ => None,
};
let prev = std::mem::replace(&mut fld.2, import);
if let Some(import) = import {
self.use_imports_macros.insert(
import,
match prev {
Some(import) => ImportOrDef::Import(import),
None => ImportOrDef::Def(fld.0.into()),
},
);
}
entry.insert(fld);
changed = true;
}
Entry::Occupied(mut entry) if !matches!(import, Some(ImportType::Glob(..))) => {
if glob_imports.macros.remove(&lookup) {
cov_mark::hit!(import_shadowed);
let import = match import {
Some(ImportType::Import(import)) => Some(import),
_ => None,
};
let prev = std::mem::replace(&mut fld.2, import);
if let Some(import) = import {
self.use_imports_macros.insert(
import,
match prev {
Some(import) => ImportOrDef::Import(import),
None => ImportOrDef::Def(fld.0.into()),
},
);
}
entry.insert(fld);
changed = true;
}
}
_ => {}
}
}
if def.is_none() && self.unresolved.insert(lookup.1) {
changed = true;
@ -430,14 +557,25 @@ impl ItemScope {
name.map_or("_".to_string(), |name| name.display(db).to_string())
);
if def.types.is_some() {
if let Some((.., i)) = def.types {
buf.push_str(" t");
match i {
Some(ImportOrExternCrate::Import(_)) => buf.push('i'),
Some(ImportOrExternCrate::ExternCrate(_)) => buf.push('e'),
None => (),
}
}
if def.values.is_some() {
if let Some((.., i)) = def.values {
buf.push_str(" v");
if i.is_some() {
buf.push('i');
}
}
if def.macros.is_some() {
if let Some((.., i)) = def.macros {
buf.push_str(" m");
if i.is_some() {
buf.push('i');
}
}
if def.is_none() {
buf.push_str(" _");

View file

@ -33,7 +33,7 @@ use crate::{
attr_macro_as_call_id,
db::DefDatabase,
derive_macro_as_call_id,
item_scope::{ImportOrExternCrate, ImportType, PerNsGlobImports},
item_scope::{ImportId, ImportOrExternCrate, ImportType, PerNsGlobImports},
item_tree::{
self, ExternCrate, Fields, FileItemTreeId, ImportKind, ItemTree, ItemTreeId, ItemTreeNode,
MacroCall, MacroDef, MacroRules, Mod, ModItem, ModKind, TreeId,
@ -146,7 +146,7 @@ impl PartialResolvedImport {
#[derive(Clone, Debug, Eq, PartialEq)]
enum ImportSource {
Use { use_tree: Idx<ast::UseTree>, id: UseId, is_prelude: bool },
Use { use_tree: Idx<ast::UseTree>, id: UseId, is_prelude: bool, kind: ImportKind },
ExternCrate { id: ExternCrateId },
}
@ -155,7 +155,6 @@ struct Import {
path: ModPath,
alias: Option<ImportAlias>,
visibility: RawVisibility,
kind: ImportKind,
source: ImportSource,
}
@ -174,8 +173,7 @@ impl Import {
path,
alias,
visibility: visibility.clone(),
kind,
source: ImportSource::Use { use_tree: idx, id, is_prelude },
source: ImportSource::Use { use_tree: idx, id, is_prelude, kind },
});
});
}
@ -191,7 +189,6 @@ impl Import {
path: ModPath::from_segments(PathKind::Plain, iter::once(it.name.clone())),
alias: it.alias.clone(),
visibility: visibility.clone(),
kind: ImportKind::Plain,
source: ImportSource::ExternCrate { id },
}
}
@ -225,7 +222,7 @@ struct DefCollector<'a> {
db: &'a dyn DefDatabase,
def_map: DefMap,
deps: FxHashMap<Name, Dependency>,
glob_imports: FxHashMap<LocalModuleId, Vec<(LocalModuleId, Visibility)>>,
glob_imports: FxHashMap<LocalModuleId, Vec<(LocalModuleId, Visibility, UseId)>>,
unresolved_imports: Vec<ImportDirective>,
indeterminate_imports: Vec<ImportDirective>,
unresolved_macros: Vec<MacroDirective>,
@ -547,7 +544,11 @@ impl DefCollector<'_> {
match per_ns.types {
Some((ModuleDefId::ModuleId(m), _, import)) => {
self.def_map.prelude = Some((m, import.and_then(ImportOrExternCrate::into_glob)));
// FIXME: This should specifically look for a glob import somehow and record that here
self.def_map.prelude = Some((
m,
import.and_then(ImportOrExternCrate::into_import).map(|it| it.import),
));
}
types => {
tracing::debug!(
@ -649,7 +650,7 @@ impl DefCollector<'_> {
module_id,
&[(Some(name), PerNs::macros(macro_.into(), Visibility::Public))],
Visibility::Public,
ImportType::Named,
None,
);
}
}
@ -685,7 +686,7 @@ impl DefCollector<'_> {
module_id,
&[(Some(name), PerNs::macros(macro_.into(), Visibility::Public))],
vis,
ImportType::Named,
None,
);
}
@ -700,7 +701,7 @@ impl DefCollector<'_> {
module_id,
&[(Some(name), PerNs::macros(macro_.into(), Visibility::Public))],
Visibility::Public,
ImportType::Named,
None,
);
}
@ -720,16 +721,19 @@ impl DefCollector<'_> {
// `#[macro_use]` brings macros into macro_use prelude. Yes, even non-`macro_rules!`
// macros.
let root_scope = &def_map[DefMap::ROOT].scope;
if let Some(names) = names {
for name in names {
// FIXME: Report diagnostic on 404.
if let Some(def) = root_scope.get(&name).take_macros() {
self.def_map.macro_use_prelude.insert(name, (def, extern_crate));
match names {
Some(names) => {
for name in names {
// FIXME: Report diagnostic on 404.
if let Some(def) = root_scope.get(&name).take_macros() {
self.def_map.macro_use_prelude.insert(name, (def, extern_crate));
}
}
}
} else {
for (name, def) in root_scope.macros() {
self.def_map.macro_use_prelude.insert(name.clone(), (def, extern_crate));
None => {
for (name, def) in root_scope.macros() {
self.def_map.macro_use_prelude.insert(name.clone(), (def, extern_crate));
}
}
}
}
@ -836,8 +840,9 @@ impl DefCollector<'_> {
.resolve_visibility(self.db, module_id, &directive.import.visibility, false)
.unwrap_or(Visibility::Public);
match import.kind {
ImportKind::Plain | ImportKind::TypeOnly => {
match import.source {
ImportSource::ExternCrate { .. }
| ImportSource::Use { kind: ImportKind::Plain | ImportKind::TypeOnly, .. } => {
let name = match &import.alias {
Some(ImportAlias::Alias(name)) => Some(name),
Some(ImportAlias::Underscore) => None,
@ -850,32 +855,36 @@ impl DefCollector<'_> {
},
};
if import.kind == ImportKind::TypeOnly {
def.values = None;
def.macros = None;
}
tracing::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def);
// extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658
if let ImportSource::ExternCrate { id, .. } = import.source {
if self.def_map.block.is_none() && module_id == DefMap::ROOT {
if let (Some(ModuleDefId::ModuleId(def)), Some(name)) =
(def.take_types(), name)
{
if let Ok(def) = def.try_into() {
Arc::get_mut(&mut self.def_map.data)
.unwrap()
.extern_prelude
.insert(name.clone(), (def, Some(id)));
let imp = match import.source {
// extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658
ImportSource::ExternCrate { id, .. } => {
if self.def_map.block.is_none() && module_id == DefMap::ROOT {
if let (Some(ModuleDefId::ModuleId(def)), Some(name)) =
(def.take_types(), name)
{
if let Ok(def) = def.try_into() {
Arc::get_mut(&mut self.def_map.data)
.unwrap()
.extern_prelude
.insert(name.clone(), (def, Some(id)));
}
}
}
ImportType::ExternCrate(id)
}
}
ImportSource::Use { kind, id, use_tree, .. } => {
if kind == ImportKind::TypeOnly {
def.values = None;
def.macros = None;
}
ImportType::Import(ImportId { import: id, idx: use_tree })
}
};
tracing::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def);
self.update(module_id, &[(name.cloned(), def)], vis, ImportType::Named);
self.update(module_id, &[(name.cloned(), def)], vis, Some(imp));
}
ImportKind::Glob => {
ImportSource::Use { kind: ImportKind::Glob, id, .. } => {
tracing::debug!("glob import: {:?}", import);
match def.take_types() {
Some(ModuleDefId::ModuleId(m)) => {
@ -900,7 +909,7 @@ impl DefCollector<'_> {
.filter(|(_, res)| !res.is_none())
.collect::<Vec<_>>();
self.update(module_id, &items, vis, ImportType::Glob);
self.update(module_id, &items, vis, Some(ImportType::Glob(id)));
} else {
// glob import from same crate => we do an initial
// import, and then need to propagate any further
@ -932,11 +941,11 @@ impl DefCollector<'_> {
.filter(|(_, res)| !res.is_none())
.collect::<Vec<_>>();
self.update(module_id, &items, vis, ImportType::Glob);
self.update(module_id, &items, vis, Some(ImportType::Glob(id)));
// record the glob import in case we add further items
let glob = self.glob_imports.entry(m.local_id).or_default();
if !glob.iter().any(|(mid, _)| *mid == module_id) {
glob.push((module_id, vis));
if !glob.iter().any(|(mid, _, _)| *mid == module_id) {
glob.push((module_id, vis, id));
}
}
}
@ -962,7 +971,7 @@ impl DefCollector<'_> {
(Some(name), res)
})
.collect::<Vec<_>>();
self.update(module_id, &resolutions, vis, ImportType::Glob);
self.update(module_id, &resolutions, vis, Some(ImportType::Glob(id)));
}
Some(d) => {
tracing::debug!("glob import {:?} from non-module/enum {:?}", import, d);
@ -982,10 +991,10 @@ impl DefCollector<'_> {
resolutions: &[(Option<Name>, PerNs)],
// Visibility this import will have
vis: Visibility,
import_type: ImportType,
import: Option<ImportType>,
) {
self.db.unwind_if_cancelled();
self.update_recursive(module_id, resolutions, vis, import_type, 0)
self.update_recursive(module_id, resolutions, vis, import, 0)
}
fn update_recursive(
@ -996,7 +1005,7 @@ impl DefCollector<'_> {
// All resolutions are imported with this visibility; the visibilities in
// the `PerNs` values are ignored and overwritten
vis: Visibility,
import_type: ImportType,
import: Option<ImportType>,
depth: usize,
) {
if GLOB_RECURSION_LIMIT.check(depth).is_err() {
@ -1013,7 +1022,7 @@ impl DefCollector<'_> {
&mut self.from_glob_import,
(module_id, name.clone()),
res.with_visibility(vis),
import_type,
import,
);
}
None => {
@ -1058,7 +1067,7 @@ impl DefCollector<'_> {
.get(&module_id)
.into_iter()
.flatten()
.filter(|(glob_importing_module, _)| {
.filter(|(glob_importing_module, _, _)| {
// we know all resolutions have the same visibility (`vis`), so we
// just need to check that once
vis.is_visible_from_def_map(self.db, &self.def_map, *glob_importing_module)
@ -1066,12 +1075,12 @@ impl DefCollector<'_> {
.cloned()
.collect::<Vec<_>>();
for (glob_importing_module, glob_import_vis) in glob_imports {
for (glob_importing_module, glob_import_vis, use_) in glob_imports {
self.update_recursive(
glob_importing_module,
resolutions,
glob_import_vis,
ImportType::Glob,
Some(ImportType::Glob(use_)),
depth + 1,
);
}
@ -1474,7 +1483,9 @@ impl DefCollector<'_> {
}
for directive in &self.unresolved_imports {
if let ImportSource::Use { use_tree, id, is_prelude: _ } = directive.import.source {
if let ImportSource::Use { use_tree, id, is_prelude: _, kind: _ } =
directive.import.source
{
if matches!(
(directive.import.path.segments().first(), &directive.import.path.kind),
(Some(krate), PathKind::Plain | PathKind::Abs) if diagnosed_extern_crates.contains(krate)
@ -1538,7 +1549,7 @@ impl ModCollector<'_, '_> {
module_id,
&[(Some(name.clone()), PerNs::from_def(id, vis, has_constructor))],
vis,
ImportType::Named,
None,
)
};
let resolve_vis = |def_map: &DefMap, visibility| {
@ -1968,7 +1979,7 @@ impl ModCollector<'_, '_> {
self.module_id,
&[(Some(name), PerNs::from_def(def, vis, false))],
vis,
ImportType::Named,
None,
);
res
}

View file

@ -168,7 +168,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
Foo: t v
Foo: ti vi
foo: t
crate::foo
@ -194,8 +194,8 @@ pub enum Quux {};
"#,
expect![[r#"
crate
Baz: t v
Quux: t
Baz: ti vi
Quux: ti
foo: t
crate::foo
@ -225,11 +225,11 @@ pub struct Baz;
"#,
expect![[r#"
crate
Baz: t v
Baz: ti vi
foo: t
crate::foo
Baz: t v
Baz: ti vi
bar: t
crate::foo::bar
@ -274,7 +274,7 @@ use self::E::V;
expect![[r#"
crate
E: t
V: t v
V: ti vi
"#]],
);
}
@ -307,7 +307,7 @@ pub struct FromLib;
crate::foo
Bar: _
FromLib: t v
FromLib: ti vi
"#]],
);
}
@ -328,7 +328,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
Baz: t
Baz: ti
foo: t
crate::foo
@ -352,7 +352,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
Baz: t v
Baz: ti vi
"#]],
);
}
@ -375,13 +375,13 @@ pub struct Arc;
expect![[r#"
crate
alloc: t
alloc_crate: t
alloc_crate: te
sync: t
crate::alloc
crate::sync
Arc: t v
Arc: ti vi
"#]],
);
}
@ -404,13 +404,13 @@ pub struct Arc;
expect![[r#"
crate
alloc: t
alloc_crate: t
alloc_crate: te
sync: t
crate::alloc
crate::sync
Arc: t v
Arc: ti vi
"#]],
);
}
@ -426,7 +426,7 @@ extern crate self as bla;
"#,
expect![[r#"
crate
bla: t
bla: te
"#]],
);
}
@ -447,7 +447,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
Baz: t v
Baz: ti vi
"#]],
);
}
@ -465,7 +465,7 @@ pub struct Bar;
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
foo: v
"#]],
);
@ -492,9 +492,9 @@ fn no_std_prelude() {
}
"#,
expect![[r#"
crate
Rust: t v
"#]],
crate
Rust: ti vi
"#]],
);
}
@ -516,9 +516,9 @@ fn edition_specific_preludes() {
}
"#,
expect![[r#"
crate
Rust2018: t v
"#]],
crate
Rust2018: ti vi
"#]],
);
check(
r#"
@ -533,9 +533,9 @@ fn edition_specific_preludes() {
}
"#,
expect![[r#"
crate
Rust2021: t v
"#]],
crate
Rust2021: ti vi
"#]],
);
}
@ -563,8 +563,8 @@ pub mod prelude {
"#,
expect![[r#"
crate
Bar: t v
Foo: t v
Bar: ti vi
Foo: ti vi
"#]],
);
}
@ -590,7 +590,7 @@ pub mod prelude {
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
Baz: _
Foo: _
"#]],
@ -619,8 +619,8 @@ pub mod prelude {
expect![[r#"
crate
Bar: _
Baz: t v
Foo: t v
Baz: ti vi
Foo: ti vi
"#]],
);
}
@ -643,7 +643,7 @@ mod b {
"#,
expect![[r#"
crate
T: t v
T: ti vi
a: t
b: t
@ -816,8 +816,8 @@ fn bar() {}
expect![[r#"
crate
bar: v
baz: v
foo: t
baz: vi
foo: ti
"#]],
);
}
@ -836,7 +836,7 @@ use self::m::S::{self};
"#,
expect![[r#"
crate
S: t
S: ti
m: t
crate::m
@ -860,8 +860,8 @@ pub const settings: () = ();
"#,
expect![[r#"
crate
Settings: t v
settings: v
Settings: ti vi
settings: vi
"#]],
)
}
@ -890,8 +890,8 @@ pub struct Struct;
"#,
expect![[r#"
crate
Struct: t v
dep: t
Struct: ti vi
dep: te
"#]],
);
}
@ -917,13 +917,13 @@ use some_module::unknown_func;
crate
other_module: t
some_module: t
unknown_func: v
unknown_func: vi
crate::other_module
some_submodule: t
crate::other_module::some_submodule
unknown_func: v
unknown_func: vi
crate::some_module
unknown_func: v

View file

@ -24,7 +24,7 @@ pub struct Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
Foo: t v
bar: t
@ -237,9 +237,9 @@ pub mod baz { pub struct Bar; }
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
bar: t
baz: t
baz: ti
foo: t
crate::bar
@ -276,9 +276,9 @@ pub mod baz { pub struct Bar; }
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
bar: t
baz: t
baz: ti
foo: t
crate::bar
@ -323,7 +323,7 @@ mod d {
X: t v
crate::b
foo: t
foo: ti
crate::c
foo: t
@ -332,8 +332,8 @@ mod d {
Y: t v
crate::d
Y: t v
foo: t
Y: ti vi
foo: ti
"#]],
);
}
@ -355,7 +355,7 @@ use event::Event;
"#,
expect![[r#"
crate
Event: t
Event: ti
event: t
crate::event

View file

@ -203,8 +203,8 @@ macro_rules! bar {
expect![[r#"
crate
Foo: t
bar: m
foo: m
bar: mi
foo: mi
"#]],
);
}
@ -251,7 +251,7 @@ mod priv_mod {
Bar: t v
Foo: t v
bar: t
foo: t
foo: te
crate::bar
Baz: t v
@ -318,9 +318,9 @@ macro_rules! baz3 { () => { struct OkBaz3; } }
OkBaz1: t v
OkBaz2: t v
OkBaz3: t v
all: t
empty: t
multiple: t
all: te
empty: te
multiple: te
"#]],
);
}
@ -551,8 +551,8 @@ fn baz() {}
"#,
expect![[r#"
crate
bar: t m
baz: t v m
bar: ti mi
baz: ti v mi
foo: t m
"#]],
);
@ -583,7 +583,7 @@ mod m {
crate
Alias: t v
Direct: t v
foo: t
foo: te
"#]],
);
}
@ -628,9 +628,9 @@ mod m {
m: t
crate::m
alias1: m
alias2: m
alias3: m
alias1: mi
alias2: mi
alias3: mi
not_found: _
"#]],
);
@ -682,11 +682,11 @@ pub struct Baz;
"#,
expect![[r#"
crate
Bar: t v
Baz: t v
Bar: ti vi
Baz: ti vi
Foo: t v
FooSelf: t v
foo: t
FooSelf: ti vi
foo: te
m: t
crate::m
@ -725,7 +725,7 @@ pub struct bar;
"#,
expect![[r#"
crate
bar: t v
bar: ti vi
"#]],
);
}
@ -1340,7 +1340,7 @@ pub mod prelude {
crate
Ok: t v
bar: m
dep: t
dep: te
foo: m
ok: v
"#]],
@ -1370,13 +1370,13 @@ macro_rules! mk_foo {
}
"#,
expect![[r#"
crate
a: t
lib: t
crate
a: t
lib: te
crate::a
Ok: t v
"#]],
crate::a
Ok: t v
"#]],
);
}
@ -1427,8 +1427,8 @@ pub mod prelude {
expect![[r#"
crate
Ok: t v
bar: m
foo: m
bar: mi
foo: mi
ok: v
"#]],
);

View file

@ -80,18 +80,18 @@ pub trait Iterator;
prelude: t
crate::iter
Iterator: t
Iterator: ti
traits: t
crate::iter::traits
Iterator: t
Iterator: ti
iterator: t
crate::iter::traits::iterator
Iterator: t
crate::prelude
Iterator: t
Iterator: ti
"#]],
);
}
@ -109,7 +109,7 @@ pub struct Bar;
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
foo: t
crate::foo
@ -139,7 +139,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
r#async: t
crate::r#async
@ -176,8 +176,8 @@ pub struct Bar;
"#,
expect![[r#"
crate
Bar: t v
Foo: t v
Bar: ti vi
Foo: ti vi
r#async: t
crate::r#async
@ -207,7 +207,7 @@ pub struct Bar;
"#,
expect![[r#"
crate
Bar: t v
Bar: ti vi
foo: t
crate::foo
@ -236,7 +236,7 @@ pub struct Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
bar: t
crate::foo::bar
@ -265,7 +265,7 @@ pub struct Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
bar: t
crate::foo::bar
@ -292,7 +292,7 @@ use super::Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
"#]],
);
}
@ -626,7 +626,7 @@ pub struct Baz;
"#,
expect![[r#"
crate
Baz: t v
Baz: ti vi
foo: t
crate::foo
@ -660,7 +660,7 @@ pub struct Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
bar: t
crate::foo::bar
@ -694,7 +694,7 @@ pub struct Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
bar: t
crate::foo::bar
@ -728,7 +728,7 @@ pub struct Baz;
foo: t
crate::foo
Baz: t v
Baz: ti vi
bar: t
crate::foo::bar
@ -868,7 +868,7 @@ pub mod hash { pub trait Hash {} }
"#,
expect![[r#"
crate
Hash: t
Hash: ti
core: t
crate::core

View file

@ -14,10 +14,10 @@ pub use i32 as int;
expect![[r#"
crate
foo: t
int: t
int: ti
crate::foo
int: t
int: ti
"#]],
);
}