aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-15 16:06:52 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-15 16:06:52 +0000
commit72a4951023f11adfdf0eac353c99d8a01a9471fc (patch)
tree8cca098650d989ea58e6bd4aafd44e5ff85fcee5 /crates/ra_hir/src/expr.rs
parent7c977a7dcd2bac3b6148f2428bcb586c6354d775 (diff)
parent18e9a710cd2f2ced84fde19e88d0b967dcb5939e (diff)
Merge #553
553: remove Cancelable from fn_scopes r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r--crates/ra_hir/src/expr.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index a1e8da348..4e8dc0c54 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -4,10 +4,8 @@ use std::sync::Arc;
4use rustc_hash::FxHashMap; 4use rustc_hash::FxHashMap;
5 5
6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; 6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
7use ra_db::{LocalSyntaxPtr, Cancelable}; 7use ra_db::LocalSyntaxPtr;
8use ra_syntax::{ 8use ra_syntax::ast::{self, AstNode, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor};
9 ast::{self, AstNode, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor}
10};
11 9
12use crate::{Path, type_ref::{Mutability, TypeRef}, Name, HirDatabase, DefId, Def, name::AsName}; 10use crate::{Path, type_ref::{Mutability, TypeRef}, Name, HirDatabase, DefId, Def, name::AsName};
13use crate::ty::primitive::{UintTy, UncertainIntTy, UncertainFloatTy}; 11use crate::ty::primitive::{UintTy, UncertainIntTy, UncertainFloatTy};
@@ -358,8 +356,8 @@ impl Pat {
358 356
359// Queries 357// Queries
360 358
361pub(crate) fn body_hir(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<Body>> { 359pub(crate) fn body_hir(db: &impl HirDatabase, def_id: DefId) -> Arc<Body> {
362 Ok(Arc::clone(&body_syntax_mapping(db, def_id)?.body)) 360 Arc::clone(&body_syntax_mapping(db, def_id).body)
363} 361}
364 362
365struct ExprCollector { 363struct ExprCollector {
@@ -828,10 +826,7 @@ pub(crate) fn collect_fn_body_syntax(node: &ast::FnDef) -> BodySyntaxMapping {
828 collector.into_body_syntax_mapping(params, body) 826 collector.into_body_syntax_mapping(params, body)
829} 827}
830 828
831pub(crate) fn body_syntax_mapping( 829pub(crate) fn body_syntax_mapping(db: &impl HirDatabase, def_id: DefId) -> Arc<BodySyntaxMapping> {
832 db: &impl HirDatabase,
833 def_id: DefId,
834) -> Cancelable<Arc<BodySyntaxMapping>> {
835 let def = def_id.resolve(db); 830 let def = def_id.resolve(db);
836 831
837 let body_syntax_mapping = match def { 832 let body_syntax_mapping = match def {
@@ -840,5 +835,5 @@ pub(crate) fn body_syntax_mapping(
840 _ => panic!("Trying to get body for item type without body"), 835 _ => panic!("Trying to get body for item type without body"),
841 }; 836 };
842 837
843 Ok(Arc::new(body_syntax_mapping)) 838 Arc::new(body_syntax_mapping)
844} 839}