mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Fix some TODOs
This commit is contained in:
parent
6b9d05d193
commit
9d6061f3bb
3 changed files with 17 additions and 11 deletions
|
@ -587,7 +587,6 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
||||||
self.write_method_resolution(tgt_expr, func);
|
self.write_method_resolution(tgt_expr, func);
|
||||||
(ty, self.db.value_ty(func.into()), Some(generics(self.db, func.into())))
|
(ty, self.db.value_ty(func.into()), Some(generics(self.db, func.into())))
|
||||||
}
|
}
|
||||||
// TODO fix this
|
|
||||||
None => (receiver_ty, Binders::new(0, Ty::Unknown), None),
|
None => (receiver_ty, Binders::new(0, Ty::Unknown), None),
|
||||||
};
|
};
|
||||||
let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty);
|
let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty);
|
||||||
|
|
|
@ -287,17 +287,20 @@ pub enum Ty {
|
||||||
/// trait and all its parameters are fully known.
|
/// trait and all its parameters are fully known.
|
||||||
Projection(ProjectionTy),
|
Projection(ProjectionTy),
|
||||||
|
|
||||||
/// A type parameter; for example, `T` in `fn f<T>(x: T) {}
|
/// A placeholder for a type parameter; for example, `T` in `fn f<T>(x: T)
|
||||||
// TODO fix documentation
|
/// {}` when we're type-checking the body of that function. In this
|
||||||
|
/// situation, we know this stands for *some* type, but don't know the exact
|
||||||
|
/// type.
|
||||||
Param(TypeParamId),
|
Param(TypeParamId),
|
||||||
|
|
||||||
/// A bound type variable. Used during trait resolution to represent Chalk
|
/// A bound type variable. This is used in various places: when representing
|
||||||
/// variables, and in `Dyn` and `Opaque` bounds to represent the `Self` type.
|
/// some polymorphic type like the type of function `fn f<T>`, the type
|
||||||
// TODO fix documentation
|
/// parameters get turned into variables; during trait resolution, inference
|
||||||
|
/// variables get turned into bound variables and back; and in `Dyn` the
|
||||||
|
/// `Self` type is represented with a bound variable as well.
|
||||||
Bound(u32),
|
Bound(u32),
|
||||||
|
|
||||||
/// A type variable used during type checking. Not to be confused with a
|
/// A type variable used during type checking.
|
||||||
/// type parameter.
|
|
||||||
Infer(InferTy),
|
Infer(InferTy),
|
||||||
|
|
||||||
/// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust).
|
/// A trait object (`dyn Trait` or bare `Trait` in pre-2018 Rust).
|
||||||
|
|
|
@ -890,9 +890,13 @@ pub(crate) fn ty_query(db: &impl HirDatabase, def: TyDefId) -> Binders<Ty> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn ty_recover(_db: &impl HirDatabase, _cycle: &[String], _def: &TyDefId) -> Binders<Ty> {
|
pub(crate) fn ty_recover(db: &impl HirDatabase, _cycle: &[String], def: &TyDefId) -> Binders<Ty> {
|
||||||
// TODO still need correct number of binders here
|
let num_binders = match *def {
|
||||||
Binders::new(0, Ty::Unknown)
|
TyDefId::BuiltinType(_) => 0,
|
||||||
|
TyDefId::AdtId(it) => generics(db, it.into()).len(),
|
||||||
|
TyDefId::TypeAliasId(it) => generics(db, it.into()).len(),
|
||||||
|
};
|
||||||
|
Binders::new(num_binders, Ty::Unknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn value_ty_query(db: &impl HirDatabase, def: ValueTyDefId) -> Binders<Ty> {
|
pub(crate) fn value_ty_query(db: &impl HirDatabase, def: ValueTyDefId) -> Binders<Ty> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue