Use upstream cov-mark

This commit is contained in:
Laurențiu Nicola 2021-03-08 22:19:44 +02:00
parent c5189a22cc
commit fc9eed4836
101 changed files with 354 additions and 514 deletions

View file

@ -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 {

View file

@ -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()
}
}

View file

@ -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,

View file

@ -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;

View file

@ -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);
}

View file

@ -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<T1, T2, ...>` 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);

View file

@ -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) {

View file

@ -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"

View file

@ -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>(T);

View file

@ -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() {

View file

@ -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#"

View file

@ -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#"

View file

@ -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<T> {