diff options
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir/src/ty.rs | 12 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/path.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/references/name_definition.rs | 5 | ||||
-rw-r--r-- | xtask/src/main.rs | 2 |
9 files changed, 33 insertions, 22 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 09c4e97fa..5a0bd0c19 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -23,7 +23,7 @@ use crate::{ | |||
23 | adt::VariantDef, | 23 | adt::VariantDef, |
24 | db::{AstDatabase, DefDatabase, HirDatabase}, | 24 | db::{AstDatabase, DefDatabase, HirDatabase}, |
25 | expr::{validation::ExprValidator, BindingAnnotation, Body, BodySourceMap, Pat, PatId}, | 25 | expr::{validation::ExprValidator, BindingAnnotation, Body, BodySourceMap, Pat, PatId}, |
26 | generics::HasGenericParams, | 26 | generics::{GenericDef, HasGenericParams}, |
27 | ids::{ | 27 | ids::{ |
28 | AstItemDef, ConstId, EnumId, FunctionId, MacroDefId, StaticId, StructId, TraitId, | 28 | AstItemDef, ConstId, EnumId, FunctionId, MacroDefId, StaticId, StructId, TraitId, |
29 | TypeAliasId, | 29 | TypeAliasId, |
@@ -1121,3 +1121,9 @@ impl Local { | |||
1121 | src.map(|ast| ast.map(|it| it.cast().unwrap().to_node(&root), |it| it.to_node(&root))) | 1121 | src.map(|ast| ast.map(|it| it.cast().unwrap().to_node(&root), |it| it.to_node(&root))) |
1122 | } | 1122 | } |
1123 | } | 1123 | } |
1124 | |||
1125 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||
1126 | pub struct GenericParam { | ||
1127 | pub(crate) parent: GenericDef, | ||
1128 | pub(crate) idx: u32, | ||
1129 | } | ||
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 806f1daed..92d71b9e8 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -39,7 +39,7 @@ mod ty; | |||
39 | mod impl_block; | 39 | mod impl_block; |
40 | mod expr; | 40 | mod expr; |
41 | mod lang_item; | 41 | mod lang_item; |
42 | mod generics; | 42 | pub mod generics; |
43 | mod resolve; | 43 | mod resolve; |
44 | pub mod diagnostics; | 44 | pub mod diagnostics; |
45 | mod util; | 45 | mod util; |
@@ -65,12 +65,12 @@ pub use crate::{ | |||
65 | docs::{DocDef, Docs, Documentation}, | 65 | docs::{DocDef, Docs, Documentation}, |
66 | src::{HasBodySource, HasSource}, | 66 | src::{HasBodySource, HasSource}, |
67 | Adt, AssocItem, Const, ConstData, Container, Crate, CrateDependency, DefWithBody, Enum, | 67 | Adt, AssocItem, Const, ConstData, Container, Crate, CrateDependency, DefWithBody, Enum, |
68 | EnumVariant, FieldSource, FnData, Function, HasBody, Local, MacroDef, Module, ModuleDef, | 68 | EnumVariant, FieldSource, FnData, Function, GenericParam, HasBody, Local, MacroDef, Module, |
69 | ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, | 69 | ModuleDef, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, |
70 | }, | 70 | }, |
71 | expr::ExprScopes, | 71 | expr::ExprScopes, |
72 | from_source::FromSource, | 72 | from_source::FromSource, |
73 | generics::{GenericDef, GenericParam, GenericParams, HasGenericParams}, | 73 | generics::GenericDef, |
74 | ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile}, | 74 | ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile}, |
75 | impl_block::ImplBlock, | 75 | impl_block::ImplBlock, |
76 | resolve::ScopeDef, | 76 | resolve::ScopeDef, |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index c5fdf3bab..fe4211819 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -28,8 +28,8 @@ use crate::{ | |||
28 | ids::LocationCtx, | 28 | ids::LocationCtx, |
29 | resolve::{ScopeDef, TypeNs, ValueNs}, | 29 | resolve::{ScopeDef, TypeNs, ValueNs}, |
30 | ty::method_resolution::{self, implements_trait}, | 30 | ty::method_resolution::{self, implements_trait}, |
31 | AssocItem, Const, DefWithBody, Either, Enum, FromSource, Function, HasBody, HirFileId, Local, | 31 | AssocItem, Const, DefWithBody, Either, Enum, FromSource, Function, GenericParam, HasBody, |
32 | MacroDef, Module, Name, Path, Resolver, Static, Struct, Ty, | 32 | HirFileId, Local, MacroDef, Module, Name, Path, Resolver, Static, Struct, Ty, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | fn try_get_resolver_for_node( | 35 | fn try_get_resolver_for_node( |
@@ -107,7 +107,7 @@ pub enum PathResolution { | |||
107 | /// A local binding (only value namespace) | 107 | /// A local binding (only value namespace) |
108 | Local(Local), | 108 | Local(Local), |
109 | /// A generic parameter | 109 | /// A generic parameter |
110 | GenericParam(u32), | 110 | GenericParam(GenericParam), |
111 | SelfType(crate::ImplBlock), | 111 | SelfType(crate::ImplBlock), |
112 | Macro(MacroDef), | 112 | Macro(MacroDef), |
113 | AssocItem(crate::AssocItem), | 113 | AssocItem(crate::AssocItem), |
@@ -227,7 +227,10 @@ impl SourceAnalyzer { | |||
227 | ) -> Option<PathResolution> { | 227 | ) -> Option<PathResolution> { |
228 | let types = self.resolver.resolve_path_in_type_ns_fully(db, &path).map(|ty| match ty { | 228 | let types = self.resolver.resolve_path_in_type_ns_fully(db, &path).map(|ty| match ty { |
229 | TypeNs::SelfType(it) => PathResolution::SelfType(it), | 229 | TypeNs::SelfType(it) => PathResolution::SelfType(it), |
230 | TypeNs::GenericParam(it) => PathResolution::GenericParam(it), | 230 | TypeNs::GenericParam(idx) => PathResolution::GenericParam(GenericParam { |
231 | parent: self.resolver.generic_def().unwrap(), | ||
232 | idx, | ||
233 | }), | ||
231 | TypeNs::AdtSelfType(it) | TypeNs::Adt(it) => PathResolution::Def(it.into()), | 234 | TypeNs::AdtSelfType(it) | TypeNs::Adt(it) => PathResolution::Def(it.into()), |
232 | TypeNs::EnumVariant(it) => PathResolution::Def(it.into()), | 235 | TypeNs::EnumVariant(it) => PathResolution::Def(it.into()), |
233 | TypeNs::TypeAlias(it) => PathResolution::Def(it.into()), | 236 | TypeNs::TypeAlias(it) => PathResolution::Def(it.into()), |
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index cd2ac0e8b..6f24cfad6 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -17,8 +17,11 @@ use std::sync::Arc; | |||
17 | use std::{fmt, iter, mem}; | 17 | use std::{fmt, iter, mem}; |
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
20 | db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, DefWithBody, GenericParams, | 20 | db::HirDatabase, |
21 | HasGenericParams, Mutability, Name, Trait, TypeAlias, | 21 | expr::ExprId, |
22 | generics::{GenericParams, HasGenericParams}, | ||
23 | util::make_mut_slice, | ||
24 | Adt, Crate, DefWithBody, Mutability, Name, Trait, TypeAlias, | ||
22 | }; | 25 | }; |
23 | use display::{HirDisplay, HirFormatter}; | 26 | use display::{HirDisplay, HirFormatter}; |
24 | 27 | ||
@@ -342,10 +345,7 @@ impl Substs { | |||
342 | ) | 345 | ) |
343 | } | 346 | } |
344 | 347 | ||
345 | pub fn build_for_def( | 348 | pub fn build_for_def(db: &impl HirDatabase, def: impl HasGenericParams) -> SubstsBuilder { |
346 | db: &impl HirDatabase, | ||
347 | def: impl crate::HasGenericParams, | ||
348 | ) -> SubstsBuilder { | ||
349 | let params = def.generic_params(db); | 349 | let params = def.generic_params(db); |
350 | let param_count = params.count_params_including_parent(); | 350 | let param_count = params.count_params_including_parent(); |
351 | Substs::builder(param_count) | 351 | Substs::builder(param_count) |
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index 3645ee831..872a4517d 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -9,7 +9,7 @@ use hir_expand::name; | |||
9 | use log::{info, warn}; | 9 | use log::{info, warn}; |
10 | 10 | ||
11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
12 | use crate::{db::HirDatabase, HasGenericParams, Resolver}; | 12 | use crate::{db::HirDatabase, generics::HasGenericParams, Resolver}; |
13 | 13 | ||
14 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 14 | const AUTODEREF_RECURSION_LIMIT: usize = 10; |
15 | 15 | ||
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index 865ced5a1..31ca675aa 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs | |||
@@ -5,9 +5,10 @@ use hir_def::path::PathSegment; | |||
5 | use super::{ExprOrPatId, InferenceContext, TraitRef}; | 5 | use super::{ExprOrPatId, InferenceContext, TraitRef}; |
6 | use crate::{ | 6 | use crate::{ |
7 | db::HirDatabase, | 7 | db::HirDatabase, |
8 | generics::HasGenericParams, | ||
8 | resolve::{ResolveValueResult, Resolver, TypeNs, ValueNs}, | 9 | resolve::{ResolveValueResult, Resolver, TypeNs, ValueNs}, |
9 | ty::{method_resolution, Namespace, Substs, Ty, TypableDef, TypeWalk}, | 10 | ty::{method_resolution, Namespace, Substs, Ty, TypableDef, TypeWalk}, |
10 | AssocItem, Container, HasGenericParams, Name, Path, | 11 | AssocItem, Container, Name, Path, |
11 | }; | 12 | }; |
12 | 13 | ||
13 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { | 14 | impl<'a, D: HirDatabase> InferenceContext<'a, D> { |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index c694952f3..14c54b9fb 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -16,13 +16,13 @@ use ra_db::salsa::{InternId, InternKey}; | |||
16 | use super::{Canonical, ChalkContext, Impl, Obligation}; | 16 | use super::{Canonical, ChalkContext, Impl, Obligation}; |
17 | use crate::{ | 17 | use crate::{ |
18 | db::HirDatabase, | 18 | db::HirDatabase, |
19 | generics::GenericDef, | 19 | generics::{GenericDef, HasGenericParams}, |
20 | ty::display::HirDisplay, | 20 | ty::display::HirDisplay, |
21 | ty::{ | 21 | ty::{ |
22 | ApplicationTy, GenericPredicate, Namespace, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, | 22 | ApplicationTy, GenericPredicate, Namespace, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, |
23 | TypeWalk, | 23 | TypeWalk, |
24 | }, | 24 | }, |
25 | AssocItem, Crate, HasGenericParams, ImplBlock, Trait, TypeAlias, | 25 | AssocItem, Crate, ImplBlock, Trait, TypeAlias, |
26 | }; | 26 | }; |
27 | 27 | ||
28 | /// This represents a trait whose name we could not resolve. | 28 | /// This represents a trait whose name we could not resolve. |
diff --git a/crates/ra_ide_api/src/references/name_definition.rs b/crates/ra_ide_api/src/references/name_definition.rs index 450f7ea9b..ccd75278a 100644 --- a/crates/ra_ide_api/src/references/name_definition.rs +++ b/crates/ra_ide_api/src/references/name_definition.rs | |||
@@ -4,7 +4,8 @@ | |||
4 | //! Note that the reference search is possible for not all of the classified items. | 4 | //! Note that the reference search is possible for not all of the classified items. |
5 | 5 | ||
6 | use hir::{ | 6 | use hir::{ |
7 | Adt, AssocItem, HasSource, Local, MacroDef, Module, ModuleDef, StructField, Ty, VariantDef, | 7 | Adt, AssocItem, GenericParam, HasSource, Local, MacroDef, Module, ModuleDef, StructField, Ty, |
8 | VariantDef, | ||
8 | }; | 9 | }; |
9 | use ra_syntax::{ast, ast::VisibilityOwner}; | 10 | use ra_syntax::{ast, ast::VisibilityOwner}; |
10 | 11 | ||
@@ -18,7 +19,7 @@ pub enum NameKind { | |||
18 | Def(ModuleDef), | 19 | Def(ModuleDef), |
19 | SelfType(Ty), | 20 | SelfType(Ty), |
20 | Local(Local), | 21 | Local(Local), |
21 | GenericParam(u32), | 22 | GenericParam(GenericParam), |
22 | } | 23 | } |
23 | 24 | ||
24 | #[derive(PartialEq, Eq)] | 25 | #[derive(PartialEq, Eq)] |
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index e04e45f15..16bddfb28 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -179,7 +179,7 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> { | |||
179 | 179 | ||
180 | Cmd { unix: r"npm ci", windows: r"cmd.exe /c npm.cmd ci", work_dir: "./editors/code" }.run()?; | 180 | Cmd { unix: r"npm ci", windows: r"cmd.exe /c npm.cmd ci", work_dir: "./editors/code" }.run()?; |
181 | Cmd { | 181 | Cmd { |
182 | unix: r"npm run package", | 182 | unix: r"npm run package --scripts-prepend-node-path", |
183 | windows: r"cmd.exe /c npm.cmd run package", | 183 | windows: r"cmd.exe /c npm.cmd run package", |
184 | work_dir: "./editors/code", | 184 | work_dir: "./editors/code", |
185 | } | 185 | } |