aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/collector.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-05-23 21:31:59 +0100
committerAleksey Kladov <[email protected]>2021-05-25 15:49:59 +0100
commit5c9f31d4c28478b4373e6cf5ec155745c840ee3f (patch)
tree6d105121d271c7532170875feafaadcd7ad500ba /crates/hir_def/src/nameres/collector.rs
parentb7414fa14a85f4acd37b5bdfdc2a4ab97a072bd2 (diff)
internal: move diagnostics to hir
The idea here is to eventually get rid of `dyn Diagnostic` and `DiagnosticSink` infrastructure altogether, and just have a `enum hir::Diagnostic` instead. The problem with `dyn Diagnostic` is that it is defined in the lowest level of the stack (hir_expand), but is used by the highest level (ide). As a first step, we free hir_expand and hir_def from `dyn Diagnostic` and kick the can up to `hir_ty`, as an intermediate state. The plan is then to move DiagnosticSink similarly to the hir crate, and, as final third step, remove its usage from the ide. One currently unsolved problem is testing. You can notice that the test which checks precise diagnostic ranges, unresolved_import_in_use_tree, was moved to the ide layer. Logically, only IDE should have the infra to render a specific range. At the same time, the range is determined with the data produced in hir_def and hir crates, so this layering is rather unfortunate. Working on hir_def shouldn't require compiling `ide` for testing.
Diffstat (limited to 'crates/hir_def/src/nameres/collector.rs')
-rw-r--r--crates/hir_def/src/nameres/collector.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 2ae740d0e..3ea472908 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -33,7 +33,10 @@ use crate::{
33 }, 33 },
34 macro_call_as_call_id, 34 macro_call_as_call_id,
35 nameres::{ 35 nameres::{
36 diagnostics::DefDiagnostic, mod_resolution::ModDir, path_resolution::ReachedFixedPoint, 36 diagnostics::DefDiagnostic,
37 mod_resolution::ModDir,
38 path_resolution::ReachedFixedPoint,
39 proc_macro::{ProcMacroDef, ProcMacroKind},
37 BuiltinShadowMode, DefMap, ModuleData, ModuleOrigin, ResolveMode, 40 BuiltinShadowMode, DefMap, ModuleData, ModuleOrigin, ResolveMode,
38 }, 41 },
39 path::{ImportAlias, ModPath, PathKind}, 42 path::{ImportAlias, ModPath, PathKind},
@@ -44,8 +47,6 @@ use crate::{
44 UnresolvedMacro, 47 UnresolvedMacro,
45}; 48};
46 49
47use super::proc_macro::{ProcMacroDef, ProcMacroKind};
48
49const GLOB_RECURSION_LIMIT: usize = 100; 50const GLOB_RECURSION_LIMIT: usize = 100;
50const EXPANSION_DEPTH_LIMIT: usize = 128; 51const EXPANSION_DEPTH_LIMIT: usize = 128;
51const FIXED_POINT_LIMIT: usize = 8192; 52const FIXED_POINT_LIMIT: usize = 8192;