diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/autoderef.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 12 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/builtin.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/utils.rs | 4 |
5 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_hir_ty/src/autoderef.rs b/crates/ra_hir_ty/src/autoderef.rs index 04822d56e..ee48fa537 100644 --- a/crates/ra_hir_ty/src/autoderef.rs +++ b/crates/ra_hir_ty/src/autoderef.rs | |||
@@ -6,7 +6,7 @@ | |||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_def::lang_item::LangItemTarget; | 8 | use hir_def::lang_item::LangItemTarget; |
9 | use hir_expand::name::N; | 9 | use hir_expand::name::name; |
10 | use log::{info, warn}; | 10 | use log::{info, warn}; |
11 | use ra_db::CrateId; | 11 | use ra_db::CrateId; |
12 | 12 | ||
@@ -52,7 +52,7 @@ fn deref_by_trait( | |||
52 | LangItemTarget::TraitId(it) => it, | 52 | LangItemTarget::TraitId(it) => it, |
53 | _ => return None, | 53 | _ => return None, |
54 | }; | 54 | }; |
55 | let target = db.trait_data(deref_trait).associated_type_by_name(&N![Target])?; | 55 | let target = db.trait_data(deref_trait).associated_type_by_name(&name![Target])?; |
56 | 56 | ||
57 | let generic_params = generics(db, target.into()); | 57 | let generic_params = generics(db, target.into()); |
58 | if generic_params.len() != 1 { | 58 | if generic_params.len() != 1 { |
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index bb366bb8b..edf4e69ba 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -29,7 +29,7 @@ use hir_def::{ | |||
29 | type_ref::{Mutability, TypeRef}, | 29 | type_ref::{Mutability, TypeRef}, |
30 | AdtId, AssocItemId, DefWithBodyId, FunctionId, StructFieldId, TypeAliasId, VariantId, | 30 | AdtId, AssocItemId, DefWithBodyId, FunctionId, StructFieldId, TypeAliasId, VariantId, |
31 | }; | 31 | }; |
32 | use hir_expand::{diagnostics::DiagnosticSink, name::N}; | 32 | use hir_expand::{diagnostics::DiagnosticSink, name::name}; |
33 | use ra_arena::map::ArenaMap; | 33 | use ra_arena::map::ArenaMap; |
34 | use ra_prof::profile; | 34 | use ra_prof::profile; |
35 | 35 | ||
@@ -424,31 +424,31 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
424 | fn resolve_into_iter_item(&self) -> Option<TypeAliasId> { | 424 | fn resolve_into_iter_item(&self) -> Option<TypeAliasId> { |
425 | let path = known::std_iter_into_iterator(); | 425 | let path = known::std_iter_into_iterator(); |
426 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; | 426 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; |
427 | self.db.trait_data(trait_).associated_type_by_name(&N![Item]) | 427 | self.db.trait_data(trait_).associated_type_by_name(&name![Item]) |
428 | } | 428 | } |
429 | 429 | ||
430 | fn resolve_ops_try_ok(&self) -> Option<TypeAliasId> { | 430 | fn resolve_ops_try_ok(&self) -> Option<TypeAliasId> { |
431 | let path = known::std_ops_try(); | 431 | let path = known::std_ops_try(); |
432 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; | 432 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; |
433 | self.db.trait_data(trait_).associated_type_by_name(&N![Ok]) | 433 | self.db.trait_data(trait_).associated_type_by_name(&name![Ok]) |
434 | } | 434 | } |
435 | 435 | ||
436 | fn resolve_ops_neg_output(&self) -> Option<TypeAliasId> { | 436 | fn resolve_ops_neg_output(&self) -> Option<TypeAliasId> { |
437 | let path = known::std_ops_neg(); | 437 | let path = known::std_ops_neg(); |
438 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; | 438 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; |
439 | self.db.trait_data(trait_).associated_type_by_name(&N![Output]) | 439 | self.db.trait_data(trait_).associated_type_by_name(&name![Output]) |
440 | } | 440 | } |
441 | 441 | ||
442 | fn resolve_ops_not_output(&self) -> Option<TypeAliasId> { | 442 | fn resolve_ops_not_output(&self) -> Option<TypeAliasId> { |
443 | let path = known::std_ops_not(); | 443 | let path = known::std_ops_not(); |
444 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; | 444 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; |
445 | self.db.trait_data(trait_).associated_type_by_name(&N![Output]) | 445 | self.db.trait_data(trait_).associated_type_by_name(&name![Output]) |
446 | } | 446 | } |
447 | 447 | ||
448 | fn resolve_future_future_output(&self) -> Option<TypeAliasId> { | 448 | fn resolve_future_future_output(&self) -> Option<TypeAliasId> { |
449 | let path = known::std_future_future(); | 449 | let path = known::std_future_future(); |
450 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; | 450 | let trait_ = self.resolver.resolve_known_trait(self.db, &path)?; |
451 | self.db.trait_data(trait_).associated_type_by_name(&N![Output]) | 451 | self.db.trait_data(trait_).associated_type_by_name(&name![Output]) |
452 | } | 452 | } |
453 | 453 | ||
454 | fn resolve_boxed_box(&self) -> Option<AdtId> { | 454 | fn resolve_boxed_box(&self) -> Option<AdtId> { |
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index a6f5c6ec3..2e3cdd53a 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -10,7 +10,7 @@ use hir_def::{ | |||
10 | resolver::resolver_for_expr, | 10 | resolver::resolver_for_expr, |
11 | AdtId, ContainerId, Lookup, StructFieldId, | 11 | AdtId, ContainerId, Lookup, StructFieldId, |
12 | }; | 12 | }; |
13 | use hir_expand::name::{Name, N}; | 13 | use hir_expand::name::{name, Name}; |
14 | use ra_syntax::ast::RangeOp; | 14 | use ra_syntax::ast::RangeOp; |
15 | 15 | ||
16 | use crate::{ | 16 | use crate::{ |
@@ -631,7 +631,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
631 | // Parent arguments are unknown, except for the receiver type | 631 | // Parent arguments are unknown, except for the receiver type |
632 | if let Some(parent_generics) = def_generics.as_ref().map(|p| p.iter_parent()) { | 632 | if let Some(parent_generics) = def_generics.as_ref().map(|p| p.iter_parent()) { |
633 | for (_id, param) in parent_generics { | 633 | for (_id, param) in parent_generics { |
634 | if param.name == N![Self] { | 634 | if param.name == name![Self] { |
635 | substs.push(receiver_ty.clone()); | 635 | substs.push(receiver_ty.clone()); |
636 | } else { | 636 | } else { |
637 | substs.push(Ty::Unknown); | 637 | substs.push(Ty::Unknown); |
diff --git a/crates/ra_hir_ty/src/traits/builtin.rs b/crates/ra_hir_ty/src/traits/builtin.rs index 27c475a3c..cd587a338 100644 --- a/crates/ra_hir_ty/src/traits/builtin.rs +++ b/crates/ra_hir_ty/src/traits/builtin.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! This module provides the built-in trait implementations, e.g. to make | 1 | //! This module provides the built-in trait implementations, e.g. to make |
2 | //! closures implement `Fn`. | 2 | //! closures implement `Fn`. |
3 | use hir_def::{expr::Expr, lang_item::LangItemTarget, TraitId, TypeAliasId}; | 3 | use hir_def::{expr::Expr, lang_item::LangItemTarget, TraitId, TypeAliasId}; |
4 | use hir_expand::name::N; | 4 | use hir_expand::name::name; |
5 | use ra_db::CrateId; | 5 | use ra_db::CrateId; |
6 | 6 | ||
7 | use super::{AssocTyValue, Impl}; | 7 | use super::{AssocTyValue, Impl}; |
@@ -79,7 +79,7 @@ fn closure_fn_trait_impl_datum( | |||
79 | // and don't want to return a valid value only to find out later that FnOnce | 79 | // and don't want to return a valid value only to find out later that FnOnce |
80 | // is broken | 80 | // is broken |
81 | let fn_once_trait = get_fn_trait(db, krate, super::FnTrait::FnOnce)?; | 81 | let fn_once_trait = get_fn_trait(db, krate, super::FnTrait::FnOnce)?; |
82 | let _output = db.trait_data(fn_once_trait).associated_type_by_name(&N![Output])?; | 82 | let _output = db.trait_data(fn_once_trait).associated_type_by_name(&name![Output])?; |
83 | 83 | ||
84 | let num_args: u16 = match &db.body(data.def.into())[data.expr] { | 84 | let num_args: u16 = match &db.body(data.def.into())[data.expr] { |
85 | Expr::Lambda { args, .. } => args.len() as u16, | 85 | Expr::Lambda { args, .. } => args.len() as u16, |
@@ -137,7 +137,7 @@ fn closure_fn_trait_output_assoc_ty_value( | |||
137 | 137 | ||
138 | let output_ty_id = db | 138 | let output_ty_id = db |
139 | .trait_data(fn_once_trait) | 139 | .trait_data(fn_once_trait) |
140 | .associated_type_by_name(&N![Output]) | 140 | .associated_type_by_name(&name![Output]) |
141 | .expect("assoc ty value should not exist"); | 141 | .expect("assoc ty value should not exist"); |
142 | 142 | ||
143 | BuiltinImplAssocTyValueData { | 143 | BuiltinImplAssocTyValueData { |
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/ra_hir_ty/src/utils.rs index fabf45b53..0049d3c6f 100644 --- a/crates/ra_hir_ty/src/utils.rs +++ b/crates/ra_hir_ty/src/utils.rs | |||
@@ -10,7 +10,7 @@ use hir_def::{ | |||
10 | type_ref::TypeRef, | 10 | type_ref::TypeRef, |
11 | ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId, | 11 | ContainerId, GenericDefId, Lookup, TraitId, TypeAliasId, TypeParamId, VariantId, |
12 | }; | 12 | }; |
13 | use hir_expand::name::{Name, N}; | 13 | use hir_expand::name::{name, Name}; |
14 | 14 | ||
15 | fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { | 15 | fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { |
16 | let resolver = trait_.resolver(db); | 16 | let resolver = trait_.resolver(db); |
@@ -22,7 +22,7 @@ fn direct_super_traits(db: &impl DefDatabase, trait_: TraitId) -> Vec<TraitId> { | |||
22 | .where_predicates | 22 | .where_predicates |
23 | .iter() | 23 | .iter() |
24 | .filter_map(|pred| match &pred.type_ref { | 24 | .filter_map(|pred| match &pred.type_ref { |
25 | TypeRef::Path(p) if p.as_ident() == Some(&N![Self]) => pred.bound.as_path(), | 25 | TypeRef::Path(p) if p.as_ident() == Some(&name![Self]) => pred.bound.as_path(), |
26 | _ => None, | 26 | _ => None, |
27 | }) | 27 | }) |
28 | .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path) { | 28 | .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path) { |