aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/path.rs
diff options
context:
space:
mode:
authoruHOOCCOOHu <[email protected]>2019-09-15 13:14:33 +0100
committeruHOOCCOOHu <[email protected]>2019-09-15 13:14:33 +0100
commit7ed3be32916facf3b709d5277381408cd3ec134a (patch)
tree7ac9169b41465315ca1c5541c096ea61ac789357 /crates/ra_hir/src/path.rs
parentde9670fe456d89f97e8044d4e0919d2c16d1087f (diff)
Define known paths and group names
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r--crates/ra_hir/src/path.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 9e449f6cc..a61161b63 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -234,7 +234,7 @@ impl GenericArgs {
234 } 234 }
235 if let Some(ret_type) = ret_type { 235 if let Some(ret_type) = ret_type {
236 let type_ref = TypeRef::from_ast_opt(ret_type.type_ref()); 236 let type_ref = TypeRef::from_ast_opt(ret_type.type_ref());
237 bindings.push((name::OUTPUT, type_ref)) 237 bindings.push((name::OUTPUT_TYPE, type_ref))
238 } 238 }
239 if args.is_empty() && bindings.is_empty() { 239 if args.is_empty() && bindings.is_empty() {
240 None 240 None
@@ -338,3 +338,31 @@ fn convert_path(prefix: Option<Path>, path: ast::Path) -> Option<Path> {
338 }; 338 };
339 Some(res) 339 Some(res)
340} 340}
341
342pub mod known {
343 use super::{Path, PathKind};
344 use crate::name;
345
346 pub fn std_iter_into_iterator() -> Path {
347 Path::from_simple_segments(
348 PathKind::Abs,
349 vec![name::STD, name::ITER, name::INTO_ITERATOR_TYPE],
350 )
351 }
352
353 pub fn std_ops_try() -> Path {
354 Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::TRY_TYPE])
355 }
356
357 pub fn std_result_result() -> Path {
358 Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::RESULT, name::RESULT_TYPE])
359 }
360
361 pub fn std_future_future() -> Path {
362 Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::FUTURE, name::FUTURE_TYPE])
363 }
364
365 pub fn std_boxed_box() -> Path {
366 Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::BOXED, name::BOX_TYPE])
367 }
368}