From fc9eed4836dfc88fe2893c81b015ab440cea2ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 8 Mar 2021 22:19:44 +0200 Subject: Use upstream cov-mark --- crates/hir_ty/Cargo.toml | 1 + crates/hir_ty/src/diagnostics/decl_check.rs | 11 ++++------- crates/hir_ty/src/infer/coerce.rs | 5 ++--- crates/hir_ty/src/infer/expr.rs | 3 +-- crates/hir_ty/src/infer/pat.rs | 3 +-- crates/hir_ty/src/infer/unify.rs | 8 +++----- crates/hir_ty/src/lower.rs | 5 ++--- crates/hir_ty/src/method_resolution.rs | 2 +- crates/hir_ty/src/tests/coercion.rs | 5 ++--- crates/hir_ty/src/tests/method_resolution.rs | 2 +- crates/hir_ty/src/tests/patterns.rs | 3 +-- crates/hir_ty/src/tests/regression.rs | 7 +++---- crates/hir_ty/src/tests/simple.rs | 3 +-- crates/hir_ty/src/tests/traits.rs | 5 ++--- 14 files changed, 25 insertions(+), 38 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml index 1127eef05..6131ebee8 100644 --- a/crates/hir_ty/Cargo.toml +++ b/crates/hir_ty/Cargo.toml @@ -10,6 +10,7 @@ edition = "2018" doctest = false [dependencies] +cov-mark = "1.1" itertools = "0.10.0" arrayvec = "0.5.1" smallvec = "1.2.0" diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index 6773ddea3..e230f9765 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs @@ -28,7 +28,6 @@ use syntax::{ ast::{self, NameOwner}, AstNode, AstPtr, }; -use test_utils::mark; use crate::{ db::HirDatabase, @@ -93,7 +92,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { fn validate_func(&mut self, func: FunctionId) { let data = self.db.function_data(func); if data.is_extern { - mark::hit!(extern_func_incorrect_case_ignored); + cov_mark::hit!(extern_func_incorrect_case_ignored); return; } @@ -625,7 +624,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { fn validate_static(&mut self, static_id: StaticId) { let data = self.db.static_data(static_id); if data.is_extern { - mark::hit!(extern_static_incorrect_case_ignored); + cov_mark::hit!(extern_static_incorrect_case_ignored); return; } @@ -673,8 +672,6 @@ impl<'a, 'b> DeclValidator<'a, 'b> { #[cfg(test)] mod tests { - use test_utils::mark; - use crate::diagnostics::tests::check_diagnostics; #[test] @@ -889,8 +886,8 @@ fn main() { #[test] fn ignores_extern_items() { - mark::check!(extern_func_incorrect_case_ignored); - mark::check!(extern_static_incorrect_case_ignored); + cov_mark::check!(extern_func_incorrect_case_ignored); + cov_mark::check!(extern_static_incorrect_case_ignored); check_diagnostics( r#" extern { 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 @@ use chalk_ir::{Mutability, TyVariableKind}; use hir_def::lang_item::LangItemTarget; -use test_utils::mark; use crate::{autoderef, traits::Solution, Obligation, Substs, TraitRef, Ty}; @@ -35,7 +34,7 @@ impl<'a> InferenceContext<'a> { ty1.clone() } else { if let (Ty::FnDef(..), Ty::FnDef(..)) = (ty1, ty2) { - mark::hit!(coerce_fn_reification); + cov_mark::hit!(coerce_fn_reification); // Special case: two function types. Try to coerce both to // pointers to have a chance at getting a match. See // https://github.com/rust-lang/rust/blob/7b805396bf46dce972692a6846ce2ad8481c5f85/src/librustc_typeck/check/coercion.rs#L877-L916 @@ -45,7 +44,7 @@ impl<'a> InferenceContext<'a> { let ptr_ty2 = Ty::fn_ptr(sig2); self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) } else { - mark::hit!(coerce_merge_fail_fallback); + cov_mark::hit!(coerce_merge_fail_fallback); ty1.clone() } } 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::{ }; use hir_expand::name::{name, Name}; use syntax::ast::RangeOp; -use test_utils::mark; use crate::{ autoderef, @@ -565,7 +564,7 @@ impl<'a> InferenceContext<'a> { let ret = op::binary_op_return_ty(*op, lhs_ty.clone(), rhs_ty.clone()); if ret == Ty::Unknown { - mark::hit!(infer_expr_inner_binary_operator_overload); + cov_mark::hit!(infer_expr_inner_binary_operator_overload); self.resolve_associated_type_with_params( 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::{ FieldId, }; use hir_expand::name::Name; -use test_utils::mark; use super::{BindingMode, Expectation, InferenceContext}; use crate::{lower::lower_to_chalk_mutability, utils::variant_data, Substs, Ty}; @@ -108,7 +107,7 @@ impl<'a> InferenceContext<'a> { } } } else if let Pat::Ref { .. } = &body[pat] { - mark::hit!(match_ergonomics_ref); + cov_mark::hit!(match_ergonomics_ref); // When you encounter a `&pat` pattern, reset to Move. // This is so that `w` is by value: `let (_, &w) = &(1, &2);` 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; use chalk_ir::{FloatTy, IntTy, TyVariableKind}; use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; -use test_utils::mark; - use super::{InferenceContext, Obligation}; use crate::{ BoundVar, Canonical, DebruijnIndex, GenericPredicate, InEnvironment, InferenceVar, Scalar, @@ -387,7 +385,7 @@ impl InferenceTable { // more than once for i in 0..3 { if i > 0 { - mark::hit!(type_var_resolves_to_int_var); + cov_mark::hit!(type_var_resolves_to_int_var); } match &*ty { Ty::InferenceVar(tv, _) => { @@ -416,7 +414,7 @@ impl InferenceTable { Ty::InferenceVar(tv, kind) => { let inner = tv.to_inner(); if tv_stack.contains(&inner) { - mark::hit!(type_var_cycles_resolve_as_possible); + cov_mark::hit!(type_var_cycles_resolve_as_possible); // recursive type return self.type_variable_table.fallback_value(tv, kind); } @@ -443,7 +441,7 @@ impl InferenceTable { Ty::InferenceVar(tv, kind) => { let inner = tv.to_inner(); if tv_stack.contains(&inner) { - mark::hit!(type_var_cycles_resolve_completely); + cov_mark::hit!(type_var_cycles_resolve_completely); // recursive type return self.type_variable_table.fallback_value(tv, kind); } diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 5fe5b8ad1..b90fdc382 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -24,7 +24,6 @@ use hir_expand::name::Name; use la_arena::ArenaMap; use smallvec::SmallVec; use stdx::impl_from; -use test_utils::mark; use crate::{ db::HirDatabase, @@ -760,7 +759,7 @@ fn assoc_type_bindings_from_type_bound<'a>( impl ReturnTypeImplTrait { fn from_hir(ctx: &TyLoweringContext, bounds: &[TypeBound]) -> Self { - mark::hit!(lower_rpit); + cov_mark::hit!(lower_rpit); let self_ty = Ty::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)); let predicates = ctx.with_shifted_in(DebruijnIndex::ONE, |ctx| { bounds @@ -935,7 +934,7 @@ impl TraitEnvironment { // add `Self: Trait` to the environment in trait // function default implementations (and hypothetical code // inside consts or type aliases) - test_utils::mark::hit!(trait_self_implements_self); + cov_mark::hit!(trait_self_implements_self); let substs = Substs::type_params(db, trait_id); let trait_ref = TraitRef { trait_: trait_id, substs }; let pred = GenericPredicate::Implemented(trait_ref); diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index dfcf346fb..24db33c49 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -588,7 +588,7 @@ fn iterate_inherent_methods( // already happens in `is_valid_candidate` above; if not, we // check it here if receiver_ty.is_none() && inherent_impl_substs(db, impl_def, self_ty).is_none() { - test_utils::mark::hit!(impl_self_type_match_without_receiver); + cov_mark::hit!(impl_self_type_match_without_receiver); continue; } if callback(&self_ty.value, item) { diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs index 7bc6c79f3..63d9d4e0b 100644 --- a/crates/hir_ty/src/tests/coercion.rs +++ b/crates/hir_ty/src/tests/coercion.rs @@ -1,5 +1,4 @@ use expect_test::expect; -use test_utils::mark; use super::{check_infer, check_infer_with_mismatches}; @@ -381,7 +380,7 @@ fn infer_match_second_coerce() { #[test] fn coerce_merge_one_by_one1() { - mark::check!(coerce_merge_fail_fallback); + cov_mark::check!(coerce_merge_fail_fallback); check_infer( r" @@ -589,7 +588,7 @@ fn coerce_fn_item_to_fn_ptr() { #[test] fn coerce_fn_items_in_match_arms() { - mark::check!(coerce_fn_reification); + cov_mark::check!(coerce_fn_reification); check_infer_with_mismatches( r" diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index a9901d7b8..4e3f9a9b6 100644 --- a/crates/hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs @@ -913,7 +913,7 @@ fn test() { S2.into(); } #[test] fn method_resolution_overloaded_method() { - test_utils::mark::check!(impl_self_type_match_without_receiver); + cov_mark::check!(impl_self_type_match_without_receiver); check_types( r#" struct Wrapper(T); diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index 2053d8f56..5da19ba5f 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs @@ -1,5 +1,4 @@ use expect_test::expect; -use test_utils::mark; use super::{check_infer, check_infer_with_mismatches}; @@ -197,7 +196,7 @@ fn infer_pattern_match_ergonomics() { #[test] fn infer_pattern_match_ergonomics_ref() { - mark::check!(match_ergonomics_ref); + cov_mark::check!(match_ergonomics_ref); check_infer( r#" fn test() { diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index cffe8630b..69314e245 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -1,5 +1,4 @@ use expect_test::expect; -use test_utils::mark; use super::{check_infer, check_types}; @@ -87,8 +86,8 @@ fn bug_651() { #[test] fn recursive_vars() { - mark::check!(type_var_cycles_resolve_completely); - mark::check!(type_var_cycles_resolve_as_possible); + cov_mark::check!(type_var_cycles_resolve_completely); + cov_mark::check!(type_var_cycles_resolve_as_possible); check_infer( r#" fn test() { @@ -166,7 +165,7 @@ fn infer_std_crash_1() { #[test] fn infer_std_crash_2() { - mark::check!(type_var_resolves_to_int_var); + cov_mark::check!(type_var_resolves_to_int_var); // caused "equating two type variables, ...", taken from std check_infer( r#" diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index 2947857a5..f5069eba5 100644 --- a/crates/hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs @@ -1,5 +1,4 @@ use expect_test::expect; -use test_utils::mark; use super::{check_infer, check_types}; @@ -2314,7 +2313,7 @@ fn generic_default_depending_on_other_type_arg_forward() { #[test] fn infer_operator_overload() { - mark::check!(infer_expr_inner_binary_operator_overload); + cov_mark::check!(infer_expr_inner_binary_operator_overload); check_infer( r#" diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 1298e5a88..528092082 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -1,5 +1,4 @@ use expect_test::expect; -use test_utils::mark; use super::{check_infer, check_infer_with_mismatches, check_types}; @@ -319,7 +318,7 @@ fn infer_from_bound_2() { #[test] fn trait_default_method_self_bound_implements_trait() { - mark::check!(trait_self_implements_self); + cov_mark::check!(trait_self_implements_self); check_infer( r#" trait Trait { @@ -1189,7 +1188,7 @@ fn impl_trait() { #[test] fn simple_return_pos_impl_trait() { - mark::check!(lower_rpit); + cov_mark::check!(lower_rpit); check_infer( r#" trait Trait { -- cgit v1.2.3