diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir/src/expr.rs | 14 | ||||
-rw-r--r-- | crates/ra_hir/src/expr/scope.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/generics.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/impl_block.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/path.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/resolve.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 46 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 2 |
13 files changed, 53 insertions, 53 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index b00481cd5..62301e4ab 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -51,7 +51,7 @@ impl Crate { | |||
51 | crate_graph.edition(self.crate_id) | 51 | crate_graph.edition(self.crate_id) |
52 | } | 52 | } |
53 | 53 | ||
54 | // TODO: should this be in source_binder? | 54 | // FIXME: should this be in source_binder? |
55 | pub fn source_root_crates( | 55 | pub fn source_root_crates( |
56 | db: &impl PersistentHirDatabase, | 56 | db: &impl PersistentHirDatabase, |
57 | source_root: SourceRootId, | 57 | source_root: SourceRootId, |
@@ -301,7 +301,7 @@ impl Struct { | |||
301 | db.type_for_def((*self).into(), Namespace::Values) | 301 | db.type_for_def((*self).into(), Namespace::Values) |
302 | } | 302 | } |
303 | 303 | ||
304 | // TODO move to a more general type | 304 | // FIXME move to a more general type |
305 | /// Builds a resolver for type references inside this struct. | 305 | /// Builds a resolver for type references inside this struct. |
306 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { | 306 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { |
307 | // take the outer scope... | 307 | // take the outer scope... |
@@ -361,7 +361,7 @@ impl Enum { | |||
361 | db.type_for_def((*self).into(), Namespace::Types) | 361 | db.type_for_def((*self).into(), Namespace::Types) |
362 | } | 362 | } |
363 | 363 | ||
364 | // TODO: move to a more general type | 364 | // FIXME: move to a more general type |
365 | /// Builds a resolver for type references inside this struct. | 365 | /// Builds a resolver for type references inside this struct. |
366 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { | 366 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { |
367 | // take the outer scope... | 367 | // take the outer scope... |
@@ -513,7 +513,7 @@ impl Function { | |||
513 | ImplBlock::containing(module_impls, (*self).into()) | 513 | ImplBlock::containing(module_impls, (*self).into()) |
514 | } | 514 | } |
515 | 515 | ||
516 | // TODO: move to a more general type for 'body-having' items | 516 | // FIXME: move to a more general type for 'body-having' items |
517 | /// Builds a resolver for code inside this item. | 517 | /// Builds a resolver for code inside this item. |
518 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { | 518 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { |
519 | // take the outer scope... | 519 | // take the outer scope... |
@@ -558,7 +558,7 @@ impl Const { | |||
558 | ImplBlock::containing(module_impls, (*self).into()) | 558 | ImplBlock::containing(module_impls, (*self).into()) |
559 | } | 559 | } |
560 | 560 | ||
561 | // TODO: move to a more general type for 'body-having' items | 561 | // FIXME: move to a more general type for 'body-having' items |
562 | /// Builds a resolver for code inside this item. | 562 | /// Builds a resolver for code inside this item. |
563 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { | 563 | pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { |
564 | // take the outer scope... | 564 | // take the outer scope... |
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 0fadab560..703d99d9b 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -27,7 +27,7 @@ impl_arena_id!(ExprId); | |||
27 | /// The body of an item (function, const etc.). | 27 | /// The body of an item (function, const etc.). |
28 | #[derive(Debug, Eq, PartialEq)] | 28 | #[derive(Debug, Eq, PartialEq)] |
29 | pub struct Body { | 29 | pub struct Body { |
30 | // TODO: this should be more general, consts & statics also have bodies | 30 | // FIXME: this should be more general, consts & statics also have bodies |
31 | /// The Function of the item this body belongs to | 31 | /// The Function of the item this body belongs to |
32 | owner: Function, | 32 | owner: Function, |
33 | exprs: Arena<ExprId, Expr>, | 33 | exprs: Arena<ExprId, Expr>, |
@@ -406,7 +406,7 @@ pub enum Pat { | |||
406 | Struct { | 406 | Struct { |
407 | path: Option<Path>, | 407 | path: Option<Path>, |
408 | args: Vec<FieldPat>, | 408 | args: Vec<FieldPat>, |
409 | // TODO: 'ellipsis' option | 409 | // FIXME: 'ellipsis' option |
410 | }, | 410 | }, |
411 | Range { | 411 | Range { |
412 | start: ExprId, | 412 | start: ExprId, |
@@ -547,7 +547,7 @@ impl ExprCollector { | |||
547 | if condition.pat().is_none() { | 547 | if condition.pat().is_none() { |
548 | self.collect_expr_opt(condition.expr()) | 548 | self.collect_expr_opt(condition.expr()) |
549 | } else { | 549 | } else { |
550 | // TODO handle while let | 550 | // FIXME handle while let |
551 | return self.alloc_expr(Expr::Missing, syntax_ptr); | 551 | return self.alloc_expr(Expr::Missing, syntax_ptr); |
552 | } | 552 | } |
553 | } else { | 553 | } else { |
@@ -610,7 +610,7 @@ impl ExprCollector { | |||
610 | self.alloc_expr(path, syntax_ptr) | 610 | self.alloc_expr(path, syntax_ptr) |
611 | } | 611 | } |
612 | ast::ExprKind::ContinueExpr(_e) => { | 612 | ast::ExprKind::ContinueExpr(_e) => { |
613 | // TODO: labels | 613 | // FIXME: labels |
614 | self.alloc_expr(Expr::Continue, syntax_ptr) | 614 | self.alloc_expr(Expr::Continue, syntax_ptr) |
615 | } | 615 | } |
616 | ast::ExprKind::BreakExpr(e) => { | 616 | ast::ExprKind::BreakExpr(e) => { |
@@ -751,7 +751,7 @@ impl ExprCollector { | |||
751 | self.alloc_expr(Expr::Literal(lit), syntax_ptr) | 751 | self.alloc_expr(Expr::Literal(lit), syntax_ptr) |
752 | } | 752 | } |
753 | 753 | ||
754 | // TODO implement HIR for these: | 754 | // FIXME implement HIR for these: |
755 | ast::ExprKind::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 755 | ast::ExprKind::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
756 | ast::ExprKind::IndexExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 756 | ast::ExprKind::IndexExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
757 | ast::ExprKind::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 757 | ast::ExprKind::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
@@ -844,7 +844,7 @@ impl ExprCollector { | |||
844 | Pat::Struct { path, args: fields } | 844 | Pat::Struct { path, args: fields } |
845 | } | 845 | } |
846 | 846 | ||
847 | // TODO: implement | 847 | // FIXME: implement |
848 | ast::PatKind::LiteralPat(_) => Pat::Missing, | 848 | ast::PatKind::LiteralPat(_) => Pat::Missing, |
849 | ast::PatKind::SlicePat(_) | ast::PatKind::RangePat(_) => Pat::Missing, | 849 | ast::PatKind::SlicePat(_) | ast::PatKind::RangePat(_) => Pat::Missing, |
850 | }; | 850 | }; |
@@ -910,7 +910,7 @@ pub(crate) fn body_with_source_map_query( | |||
910 | ) -> (Arc<Body>, Arc<BodySourceMap>) { | 910 | ) -> (Arc<Body>, Arc<BodySourceMap>) { |
911 | let mut collector = ExprCollector::new(func); | 911 | let mut collector = ExprCollector::new(func); |
912 | 912 | ||
913 | // TODO: consts, etc. | 913 | // FIXME: consts, etc. |
914 | collector.collect_fn_body(&func.source(db).1); | 914 | collector.collect_fn_body(&func.source(db).1); |
915 | 915 | ||
916 | let (body, source_map) = collector.finish(); | 916 | let (body, source_map) = collector.finish(); |
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index 81fbc509e..ed005c9f7 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs | |||
@@ -39,7 +39,7 @@ pub struct ScopeData { | |||
39 | } | 39 | } |
40 | 40 | ||
41 | impl ExprScopes { | 41 | impl ExprScopes { |
42 | // TODO: This should take something more general than Function | 42 | // FIXME: This should take something more general than Function |
43 | pub(crate) fn expr_scopes_query(db: &impl HirDatabase, function: Function) -> Arc<ExprScopes> { | 43 | pub(crate) fn expr_scopes_query(db: &impl HirDatabase, function: Function) -> Arc<ExprScopes> { |
44 | let body = db.body_hir(function); | 44 | let body = db.body_hir(function); |
45 | let res = ExprScopes::new(body); | 45 | let res = ExprScopes::new(body); |
@@ -148,7 +148,7 @@ impl ScopesWithSourceMap { | |||
148 | 148 | ||
149 | // XXX: during completion, cursor might be outside of any particular | 149 | // XXX: during completion, cursor might be outside of any particular |
150 | // expression. Try to figure out the correct scope... | 150 | // expression. Try to figure out the correct scope... |
151 | // TODO: move this to source binder? | 151 | // FIXME: move this to source binder? |
152 | fn adjust(&self, ptr: SyntaxNodePtr, original_scope: ScopeId, offset: TextUnit) -> ScopeId { | 152 | fn adjust(&self, ptr: SyntaxNodePtr, original_scope: ScopeId, offset: TextUnit) -> ScopeId { |
153 | let r = ptr.range(); | 153 | let r = ptr.range(); |
154 | let child_scopes = self | 154 | let child_scopes = self |
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs index 0f759a235..498ed04f2 100644 --- a/crates/ra_hir/src/generics.rs +++ b/crates/ra_hir/src/generics.rs | |||
@@ -15,7 +15,7 @@ use crate::{ | |||
15 | /// Data about a generic parameter (to a function, struct, impl, ...). | 15 | /// Data about a generic parameter (to a function, struct, impl, ...). |
16 | #[derive(Clone, PartialEq, Eq, Debug)] | 16 | #[derive(Clone, PartialEq, Eq, Debug)] |
17 | pub struct GenericParam { | 17 | pub struct GenericParam { |
18 | // TODO: give generic params proper IDs | 18 | // FIXME: give generic params proper IDs |
19 | pub(crate) idx: u32, | 19 | pub(crate) idx: u32, |
20 | pub(crate) name: Name, | 20 | pub(crate) name: Name, |
21 | } | 21 | } |
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index 8807a4b56..0d3861a28 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs | |||
@@ -161,7 +161,7 @@ impl ImplData { | |||
161 | } | 161 | } |
162 | 162 | ||
163 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 163 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
164 | //TODO: rename to ImplDef? | 164 | //FIXME: rename to ImplDef? |
165 | pub enum ImplItem { | 165 | pub enum ImplItem { |
166 | Method(Function), | 166 | Method(Function), |
167 | Const(Const), | 167 | Const(Const), |
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index edd2f25f7..e9235bc59 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -296,7 +296,7 @@ impl CrateDefMap { | |||
296 | // plain import or absolute path in 2015: crate-relative with | 296 | // plain import or absolute path in 2015: crate-relative with |
297 | // fallback to extern prelude (with the simplification in | 297 | // fallback to extern prelude (with the simplification in |
298 | // rust-lang/rust#57745) | 298 | // rust-lang/rust#57745) |
299 | // TODO there must be a nicer way to write this condition | 299 | // FIXME there must be a nicer way to write this condition |
300 | PathKind::Plain | PathKind::Abs | 300 | PathKind::Plain | PathKind::Abs |
301 | if self.edition == Edition::Edition2015 | 301 | if self.edition == Edition::Edition2015 |
302 | && (path.kind == PathKind::Abs || mode == ResolveMode::Import) => | 302 | && (path.kind == PathKind::Abs || mode == ResolveMode::Import) => |
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index 6ca373e34..6cc8104f4 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs | |||
@@ -96,7 +96,7 @@ impl Path { | |||
96 | if let Some(q) = path.qualifier() { | 96 | if let Some(q) = path.qualifier() { |
97 | return Some(q); | 97 | return Some(q); |
98 | } | 98 | } |
99 | // TODO: this bottom up traversal is not too precise. | 99 | // FIXME: this bottom up traversal is not too precise. |
100 | // Should we handle do a top-down analysis, recording results? | 100 | // Should we handle do a top-down analysis, recording results? |
101 | let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?; | 101 | let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?; |
102 | let use_tree = use_tree_list.parent_use_tree(); | 102 | let use_tree = use_tree_list.parent_use_tree(); |
@@ -166,7 +166,7 @@ fn expand_use_tree<'a>( | |||
166 | // or `use something::{path::{inner::{innerer}}}` (prefix is `something::path`, path is `inner`) | 166 | // or `use something::{path::{inner::{innerer}}}` (prefix is `something::path`, path is `inner`) |
167 | Some(path) => match convert_path(prefix, path) { | 167 | Some(path) => match convert_path(prefix, path) { |
168 | Some(it) => Some(it), | 168 | Some(it) => Some(it), |
169 | None => return, // TODO: report errors somewhere | 169 | None => return, // FIXME: report errors somewhere |
170 | }, | 170 | }, |
171 | }; | 171 | }; |
172 | for child_tree in use_tree_list.use_trees() { | 172 | for child_tree in use_tree_list.use_trees() { |
@@ -194,7 +194,7 @@ fn expand_use_tree<'a>( | |||
194 | cb(path, Some(segment), alias) | 194 | cb(path, Some(segment), alias) |
195 | }; | 195 | }; |
196 | } | 196 | } |
197 | // TODO: report errors somewhere | 197 | // FIXME: report errors somewhere |
198 | // We get here if we do | 198 | // We get here if we do |
199 | } | 199 | } |
200 | } | 200 | } |
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index 59af4ec60..f28154517 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs | |||
@@ -19,7 +19,7 @@ pub struct Resolver { | |||
19 | scopes: Vec<Scope>, | 19 | scopes: Vec<Scope>, |
20 | } | 20 | } |
21 | 21 | ||
22 | // TODO how to store these best | 22 | // FIXME how to store these best |
23 | #[derive(Debug, Clone)] | 23 | #[derive(Debug, Clone)] |
24 | pub(crate) struct ModuleItemMap { | 24 | pub(crate) struct ModuleItemMap { |
25 | crate_def_map: Arc<CrateDefMap>, | 25 | crate_def_map: Arc<CrateDefMap>, |
@@ -260,7 +260,7 @@ impl Scope { | |||
260 | fn collect_names(&self, db: &impl HirDatabase, f: &mut dyn FnMut(Name, PerNs<Resolution>)) { | 260 | fn collect_names(&self, db: &impl HirDatabase, f: &mut dyn FnMut(Name, PerNs<Resolution>)) { |
261 | match self { | 261 | match self { |
262 | Scope::ModuleScope(m) => { | 262 | Scope::ModuleScope(m) => { |
263 | // TODO: should we provide `self` here? | 263 | // FIXME: should we provide `self` here? |
264 | // f( | 264 | // f( |
265 | // Name::self_param(), | 265 | // Name::self_param(), |
266 | // PerNs::types(Resolution::Def { | 266 | // PerNs::types(Resolution::Def { |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 902110913..3645b73b4 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -164,7 +164,7 @@ pub fn resolver_for_position(db: &impl HirDatabase, position: FilePosition) -> R | |||
164 | let scope = scopes.scope_for_offset(position.offset); | 164 | let scope = scopes.scope_for_offset(position.offset); |
165 | Some(expr::resolver_for_scope(func.body(db), db, scope)) | 165 | Some(expr::resolver_for_scope(func.body(db), db, scope)) |
166 | } else { | 166 | } else { |
167 | // TODO const/static/array length | 167 | // FIXME const/static/array length |
168 | None | 168 | None |
169 | } | 169 | } |
170 | } else { | 170 | } else { |
@@ -184,7 +184,7 @@ pub fn resolver_for_node(db: &impl HirDatabase, file_id: FileId, node: &SyntaxNo | |||
184 | let scope = scopes.scope_for(&node); | 184 | let scope = scopes.scope_for(&node); |
185 | Some(expr::resolver_for_scope(func.body(db), db, scope)) | 185 | Some(expr::resolver_for_scope(func.body(db), db, scope)) |
186 | } else { | 186 | } else { |
187 | // TODO const/static/array length | 187 | // FIXME const/static/array length |
188 | None | 188 | None |
189 | } | 189 | } |
190 | } else { | 190 | } else { |
@@ -212,7 +212,7 @@ fn try_get_resolver_for_node( | |||
212 | } else if let Some(f) = ast::FnDef::cast(node) { | 212 | } else if let Some(f) = ast::FnDef::cast(node) { |
213 | function_from_source(db, file_id, f).map(|f| f.resolver(db)) | 213 | function_from_source(db, file_id, f).map(|f| f.resolver(db)) |
214 | } else { | 214 | } else { |
215 | // TODO add missing cases | 215 | // FIXME add missing cases |
216 | None | 216 | None |
217 | } | 217 | } |
218 | } | 218 | } |
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index d95879e46..ab5f008ef 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -15,7 +15,7 @@ impl Ty { | |||
15 | } | 15 | } |
16 | 16 | ||
17 | fn autoderef_step(&self, _db: &impl HirDatabase) -> Option<Ty> { | 17 | fn autoderef_step(&self, _db: &impl HirDatabase) -> Option<Ty> { |
18 | // TODO Deref::deref | 18 | // FIXME Deref::deref |
19 | self.builtin_deref() | 19 | self.builtin_deref() |
20 | } | 20 | } |
21 | } | 21 | } |
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 7cf465266..132ee0ca2 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -207,7 +207,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
207 | fn make_ty(&mut self, type_ref: &TypeRef) -> Ty { | 207 | fn make_ty(&mut self, type_ref: &TypeRef) -> Ty { |
208 | let ty = Ty::from_hir( | 208 | let ty = Ty::from_hir( |
209 | self.db, | 209 | self.db, |
210 | // TODO use right resolver for block | 210 | // FIXME use right resolver for block |
211 | &self.resolver, | 211 | &self.resolver, |
212 | type_ref, | 212 | type_ref, |
213 | ); | 213 | ); |
@@ -414,11 +414,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
414 | return None; | 414 | return None; |
415 | } | 415 | } |
416 | Resolution::GenericParam(..) => { | 416 | Resolution::GenericParam(..) => { |
417 | // TODO associated item of generic param | 417 | // FIXME associated item of generic param |
418 | return None; | 418 | return None; |
419 | } | 419 | } |
420 | Resolution::SelfType(_) => { | 420 | Resolution::SelfType(_) => { |
421 | // TODO associated item of self type | 421 | // FIXME associated item of self type |
422 | return None; | 422 | return None; |
423 | } | 423 | } |
424 | }; | 424 | }; |
@@ -446,7 +446,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
449 | // TODO: Resolve associated types | 449 | // FIXME: Resolve associated types |
450 | crate::ImplItem::TypeAlias(_) => None, | 450 | crate::ImplItem::TypeAlias(_) => None, |
451 | }; | 451 | }; |
452 | match matching_def { | 452 | match matching_def { |
@@ -504,7 +504,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
504 | return (Ty::Unknown, None); | 504 | return (Ty::Unknown, None); |
505 | } | 505 | } |
506 | Some(Resolution::SelfType(..)) => { | 506 | Some(Resolution::SelfType(..)) => { |
507 | // TODO this is allowed in an impl for a struct, handle this | 507 | // FIXME this is allowed in an impl for a struct, handle this |
508 | return (Ty::Unknown, None); | 508 | return (Ty::Unknown, None); |
509 | } | 509 | } |
510 | None => return (Ty::Unknown, None), | 510 | None => return (Ty::Unknown, None), |
@@ -513,7 +513,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
513 | None => return (Ty::Unknown, None), | 513 | None => return (Ty::Unknown, None), |
514 | Some(it) => it, | 514 | Some(it) => it, |
515 | }; | 515 | }; |
516 | // TODO remove the duplication between here and `Ty::from_path`? | 516 | // FIXME remove the duplication between here and `Ty::from_path`? |
517 | let substs = Ty::substs_from_path(self.db, resolver, path, def); | 517 | let substs = Ty::substs_from_path(self.db, resolver, path, def); |
518 | match def { | 518 | match def { |
519 | TypableDef::Struct(s) => { | 519 | TypableDef::Struct(s) => { |
@@ -590,7 +590,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
590 | | Pat::Struct { .. } | 590 | | Pat::Struct { .. } |
591 | | Pat::Range { .. } | 591 | | Pat::Range { .. } |
592 | | Pat::Slice { .. } => true, | 592 | | Pat::Slice { .. } => true, |
593 | // TODO: Path/Lit might actually evaluate to ref, but inference is unimplemented. | 593 | // FIXME: Path/Lit might actually evaluate to ref, but inference is unimplemented. |
594 | Pat::Path(..) | Pat::Lit(..) => true, | 594 | Pat::Path(..) | Pat::Lit(..) => true, |
595 | Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Missing => false, | 595 | Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Missing => false, |
596 | }; | 596 | }; |
@@ -635,7 +635,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
635 | let expectation = match expected.as_reference() { | 635 | let expectation = match expected.as_reference() { |
636 | Some((inner_ty, exp_mut)) => { | 636 | Some((inner_ty, exp_mut)) => { |
637 | if *mutability != exp_mut { | 637 | if *mutability != exp_mut { |
638 | // TODO: emit type error? | 638 | // FIXME: emit type error? |
639 | } | 639 | } |
640 | inner_ty | 640 | inner_ty |
641 | } | 641 | } |
@@ -651,7 +651,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
651 | self.infer_struct_pat(p.as_ref(), fields, expected, default_bm) | 651 | self.infer_struct_pat(p.as_ref(), fields, expected, default_bm) |
652 | } | 652 | } |
653 | Pat::Path(path) => { | 653 | Pat::Path(path) => { |
654 | // TODO use correct resolver for the surrounding expression | 654 | // FIXME use correct resolver for the surrounding expression |
655 | let resolver = self.resolver.clone(); | 655 | let resolver = self.resolver.clone(); |
656 | self.infer_path_expr(&resolver, &path, pat.into()).unwrap_or(Ty::Unknown) | 656 | self.infer_path_expr(&resolver, &path, pat.into()).unwrap_or(Ty::Unknown) |
657 | } | 657 | } |
@@ -741,7 +741,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
741 | Expr::Block { statements, tail } => self.infer_block(statements, *tail, expected), | 741 | Expr::Block { statements, tail } => self.infer_block(statements, *tail, expected), |
742 | Expr::Loop { body } => { | 742 | Expr::Loop { body } => { |
743 | self.infer_expr(*body, &Expectation::has_type(Ty::unit())); | 743 | self.infer_expr(*body, &Expectation::has_type(Ty::unit())); |
744 | // TODO handle break with value | 744 | // FIXME handle break with value |
745 | Ty::simple(TypeCtor::Never) | 745 | Ty::simple(TypeCtor::Never) |
746 | } | 746 | } |
747 | Expr::While { condition, body } => { | 747 | Expr::While { condition, body } => { |
@@ -769,7 +769,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
769 | self.infer_pat(*arg_pat, &expected, BindingMode::default()); | 769 | self.infer_pat(*arg_pat, &expected, BindingMode::default()); |
770 | } | 770 | } |
771 | 771 | ||
772 | // TODO: infer lambda type etc. | 772 | // FIXME: infer lambda type etc. |
773 | let _body_ty = self.infer_expr(*body, &Expectation::none()); | 773 | let _body_ty = self.infer_expr(*body, &Expectation::none()); |
774 | Ty::Unknown | 774 | Ty::Unknown |
775 | } | 775 | } |
@@ -795,7 +795,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
795 | }, | 795 | }, |
796 | _ => { | 796 | _ => { |
797 | // not callable | 797 | // not callable |
798 | // TODO report an error? | 798 | // FIXME report an error? |
799 | (Vec::new(), Ty::Unknown) | 799 | (Vec::new(), Ty::Unknown) |
800 | } | 800 | } |
801 | }; | 801 | }; |
@@ -894,14 +894,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
894 | expected.ty | 894 | expected.ty |
895 | } | 895 | } |
896 | Expr::Path(p) => { | 896 | Expr::Path(p) => { |
897 | // TODO this could be more efficient... | 897 | // FIXME this could be more efficient... |
898 | let resolver = expr::resolver_for_expr(self.body.clone(), self.db, tgt_expr); | 898 | let resolver = expr::resolver_for_expr(self.body.clone(), self.db, tgt_expr); |
899 | self.infer_path_expr(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) | 899 | self.infer_path_expr(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) |
900 | } | 900 | } |
901 | Expr::Continue => Ty::simple(TypeCtor::Never), | 901 | Expr::Continue => Ty::simple(TypeCtor::Never), |
902 | Expr::Break { expr } => { | 902 | Expr::Break { expr } => { |
903 | if let Some(expr) = expr { | 903 | if let Some(expr) = expr { |
904 | // TODO handle break with value | 904 | // FIXME handle break with value |
905 | self.infer_expr(*expr, &Expectation::none()); | 905 | self.infer_expr(*expr, &Expectation::none()); |
906 | } | 906 | } |
907 | Ty::simple(TypeCtor::Never) | 907 | Ty::simple(TypeCtor::Never) |
@@ -957,21 +957,21 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
957 | Expr::Cast { expr, type_ref } => { | 957 | Expr::Cast { expr, type_ref } => { |
958 | let _inner_ty = self.infer_expr(*expr, &Expectation::none()); | 958 | let _inner_ty = self.infer_expr(*expr, &Expectation::none()); |
959 | let cast_ty = self.make_ty(type_ref); | 959 | let cast_ty = self.make_ty(type_ref); |
960 | // TODO check the cast... | 960 | // FIXME check the cast... |
961 | cast_ty | 961 | cast_ty |
962 | } | 962 | } |
963 | Expr::Ref { expr, mutability } => { | 963 | Expr::Ref { expr, mutability } => { |
964 | let expectation = | 964 | let expectation = |
965 | if let Some((exp_inner, exp_mutability)) = &expected.ty.as_reference() { | 965 | if let Some((exp_inner, exp_mutability)) = &expected.ty.as_reference() { |
966 | if *exp_mutability == Mutability::Mut && *mutability == Mutability::Shared { | 966 | if *exp_mutability == Mutability::Mut && *mutability == Mutability::Shared { |
967 | // TODO: throw type error - expected mut reference but found shared ref, | 967 | // FIXME: throw type error - expected mut reference but found shared ref, |
968 | // which cannot be coerced | 968 | // which cannot be coerced |
969 | } | 969 | } |
970 | Expectation::has_type(Ty::clone(exp_inner)) | 970 | Expectation::has_type(Ty::clone(exp_inner)) |
971 | } else { | 971 | } else { |
972 | Expectation::none() | 972 | Expectation::none() |
973 | }; | 973 | }; |
974 | // TODO reference coercions etc. | 974 | // FIXME reference coercions etc. |
975 | let inner_ty = self.infer_expr(*expr, &expectation); | 975 | let inner_ty = self.infer_expr(*expr, &expectation); |
976 | Ty::apply_one(TypeCtor::Ref(*mutability), inner_ty) | 976 | Ty::apply_one(TypeCtor::Ref(*mutability), inner_ty) |
977 | } | 977 | } |
@@ -982,7 +982,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
982 | if let Some(derefed_ty) = inner_ty.builtin_deref() { | 982 | if let Some(derefed_ty) = inner_ty.builtin_deref() { |
983 | derefed_ty | 983 | derefed_ty |
984 | } else { | 984 | } else { |
985 | // TODO Deref::deref | 985 | // FIXME Deref::deref |
986 | Ty::Unknown | 986 | Ty::Unknown |
987 | } | 987 | } |
988 | } | 988 | } |
@@ -1002,7 +1002,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1002 | Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => { | 1002 | Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => { |
1003 | inner_ty | 1003 | inner_ty |
1004 | } | 1004 | } |
1005 | // TODO: resolve ops::Neg trait | 1005 | // FIXME: resolve ops::Neg trait |
1006 | _ => Ty::Unknown, | 1006 | _ => Ty::Unknown, |
1007 | } | 1007 | } |
1008 | } | 1008 | } |
@@ -1013,7 +1013,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1013 | _ => Ty::Unknown, | 1013 | _ => Ty::Unknown, |
1014 | }, | 1014 | }, |
1015 | Ty::Infer(InferTy::IntVar(..)) => inner_ty, | 1015 | Ty::Infer(InferTy::IntVar(..)) => inner_ty, |
1016 | // TODO: resolve ops::Not trait for inner_ty | 1016 | // FIXME: resolve ops::Not trait for inner_ty |
1017 | _ => Ty::Unknown, | 1017 | _ => Ty::Unknown, |
1018 | } | 1018 | } |
1019 | } | 1019 | } |
@@ -1028,12 +1028,12 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1028 | _ => Expectation::none(), | 1028 | _ => Expectation::none(), |
1029 | }; | 1029 | }; |
1030 | let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); | 1030 | let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); |
1031 | // TODO: find implementation of trait corresponding to operation | 1031 | // FIXME: find implementation of trait corresponding to operation |
1032 | // symbol and resolve associated `Output` type | 1032 | // symbol and resolve associated `Output` type |
1033 | let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty); | 1033 | let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty); |
1034 | let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); | 1034 | let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); |
1035 | 1035 | ||
1036 | // TODO: similar as above, return ty is often associated trait type | 1036 | // FIXME: similar as above, return ty is often associated trait type |
1037 | op::binary_op_return_ty(*op, rhs_ty) | 1037 | op::binary_op_return_ty(*op, rhs_ty) |
1038 | } | 1038 | } |
1039 | _ => Ty::Unknown, | 1039 | _ => Ty::Unknown, |
@@ -1227,7 +1227,7 @@ impl InferTy { | |||
1227 | #[derive(Clone, PartialEq, Eq, Debug)] | 1227 | #[derive(Clone, PartialEq, Eq, Debug)] |
1228 | struct Expectation { | 1228 | struct Expectation { |
1229 | ty: Ty, | 1229 | ty: Ty, |
1230 | // TODO: In some cases, we need to be aware whether the expectation is that | 1230 | // FIXME: In some cases, we need to be aware whether the expectation is that |
1231 | // the type match exactly what we passed, or whether it just needs to be | 1231 | // the type match exactly what we passed, or whether it just needs to be |
1232 | // coercible to the expected type. See Expectation::rvalue_hint in rustc. | 1232 | // coercible to the expected type. See Expectation::rvalue_hint in rustc. |
1233 | } | 1233 | } |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 7f9af307b..003a89f0d 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -60,7 +60,7 @@ impl Ty { | |||
60 | 60 | ||
61 | pub(crate) fn from_hir_path(db: &impl HirDatabase, resolver: &Resolver, path: &Path) -> Self { | 61 | pub(crate) fn from_hir_path(db: &impl HirDatabase, resolver: &Resolver, path: &Path) -> Self { |
62 | if let Some(name) = path.as_ident() { | 62 | if let Some(name) = path.as_ident() { |
63 | // TODO handle primitive type names in resolver as well? | 63 | // FIXME handle primitive type names in resolver as well? |
64 | if let Some(int_ty) = primitive::IntTy::from_type_name(name) { | 64 | if let Some(int_ty) = primitive::IntTy::from_type_name(name) { |
65 | return Ty::simple(TypeCtor::Int(primitive::UncertainIntTy::Known(int_ty))); | 65 | return Ty::simple(TypeCtor::Int(primitive::UncertainIntTy::Known(int_ty))); |
66 | } else if let Some(float_ty) = primitive::FloatTy::from_type_name(name) { | 66 | } else if let Some(float_ty) = primitive::FloatTy::from_type_name(name) { |
@@ -87,7 +87,7 @@ impl Ty { | |||
87 | Some(Resolution::GenericParam(idx)) => { | 87 | Some(Resolution::GenericParam(idx)) => { |
88 | return Ty::Param { | 88 | return Ty::Param { |
89 | idx, | 89 | idx, |
90 | // TODO: maybe return name in resolution? | 90 | // FIXME: maybe return name in resolution? |
91 | name: path | 91 | name: path |
92 | .as_ident() | 92 | .as_ident() |
93 | .expect("generic param should be single-segment path") | 93 | .expect("generic param should be single-segment path") |
@@ -139,7 +139,7 @@ impl Ty { | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | // add placeholders for args that were not provided | 141 | // add placeholders for args that were not provided |
142 | // TODO: handle defaults | 142 | // FIXME: handle defaults |
143 | let supplied_params = substs.len(); | 143 | let supplied_params = substs.len(); |
144 | for _ in supplied_params..def_generics.count_params_including_parent() { | 144 | for _ in supplied_params..def_generics.count_params_including_parent() { |
145 | substs.push(Ty::Unknown); | 145 | substs.push(Ty::Unknown); |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index ed75bfaee..b1684acf9 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -120,7 +120,7 @@ fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Option<Crate> { | |||
120 | } | 120 | } |
121 | 121 | ||
122 | impl Ty { | 122 | impl Ty { |
123 | // TODO: cache this as a query? | 123 | // FIXME: cache this as a query? |
124 | // - if so, what signature? (TyFingerprint, Name)? | 124 | // - if so, what signature? (TyFingerprint, Name)? |
125 | // - or maybe cache all names and def_ids of methods per fingerprint? | 125 | // - or maybe cache all names and def_ids of methods per fingerprint? |
126 | /// Look up the method with the given name, returning the actual autoderefed | 126 | /// Look up the method with the given name, returning the actual autoderefed |