diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-08 21:19:31 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-08 21:19:31 +0000 |
commit | c48478621fe9b50cb19bfd0ea4a5c2ff0de5d6ac (patch) | |
tree | 3905029a42c8bb6c5d363753b34cd6b5dd43f4d5 /crates/hir_ty/src/infer | |
parent | c5189a22ccf4c28e309e4189defbb88b83bb2aea (diff) | |
parent | fc9eed4836dfc88fe2893c81b015ab440cea2ba6 (diff) |
Merge #7924
7924: Use upstream cov-mark r=matklad a=lnicola
Closes #7922
But doesn't remove any dependency, unfortunately.
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/coerce.rs | 5 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 8 |
4 files changed, 7 insertions, 12 deletions
diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index cf0a3add4..7e8846f27 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | use chalk_ir::{Mutability, TyVariableKind}; | 7 | use chalk_ir::{Mutability, TyVariableKind}; |
8 | use hir_def::lang_item::LangItemTarget; | 8 | use hir_def::lang_item::LangItemTarget; |
9 | use test_utils::mark; | ||
10 | 9 | ||
11 | use crate::{autoderef, traits::Solution, Obligation, Substs, TraitRef, Ty}; | 10 | use crate::{autoderef, traits::Solution, Obligation, Substs, TraitRef, Ty}; |
12 | 11 | ||
@@ -35,7 +34,7 @@ impl<'a> InferenceContext<'a> { | |||
35 | ty1.clone() | 34 | ty1.clone() |
36 | } else { | 35 | } else { |
37 | if let (Ty::FnDef(..), Ty::FnDef(..)) = (ty1, ty2) { | 36 | if let (Ty::FnDef(..), Ty::FnDef(..)) = (ty1, ty2) { |
38 | mark::hit!(coerce_fn_reification); | 37 | cov_mark::hit!(coerce_fn_reification); |
39 | // Special case: two function types. Try to coerce both to | 38 | // Special case: two function types. Try to coerce both to |
40 | // pointers to have a chance at getting a match. See | 39 | // pointers to have a chance at getting a match. See |
41 | // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 | 40 | // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 |
@@ -45,7 +44,7 @@ impl<'a> InferenceContext<'a> { | |||
45 | let ptr_ty2 = Ty::fn_ptr(sig2); | 44 | let ptr_ty2 = Ty::fn_ptr(sig2); |
46 | self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) | 45 | self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) |
47 | } else { | 46 | } else { |
48 | mark::hit!(coerce_merge_fail_fallback); | 47 | cov_mark::hit!(coerce_merge_fail_fallback); |
49 | ty1.clone() | 48 | ty1.clone() |
50 | } | 49 | } |
51 | } | 50 | } |
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index ec2c13154..262177ffb 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -12,7 +12,6 @@ use hir_def::{ | |||
12 | }; | 12 | }; |
13 | use hir_expand::name::{name, Name}; | 13 | use hir_expand::name::{name, Name}; |
14 | use syntax::ast::RangeOp; | 14 | use syntax::ast::RangeOp; |
15 | use test_utils::mark; | ||
16 | 15 | ||
17 | use crate::{ | 16 | use crate::{ |
18 | autoderef, | 17 | autoderef, |
@@ -565,7 +564,7 @@ impl<'a> InferenceContext<'a> { | |||
565 | let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone()); | 564 | let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone()); |
566 | 565 | ||
567 | if ret == Ty::Unknown { | 566 | if ret == Ty::Unknown { |
568 | mark::hit!(infer_expr_inner_binary_operator_overload); | 567 | cov_mark::hit!(infer_expr_inner_binary_operator_overload); |
569 | 568 | ||
570 | self.resolve_associated_type_with_params( | 569 | self.resolve_associated_type_with_params( |
571 | lhs_ty, | 570 | lhs_ty, |
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 987793e2e..a0ac8d80f 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -10,7 +10,6 @@ use hir_def::{ | |||
10 | FieldId, | 10 | FieldId, |
11 | }; | 11 | }; |
12 | use hir_expand::name::Name; | 12 | use hir_expand::name::Name; |
13 | use test_utils::mark; | ||
14 | 13 | ||
15 | use super::{BindingMode, Expectation, InferenceContext}; | 14 | use super::{BindingMode, Expectation, InferenceContext}; |
16 | use crate::{lower::lower_to_chalk_mutability, utils::variant_data, Substs, Ty}; | 15 | use crate::{lower::lower_to_chalk_mutability, utils::variant_data, Substs, Ty}; |
@@ -108,7 +107,7 @@ impl<'a> InferenceContext<'a> { | |||
108 | } | 107 | } |
109 | } | 108 | } |
110 | } else if let Pat::Ref { .. } = &body[pat] { | 109 | } else if let Pat::Ref { .. } = &body[pat] { |
111 | mark::hit!(match_ergonomics_ref); | 110 | cov_mark::hit!(match_ergonomics_ref); |
112 | // When you encounter a `&pat` pattern, reset to Move. | 111 | // When you encounter a `&pat` pattern, reset to Move. |
113 | // This is so that `w` is by value: `let (_, &w) = &(1, &2);` | 112 | // This is so that `w` is by value: `let (_, &w) = &(1, &2);` |
114 | default_bm = BindingMode::Move; | 113 | default_bm = BindingMode::Move; |
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 99a89a7f3..54fcfed10 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -5,8 +5,6 @@ use std::borrow::Cow; | |||
5 | use chalk_ir::{FloatTy, IntTy, TyVariableKind}; | 5 | use chalk_ir::{FloatTy, IntTy, TyVariableKind}; |
6 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | 6 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; |
7 | 7 | ||
8 | use test_utils::mark; | ||
9 | |||
10 | use super::{InferenceContext, Obligation}; | 8 | use super::{InferenceContext, Obligation}; |
11 | use crate::{ | 9 | use crate::{ |
12 | BoundVar, Canonical, DebruijnIndex, GenericPredicate, InEnvironment, InferenceVar, Scalar, | 10 | BoundVar, Canonical, DebruijnIndex, GenericPredicate, InEnvironment, InferenceVar, Scalar, |
@@ -387,7 +385,7 @@ impl InferenceTable { | |||
387 | // more than once | 385 | // more than once |
388 | for i in 0..3 { | 386 | for i in 0..3 { |
389 | if i > 0 { | 387 | if i > 0 { |
390 | mark::hit!(type_var_resolves_to_int_var); | 388 | cov_mark::hit!(type_var_resolves_to_int_var); |
391 | } | 389 | } |
392 | match &*ty { | 390 | match &*ty { |
393 | Ty::InferenceVar(tv, _) => { | 391 | Ty::InferenceVar(tv, _) => { |
@@ -416,7 +414,7 @@ impl InferenceTable { | |||
416 | Ty::InferenceVar(tv, kind) => { | 414 | Ty::InferenceVar(tv, kind) => { |
417 | let inner = tv.to_inner(); | 415 | let inner = tv.to_inner(); |
418 | if tv_stack.contains(&inner) { | 416 | if tv_stack.contains(&inner) { |
419 | mark::hit!(type_var_cycles_resolve_as_possible); | 417 | cov_mark::hit!(type_var_cycles_resolve_as_possible); |
420 | // recursive type | 418 | // recursive type |
421 | return self.type_variable_table.fallback_value(tv, kind); | 419 | return self.type_variable_table.fallback_value(tv, kind); |
422 | } | 420 | } |
@@ -443,7 +441,7 @@ impl InferenceTable { | |||
443 | Ty::InferenceVar(tv, kind) => { | 441 | Ty::InferenceVar(tv, kind) => { |
444 | let inner = tv.to_inner(); | 442 | let inner = tv.to_inner(); |
445 | if tv_stack.contains(&inner) { | 443 | if tv_stack.contains(&inner) { |
446 | mark::hit!(type_var_cycles_resolve_completely); | 444 | cov_mark::hit!(type_var_cycles_resolve_completely); |
447 | // recursive type | 445 | // recursive type |
448 | return self.type_variable_table.fallback_value(tv, kind); | 446 | return self.type_variable_table.fallback_value(tv, kind); |
449 | } | 447 | } |