Skip to content

Commit 1b7c7e9

Browse files
authored
Merge pull request #945 from Y-Nak/dependent-ty
2 parents d664a7a + f11c1b0 commit 1b7c7e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2078
-531
lines changed

Cargo.lock

+25-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir-analysis/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ hir = { path = "../hir", package = "fe-hir" }
2020
common = { path = "../common2", package = "fe-common2" }
2121
macros = { path = "../macros", package = "fe-macros" }
2222
fe-compiler-test-utils = { path = "../test-utils" }
23+
num-bigint = "0.4"
24+
once_cell = "1.18"
25+
regex = "1.10"
2326

2427
[dev-dependencies]
2528
codespan-reporting = "0.11"

crates/hir-analysis/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ pub struct Jar(
1616
ty::ty_def::AdtDef,
1717
ty::ty_def::FuncDef,
1818
ty::ty_def::AdtRefId,
19+
/// Const types.
20+
ty::const_ty::ConstTyId,
21+
ty::const_ty::evaluate_const_ty,
1922
/// Type lowering.
2023
ty::ty_lower::lower_hir_ty,
2124
ty::ty_lower::lower_adt,
2225
ty::ty_lower::lower_func,
2326
ty::ty_lower::lower_type_alias,
2427
ty::ty_lower::collect_generic_params,
2528
ty::ty_lower::GenericParamOwnerId,
29+
ty::ty_lower::GenericParamTypeSet,
30+
ty::ty_lower::evaluate_params_precursor,
2631
/// Trait lowering.
2732
ty::trait_lower::lower_trait,
2833
ty::trait_lower::lower_trait_ref,

crates/hir-analysis/src/name_resolution/diagnostics.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ use hir::{
88
HirDb,
99
};
1010

11-
use crate::HirAnalysisDb;
12-
1311
use super::NameRes;
12+
use crate::HirAnalysisDb;
1413

1514
#[salsa::accumulator]
1615
pub struct NameResolutionDiagAccumulator(pub(super) NameResDiag);

crates/hir-analysis/src/name_resolution/import_resolver.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ use hir::{
1111
use itertools::Itertools;
1212
use rustc_hash::{FxHashMap, FxHashSet};
1313

14-
use crate::{name_resolution::visibility_checker::is_use_visible, HirAnalysisDb};
15-
1614
use super::{
1715
diagnostics::NameResDiag,
1816
name_resolver::{
1917
NameDerivation, NameDomain, NameQuery, NameRes, NameResBucket, NameResKind,
2018
NameResolutionError, NameResolutionResult, NameResolver, QueryDirective,
2119
},
2220
};
21+
use crate::{name_resolution::visibility_checker::is_use_visible, HirAnalysisDb};
2322

2423
pub(crate) struct ImportResolver<'db> {
2524
db: &'db dyn HirAnalysisDb,
@@ -473,8 +472,8 @@ impl<'db> ImportResolver<'db> {
473472
// the `i_use` resolution.
474473
//
475474
// This is because:
476-
// 1. the resolution of the first segment changes depending on whether the
477-
// dependent glob is resolved or not at the time of `i_use` resolution,
475+
// 1. the resolution of the first segment changes depending on whether the const
476+
// glob is resolved or not at the time of `i_use` resolution,
478477
// 2. the order in which uses are resolved is nondeterministic.
479478
//
480479
// In normal name resolution rules, the name brought in by a glob always shadows

crates/hir-analysis/src/name_resolution/mod.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ mod path_resolver;
66
mod visibility_checker;
77

88
use either::Either;
9-
pub use import_resolver::ResolvedImports;
10-
pub use name_resolver::{
11-
NameDerivation, NameDomain, NameQuery, NameRes, NameResBucket, NameResKind, QueryDirective,
12-
};
13-
pub use path_resolver::EarlyResolvedPath;
14-
159
use hir::{
1610
analysis_pass::ModuleAnalysisPass,
1711
diagnostics::DiagnosticVoucher,
@@ -21,16 +15,20 @@ use hir::{
2115
},
2216
visitor::prelude::*,
2317
};
18+
pub use import_resolver::ResolvedImports;
19+
pub use name_resolver::{
20+
NameDerivation, NameDomain, NameQuery, NameRes, NameResBucket, NameResKind, QueryDirective,
21+
};
22+
pub use path_resolver::EarlyResolvedPath;
2423
use rustc_hash::FxHashSet;
2524

26-
use crate::HirAnalysisDb;
27-
2825
use self::{
2926
diagnostics::{ImportResolutionDiagAccumulator, NameResDiag, NameResolutionDiagAccumulator},
3027
import_resolver::DefaultImporter,
3128
name_resolver::{NameResolutionError, ResolvedQueryCacheStore},
3229
path_resolver::EarlyPathResolver,
3330
};
31+
use crate::HirAnalysisDb;
3432

3533
// TODO: Implement `resolve_path` and `resolve_segments` after implementing the
3634
// late path resolution.
@@ -296,7 +294,7 @@ impl<'db, 'a> EarlyPathVisitor<'db, 'a> {
296294
return;
297295
};
298296

299-
let domain = NameDomain::from_scope(scope);
297+
let domain = NameDomain::from_scope(self.db, scope);
300298
let binding = self.inner.resolve_query(query);
301299
match binding.pick(domain) {
302300
Ok(_) => {}

0 commit comments

Comments
 (0)