aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir_def/src/path.rs11
-rw-r--r--crates/ra_hir_def/src/type_ref.rs8
2 files changed, 11 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index 626ebffdc..94f6a27bc 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -66,7 +66,7 @@ pub enum PathKind {
66 66
67impl Path { 67impl Path {
68 /// Calls `cb` with all paths, represented by this use item. 68 /// Calls `cb` with all paths, represented by this use item.
69 pub fn expand_use_item( 69 pub(crate) fn expand_use_item(
70 item_src: Source<ast::UseItem>, 70 item_src: Source<ast::UseItem>,
71 hygiene: &Hygiene, 71 hygiene: &Hygiene,
72 mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>), 72 mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>),
@@ -76,7 +76,10 @@ impl Path {
76 } 76 }
77 } 77 }
78 78
79 pub fn from_simple_segments(kind: PathKind, segments: impl IntoIterator<Item = Name>) -> Path { 79 pub(crate) fn from_simple_segments(
80 kind: PathKind,
81 segments: impl IntoIterator<Item = Name>,
82 ) -> Path {
80 Path { 83 Path {
81 kind, 84 kind,
82 segments: segments 85 segments: segments
@@ -94,7 +97,7 @@ impl Path {
94 97
95 /// Converts an `ast::Path` to `Path`. Works with use trees. 98 /// Converts an `ast::Path` to `Path`. Works with use trees.
96 /// It correctly handles `$crate` based path from macro call. 99 /// It correctly handles `$crate` based path from macro call.
97 pub fn from_src(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> { 100 pub(crate) fn from_src(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> {
98 let mut kind = PathKind::Plain; 101 let mut kind = PathKind::Plain;
99 let mut segments = Vec::new(); 102 let mut segments = Vec::new();
100 loop { 103 loop {
@@ -227,7 +230,7 @@ impl Path {
227} 230}
228 231
229impl GenericArgs { 232impl GenericArgs {
230 pub fn from_ast(node: ast::TypeArgList) -> Option<GenericArgs> { 233 pub(crate) fn from_ast(node: ast::TypeArgList) -> Option<GenericArgs> {
231 let mut args = Vec::new(); 234 let mut args = Vec::new();
232 for type_arg in node.type_args() { 235 for type_arg in node.type_args() {
233 let type_ref = TypeRef::from_ast_opt(type_arg.type_ref()); 236 let type_ref = TypeRef::from_ast_opt(type_arg.type_ref());
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs
index 8af061116..5f10e9a88 100644
--- a/crates/ra_hir_def/src/type_ref.rs
+++ b/crates/ra_hir_def/src/type_ref.rs
@@ -64,7 +64,7 @@ pub enum TypeBound {
64 64
65impl TypeRef { 65impl TypeRef {
66 /// Converts an `ast::TypeRef` to a `hir::TypeRef`. 66 /// Converts an `ast::TypeRef` to a `hir::TypeRef`.
67 pub fn from_ast(node: ast::TypeRef) -> Self { 67 pub(crate) fn from_ast(node: ast::TypeRef) -> Self {
68 match node { 68 match node {
69 ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(inner.type_ref()), 69 ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(inner.type_ref()),
70 ast::TypeRef::TupleType(inner) => { 70 ast::TypeRef::TupleType(inner) => {
@@ -113,7 +113,7 @@ impl TypeRef {
113 } 113 }
114 } 114 }
115 115
116 pub fn from_ast_opt(node: Option<ast::TypeRef>) -> Self { 116 pub(crate) fn from_ast_opt(node: Option<ast::TypeRef>) -> Self {
117 if let Some(node) = node { 117 if let Some(node) = node {
118 TypeRef::from_ast(node) 118 TypeRef::from_ast(node)
119 } else { 119 } else {
@@ -121,7 +121,7 @@ impl TypeRef {
121 } 121 }
122 } 122 }
123 123
124 pub fn unit() -> TypeRef { 124 pub(crate) fn unit() -> TypeRef {
125 TypeRef::Tuple(Vec::new()) 125 TypeRef::Tuple(Vec::new())
126 } 126 }
127} 127}
@@ -135,7 +135,7 @@ pub(crate) fn type_bounds_from_ast(type_bounds_opt: Option<ast::TypeBoundList>)
135} 135}
136 136
137impl TypeBound { 137impl TypeBound {
138 pub fn from_ast(node: ast::TypeBound) -> Self { 138 pub(crate) fn from_ast(node: ast::TypeBound) -> Self {
139 match node.kind() { 139 match node.kind() {
140 ast::TypeBoundKind::PathType(path_type) => { 140 ast::TypeBoundKind::PathType(path_type) => {
141 let path = match path_type.path() { 141 let path = match path_type.path() {