Introduce TypeInfo

This commit is contained in:
Lukas Wirth
2021-08-02 20:42:25 +02:00
parent 29506b5a26
commit 25ff7171c4
32 changed files with 127 additions and 124 deletions

View File

@@ -273,7 +273,9 @@ fn bin_impls_ord(sema: &Semantics<RootDatabase>, bin: &ast::BinExpr) -> bool {
bin.lhs().and_then(|lhs| sema.type_of_expr(&lhs)),
bin.rhs().and_then(|rhs| sema.type_of_expr(&rhs)),
) {
(Some(lhs_ty), Some(rhs_ty)) if lhs_ty == rhs_ty => {
(Some(hir::TypeInfo { ty: lhs_ty, .. }), Some(hir::TypeInfo { ty: rhs_ty, .. }))
if lhs_ty == rhs_ty =>
{
let krate = sema.scope(bin.syntax()).module().map(|it| it.krate());
let ord_trait = FamousDefs(sema, krate).core_cmp_Ord();
ord_trait.map_or(false, |ord_trait| {