diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 80e7b7b799..f912080681 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -687,6 +687,7 @@ fn is_valid_candidate( } if let Some(from_module) = visible_from_module { if !db.fn_visibility(m).is_visible_from(db.upcast(), from_module) { + cov_mark::hit!(autoderef_candidate_not_visible); return false; } } diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index 6e74763ca0..61f18b0d20 100644 --- a/crates/hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs @@ -1227,6 +1227,7 @@ mod b { #[test] fn autoderef_visibility_method() { + cov_mark::check!(autoderef_candidate_not_visible); check_infer( r#" #[lang = "deref"]