From 4fd8cfd6adc554752a63aed9ed71d44b372ec4dc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 23 Mar 2019 10:53:48 +0300 Subject: replace todo with fixme --- crates/ra_hir/src/code_model_api.rs | 10 +++---- crates/ra_hir/src/expr.rs | 14 +++++----- crates/ra_hir/src/expr/scope.rs | 4 +-- crates/ra_hir/src/generics.rs | 2 +- crates/ra_hir/src/impl_block.rs | 2 +- crates/ra_hir/src/nameres.rs | 2 +- crates/ra_hir/src/path.rs | 6 ++-- crates/ra_hir/src/resolve.rs | 4 +-- crates/ra_hir/src/source_binder.rs | 6 ++-- crates/ra_hir/src/ty/autoderef.rs | 2 +- crates/ra_hir/src/ty/infer.rs | 46 +++++++++++++++---------------- crates/ra_hir/src/ty/lower.rs | 6 ++-- crates/ra_hir/src/ty/method_resolution.rs | 2 +- 13 files changed, 53 insertions(+), 53 deletions(-) (limited to 'crates/ra_hir') 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 { crate_graph.edition(self.crate_id) } - // TODO: should this be in source_binder? + // FIXME: should this be in source_binder? pub fn source_root_crates( db: &impl PersistentHirDatabase, source_root: SourceRootId, @@ -301,7 +301,7 @@ impl Struct { db.type_for_def((*self).into(), Namespace::Values) } - // TODO move to a more general type + // FIXME move to a more general type /// Builds a resolver for type references inside this struct. pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { // take the outer scope... @@ -361,7 +361,7 @@ impl Enum { db.type_for_def((*self).into(), Namespace::Types) } - // TODO: move to a more general type + // FIXME: move to a more general type /// Builds a resolver for type references inside this struct. pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { // take the outer scope... @@ -513,7 +513,7 @@ impl Function { ImplBlock::containing(module_impls, (*self).into()) } - // TODO: move to a more general type for 'body-having' items + // FIXME: move to a more general type for 'body-having' items /// Builds a resolver for code inside this item. pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { // take the outer scope... @@ -558,7 +558,7 @@ impl Const { ImplBlock::containing(module_impls, (*self).into()) } - // TODO: move to a more general type for 'body-having' items + // FIXME: move to a more general type for 'body-having' items /// Builds a resolver for code inside this item. pub fn resolver(&self, db: &impl HirDatabase) -> Resolver { // 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); /// The body of an item (function, const etc.). #[derive(Debug, Eq, PartialEq)] pub struct Body { - // TODO: this should be more general, consts & statics also have bodies + // FIXME: this should be more general, consts & statics also have bodies /// The Function of the item this body belongs to owner: Function, exprs: Arena, @@ -406,7 +406,7 @@ pub enum Pat { Struct { path: Option, args: Vec, - // TODO: 'ellipsis' option + // FIXME: 'ellipsis' option }, Range { start: ExprId, @@ -547,7 +547,7 @@ impl ExprCollector { if condition.pat().is_none() { self.collect_expr_opt(condition.expr()) } else { - // TODO handle while let + // FIXME handle while let return self.alloc_expr(Expr::Missing, syntax_ptr); } } else { @@ -610,7 +610,7 @@ impl ExprCollector { self.alloc_expr(path, syntax_ptr) } ast::ExprKind::ContinueExpr(_e) => { - // TODO: labels + // FIXME: labels self.alloc_expr(Expr::Continue, syntax_ptr) } ast::ExprKind::BreakExpr(e) => { @@ -751,7 +751,7 @@ impl ExprCollector { self.alloc_expr(Expr::Literal(lit), syntax_ptr) } - // TODO implement HIR for these: + // FIXME implement HIR for these: ast::ExprKind::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), ast::ExprKind::IndexExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), ast::ExprKind::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), @@ -844,7 +844,7 @@ impl ExprCollector { Pat::Struct { path, args: fields } } - // TODO: implement + // FIXME: implement ast::PatKind::LiteralPat(_) => Pat::Missing, ast::PatKind::SlicePat(_) | ast::PatKind::RangePat(_) => Pat::Missing, }; @@ -910,7 +910,7 @@ pub(crate) fn body_with_source_map_query( ) -> (Arc, Arc) { let mut collector = ExprCollector::new(func); - // TODO: consts, etc. + // FIXME: consts, etc. collector.collect_fn_body(&func.source(db).1); 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 { } impl ExprScopes { - // TODO: This should take something more general than Function + // FIXME: This should take something more general than Function pub(crate) fn expr_scopes_query(db: &impl HirDatabase, function: Function) -> Arc { let body = db.body_hir(function); let res = ExprScopes::new(body); @@ -148,7 +148,7 @@ impl ScopesWithSourceMap { // XXX: during completion, cursor might be outside of any particular // expression. Try to figure out the correct scope... - // TODO: move this to source binder? + // FIXME: move this to source binder? fn adjust(&self, ptr: SyntaxNodePtr, original_scope: ScopeId, offset: TextUnit) -> ScopeId { let r = ptr.range(); 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::{ /// Data about a generic parameter (to a function, struct, impl, ...). #[derive(Clone, PartialEq, Eq, Debug)] pub struct GenericParam { - // TODO: give generic params proper IDs + // FIXME: give generic params proper IDs pub(crate) idx: u32, pub(crate) name: Name, } 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 { } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -//TODO: rename to ImplDef? +//FIXME: rename to ImplDef? pub enum ImplItem { Method(Function), 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 { // plain import or absolute path in 2015: crate-relative with // fallback to extern prelude (with the simplification in // rust-lang/rust#57745) - // TODO there must be a nicer way to write this condition + // FIXME there must be a nicer way to write this condition PathKind::Plain | PathKind::Abs if self.edition == Edition::Edition2015 && (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 { if let Some(q) = path.qualifier() { return Some(q); } - // TODO: this bottom up traversal is not too precise. + // FIXME: this bottom up traversal is not too precise. // Should we handle do a top-down analysis, recording results? let use_tree_list = path.syntax().ancestors().find_map(ast::UseTreeList::cast)?; let use_tree = use_tree_list.parent_use_tree(); @@ -166,7 +166,7 @@ fn expand_use_tree<'a>( // or `use something::{path::{inner::{innerer}}}` (prefix is `something::path`, path is `inner`) Some(path) => match convert_path(prefix, path) { Some(it) => Some(it), - None => return, // TODO: report errors somewhere + None => return, // FIXME: report errors somewhere }, }; for child_tree in use_tree_list.use_trees() { @@ -194,7 +194,7 @@ fn expand_use_tree<'a>( cb(path, Some(segment), alias) }; } - // TODO: report errors somewhere + // FIXME: report errors somewhere // We get here if we do } } 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 { scopes: Vec, } -// TODO how to store these best +// FIXME how to store these best #[derive(Debug, Clone)] pub(crate) struct ModuleItemMap { crate_def_map: Arc, @@ -260,7 +260,7 @@ impl Scope { fn collect_names(&self, db: &impl HirDatabase, f: &mut dyn FnMut(Name, PerNs)) { match self { Scope::ModuleScope(m) => { - // TODO: should we provide `self` here? + // FIXME: should we provide `self` here? // f( // Name::self_param(), // 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 let scope = scopes.scope_for_offset(position.offset); Some(expr::resolver_for_scope(func.body(db), db, scope)) } else { - // TODO const/static/array length + // FIXME const/static/array length None } } else { @@ -184,7 +184,7 @@ pub fn resolver_for_node(db: &impl HirDatabase, file_id: FileId, node: &SyntaxNo let scope = scopes.scope_for(&node); Some(expr::resolver_for_scope(func.body(db), db, scope)) } else { - // TODO const/static/array length + // FIXME const/static/array length None } } else { @@ -212,7 +212,7 @@ fn try_get_resolver_for_node( } else if let Some(f) = ast::FnDef::cast(node) { function_from_source(db, file_id, f).map(|f| f.resolver(db)) } else { - // TODO add missing cases + // FIXME add missing cases None } } 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 { } fn autoderef_step(&self, _db: &impl HirDatabase) -> Option { - // TODO Deref::deref + // FIXME Deref::deref self.builtin_deref() } } 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> { fn make_ty(&mut self, type_ref: &TypeRef) -> Ty { let ty = Ty::from_hir( self.db, - // TODO use right resolver for block + // FIXME use right resolver for block &self.resolver, type_ref, ); @@ -414,11 +414,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { return None; } Resolution::GenericParam(..) => { - // TODO associated item of generic param + // FIXME associated item of generic param return None; } Resolution::SelfType(_) => { - // TODO associated item of self type + // FIXME associated item of self type return None; } }; @@ -446,7 +446,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { } } - // TODO: Resolve associated types + // FIXME: Resolve associated types crate::ImplItem::TypeAlias(_) => None, }; match matching_def { @@ -504,7 +504,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { return (Ty::Unknown, None); } Some(Resolution::SelfType(..)) => { - // TODO this is allowed in an impl for a struct, handle this + // FIXME this is allowed in an impl for a struct, handle this return (Ty::Unknown, None); } None => return (Ty::Unknown, None), @@ -513,7 +513,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { None => return (Ty::Unknown, None), Some(it) => it, }; - // TODO remove the duplication between here and `Ty::from_path`? + // FIXME remove the duplication between here and `Ty::from_path`? let substs = Ty::substs_from_path(self.db, resolver, path, def); match def { TypableDef::Struct(s) => { @@ -590,7 +590,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | Pat::Struct { .. } | Pat::Range { .. } | Pat::Slice { .. } => true, - // TODO: Path/Lit might actually evaluate to ref, but inference is unimplemented. + // FIXME: Path/Lit might actually evaluate to ref, but inference is unimplemented. Pat::Path(..) | Pat::Lit(..) => true, Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Missing => false, }; @@ -635,7 +635,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { let expectation = match expected.as_reference() { Some((inner_ty, exp_mut)) => { if *mutability != exp_mut { - // TODO: emit type error? + // FIXME: emit type error? } inner_ty } @@ -651,7 +651,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { self.infer_struct_pat(p.as_ref(), fields, expected, default_bm) } Pat::Path(path) => { - // TODO use correct resolver for the surrounding expression + // FIXME use correct resolver for the surrounding expression let resolver = self.resolver.clone(); self.infer_path_expr(&resolver, &path, pat.into()).unwrap_or(Ty::Unknown) } @@ -741,7 +741,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Expr::Block { statements, tail } => self.infer_block(statements, *tail, expected), Expr::Loop { body } => { self.infer_expr(*body, &Expectation::has_type(Ty::unit())); - // TODO handle break with value + // FIXME handle break with value Ty::simple(TypeCtor::Never) } Expr::While { condition, body } => { @@ -769,7 +769,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { self.infer_pat(*arg_pat, &expected, BindingMode::default()); } - // TODO: infer lambda type etc. + // FIXME: infer lambda type etc. let _body_ty = self.infer_expr(*body, &Expectation::none()); Ty::Unknown } @@ -795,7 +795,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { }, _ => { // not callable - // TODO report an error? + // FIXME report an error? (Vec::new(), Ty::Unknown) } }; @@ -894,14 +894,14 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { expected.ty } Expr::Path(p) => { - // TODO this could be more efficient... + // FIXME this could be more efficient... let resolver = expr::resolver_for_expr(self.body.clone(), self.db, tgt_expr); self.infer_path_expr(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) } Expr::Continue => Ty::simple(TypeCtor::Never), Expr::Break { expr } => { if let Some(expr) = expr { - // TODO handle break with value + // FIXME handle break with value self.infer_expr(*expr, &Expectation::none()); } Ty::simple(TypeCtor::Never) @@ -957,21 +957,21 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Expr::Cast { expr, type_ref } => { let _inner_ty = self.infer_expr(*expr, &Expectation::none()); let cast_ty = self.make_ty(type_ref); - // TODO check the cast... + // FIXME check the cast... cast_ty } Expr::Ref { expr, mutability } => { let expectation = if let Some((exp_inner, exp_mutability)) = &expected.ty.as_reference() { if *exp_mutability == Mutability::Mut && *mutability == Mutability::Shared { - // TODO: throw type error - expected mut reference but found shared ref, + // FIXME: throw type error - expected mut reference but found shared ref, // which cannot be coerced } Expectation::has_type(Ty::clone(exp_inner)) } else { Expectation::none() }; - // TODO reference coercions etc. + // FIXME reference coercions etc. let inner_ty = self.infer_expr(*expr, &expectation); Ty::apply_one(TypeCtor::Ref(*mutability), inner_ty) } @@ -982,7 +982,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { if let Some(derefed_ty) = inner_ty.builtin_deref() { derefed_ty } else { - // TODO Deref::deref + // FIXME Deref::deref Ty::Unknown } } @@ -1002,7 +1002,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => { inner_ty } - // TODO: resolve ops::Neg trait + // FIXME: resolve ops::Neg trait _ => Ty::Unknown, } } @@ -1013,7 +1013,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { _ => Ty::Unknown, }, Ty::Infer(InferTy::IntVar(..)) => inner_ty, - // TODO: resolve ops::Not trait for inner_ty + // FIXME: resolve ops::Not trait for inner_ty _ => Ty::Unknown, } } @@ -1028,12 +1028,12 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { _ => Expectation::none(), }; let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); - // TODO: find implementation of trait corresponding to operation + // FIXME: find implementation of trait corresponding to operation // symbol and resolve associated `Output` type let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty); let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); - // TODO: similar as above, return ty is often associated trait type + // FIXME: similar as above, return ty is often associated trait type op::binary_op_return_ty(*op, rhs_ty) } _ => Ty::Unknown, @@ -1227,7 +1227,7 @@ impl InferTy { #[derive(Clone, PartialEq, Eq, Debug)] struct Expectation { ty: Ty, - // TODO: In some cases, we need to be aware whether the expectation is that + // FIXME: In some cases, we need to be aware whether the expectation is that // the type match exactly what we passed, or whether it just needs to be // coercible to the expected type. See Expectation::rvalue_hint in rustc. } 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 { pub(crate) fn from_hir_path(db: &impl HirDatabase, resolver: &Resolver, path: &Path) -> Self { if let Some(name) = path.as_ident() { - // TODO handle primitive type names in resolver as well? + // FIXME handle primitive type names in resolver as well? if let Some(int_ty) = primitive::IntTy::from_type_name(name) { return Ty::simple(TypeCtor::Int(primitive::UncertainIntTy::Known(int_ty))); } else if let Some(float_ty) = primitive::FloatTy::from_type_name(name) { @@ -87,7 +87,7 @@ impl Ty { Some(Resolution::GenericParam(idx)) => { return Ty::Param { idx, - // TODO: maybe return name in resolution? + // FIXME: maybe return name in resolution? name: path .as_ident() .expect("generic param should be single-segment path") @@ -139,7 +139,7 @@ impl Ty { } } // add placeholders for args that were not provided - // TODO: handle defaults + // FIXME: handle defaults let supplied_params = substs.len(); for _ in supplied_params..def_generics.count_params_including_parent() { 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 { } impl Ty { - // TODO: cache this as a query? + // FIXME: cache this as a query? // - if so, what signature? (TyFingerprint, Name)? // - or maybe cache all names and def_ids of methods per fingerprint? /// Look up the method with the given name, returning the actual autoderefed -- cgit v1.2.3