From e56433432057712086ca623c4a1ef40089004839 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 30 Oct 2019 17:24:36 +0300 Subject: remove forward pointer to Path --- crates/ra_hir/src/expr.rs | 2 +- crates/ra_hir/src/expr/lower.rs | 6 ++++-- crates/ra_hir/src/expr/validation.rs | 2 +- crates/ra_hir/src/generics.rs | 6 ++++-- crates/ra_hir/src/lib.rs | 7 ++++--- crates/ra_hir/src/path.rs | 1 - crates/ra_hir/src/resolve.rs | 2 +- crates/ra_hir/src/source_binder.rs | 3 +-- crates/ra_hir/src/ty/infer.rs | 3 +-- crates/ra_hir/src/ty/infer/expr.rs | 6 ++++-- crates/ra_hir/src/ty/infer/path.rs | 6 ++++-- crates/ra_hir/src/ty/lower.rs | 3 ++- 12 files changed, 27 insertions(+), 20 deletions(-) delete mode 100644 crates/ra_hir/src/path.rs (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index d238741ba..31857ad56 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -6,13 +6,13 @@ pub(crate) mod validation; use std::{ops::Index, sync::Arc}; +use hir_def::path::GenericArgs; use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; use ra_syntax::{ast, AstPtr}; use rustc_hash::FxHashMap; use crate::{ db::HirDatabase, - path::GenericArgs, ty::primitive::{UncertainFloatTy, UncertainIntTy}, type_ref::{Mutability, TypeRef}, DefWithBody, Either, HasSource, Name, Path, Resolver, Source, diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs index cf8a41b1e..6436c3a24 100644 --- a/crates/ra_hir/src/expr/lower.rs +++ b/crates/ra_hir/src/expr/lower.rs @@ -1,6 +1,9 @@ //! FIXME: write short doc here -use hir_def::name::{self, AsName, Name}; +use hir_def::{ + name::{self, AsName, Name}, + path::GenericArgs, +}; use ra_arena::Arena; use ra_syntax::{ ast::{ @@ -13,7 +16,6 @@ use test_utils::tested_by; use crate::{ db::HirDatabase, - path::GenericArgs, ty::primitive::{FloatTy, IntTy, UncertainFloatTy, UncertainIntTy}, type_ref::TypeRef, AstId, DefWithBody, Either, HirFileId, MacroCallLoc, MacroFileKind, Mutability, Path, Resolver, diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 1aa853c3e..c685edda1 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs @@ -2,6 +2,7 @@ use std::sync::Arc; +use hir_def::path::known; use ra_syntax::ast; use rustc_hash::FxHashSet; @@ -9,7 +10,6 @@ use crate::{ db::HirDatabase, diagnostics::{DiagnosticSink, MissingFields, MissingOkInTailExpr}, expr::AstPtr, - path::known, ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, Adt, Function, Name, Path, }; diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs index 61786a614..45f9713a0 100644 --- a/crates/ra_hir/src/generics.rs +++ b/crates/ra_hir/src/generics.rs @@ -5,12 +5,14 @@ use std::sync::Arc; -use hir_def::name::{self, AsName}; +use hir_def::{ + name::{self, AsName}, + path::Path, +}; use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; use crate::{ db::{AstDatabase, DefDatabase, HirDatabase}, - path::Path, type_ref::{TypeBound, TypeRef}, Adt, Const, Container, Enum, EnumVariant, Function, HasSource, ImplBlock, Name, Struct, Trait, TypeAlias, Union, diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 620911459..e723a1f40 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -32,7 +32,6 @@ pub mod debug; pub mod db; #[macro_use] pub mod mock; -mod path; pub mod source_binder; mod ids; @@ -71,7 +70,6 @@ pub use crate::{ ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile}, impl_block::ImplBlock, nameres::{ImportId, Namespace, PerNs}, - path::{Path, PathKind}, resolve::ScopeDef, source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, ty::{ @@ -88,4 +86,7 @@ pub use self::code_model::{ ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, }; -pub use hir_def::name::Name; +pub use hir_def::{ + name::Name, + path::{Path, PathKind}, +}; diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs deleted file mode 100644 index 7f0ff4bfc..000000000 --- a/crates/ra_hir/src/path.rs +++ /dev/null @@ -1 +0,0 @@ -pub use hir_def::path::*; diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index b9459552b..2a783b61e 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use hir_def::{ name::{self, Name}, + path::{Path, PathKind}, CrateModuleId, }; use rustc_hash::FxHashSet; @@ -17,7 +18,6 @@ use crate::{ generics::GenericParams, impl_block::ImplBlock, nameres::{CrateDefMap, PerNs}, - path::{Path, PathKind}, Adt, BuiltinType, Const, Enum, EnumVariant, Function, MacroDef, ModuleDef, Static, Struct, Trait, TypeAlias, }; diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 8a1fa29a4..544433a0a 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -7,7 +7,7 @@ //! purely for "IDE needs". use std::sync::Arc; -use hir_def::name::AsName; +use hir_def::{name::AsName, path::known}; use ra_db::FileId; use ra_syntax::{ ast::{self, AstNode}, @@ -25,7 +25,6 @@ use crate::{ BodySourceMap, }, ids::LocationCtx, - path::known, resolve::{ScopeDef, TypeNs, ValueNs}, ty::method_resolution::implements_trait, Const, DefWithBody, Either, Enum, FromSource, Function, HasBody, HirFileId, MacroDef, Module, diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 92b8e718e..05c6b5aad 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; use rustc_hash::FxHashMap; -use hir_def::name; +use hir_def::{name, path::known}; use ra_arena::map::ArenaMap; use ra_prof::profile; use test_utils::tested_by; @@ -38,7 +38,6 @@ use crate::{ db::HirDatabase, diagnostics::DiagnosticSink, expr::{BindingAnnotation, Body, ExprId, PatId}, - path::known, resolve::{Resolver, TypeNs}, ty::infer::diagnostics::InferenceDiagnostic, type_ref::{Mutability, TypeRef}, diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs index 7ef87bfe2..bc6437b44 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs @@ -3,7 +3,10 @@ use std::iter::{repeat, repeat_with}; use std::sync::Arc; -use hir_def::name; +use hir_def::{ + name, + path::{GenericArg, GenericArgs}, +}; use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; use crate::{ @@ -11,7 +14,6 @@ use crate::{ expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, generics::{GenericParams, HasGenericParams}, nameres::Namespace, - path::{GenericArg, GenericArgs}, ty::{ autoderef, method_resolution, op, primitive, CallableDef, InferTy, Mutability, Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index db979353a..77aa35ce1 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs @@ -1,5 +1,7 @@ //! Path expression resolution. +use hir_def::path::PathSegment; + use super::{ExprOrPatId, InferenceContext, TraitRef}; use crate::{ db::HirDatabase, @@ -131,7 +133,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { fn resolve_trait_assoc_item( &mut self, trait_ref: TraitRef, - segment: &crate::path::PathSegment, + segment: &PathSegment, id: ExprOrPatId, ) -> Option<(ValueNs, Option)> { let trait_ = trait_ref.trait_; @@ -170,7 +172,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { fn resolve_ty_assoc_item( &mut self, ty: Ty, - segment: &crate::path::PathSegment, + segment: &PathSegment, id: ExprOrPatId, ) -> Option<(ValueNs, Option)> { if let Ty::Unknown = ty { diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 366556134..b131b306c 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs @@ -8,6 +8,8 @@ use std::iter; use std::sync::Arc; +use hir_def::path::{GenericArg, PathSegment}; + use super::{ FnSig, GenericPredicate, ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, @@ -18,7 +20,6 @@ use crate::{ generics::HasGenericParams, generics::{GenericDef, WherePredicate}, nameres::Namespace, - path::{GenericArg, PathSegment}, resolve::{Resolver, TypeNs}, ty::Adt, type_ref::{TypeBound, TypeRef}, -- cgit v1.2.3