Skip to content

Commit fc9eed4

Browse files
committed
Use upstream cov-mark
1 parent c5189a2 commit fc9eed4

File tree

101 files changed

+354
-514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+354
-514
lines changed

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir_def/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ edition = "2018"
1010
doctest = false
1111

1212
[dependencies]
13+
cov-mark = "1.1"
1314
log = "0.4.8"
1415
once_cell = "1.3.1"
1516
rustc-hash = "1.1.0"

crates/hir_def/src/attr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use syntax::{
1313
ast::{self, AstNode, AttrsOwner},
1414
match_ast, AstToken, SmolStr, SyntaxNode,
1515
};
16-
use test_utils::mark;
1716
use tt::Subtree;
1817

1918
use crate::{
@@ -177,7 +176,7 @@ impl RawAttrs {
177176
if cfg_options.check(&cfg) == Some(false) {
178177
None
179178
} else {
180-
mark::hit!(cfg_attr_active);
179+
cov_mark::hit!(cfg_attr_active);
181180

182181
let attr = ast::Attr::parse(&format!("#[{}]", attr)).ok()?;
183182
let hygiene = Hygiene::new_unhygienic(); // FIXME

crates/hir_def/src/body.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use la_arena::{Arena, ArenaMap};
2020
use profile::Count;
2121
use rustc_hash::FxHashMap;
2222
use syntax::{ast, AstNode, AstPtr};
23-
use test_utils::mark;
2423

2524
pub(crate) use lower::LowerCtx;
2625

@@ -105,7 +104,7 @@ impl Expander {
105104
macro_call: ast::MacroCall,
106105
) -> ExpandResult<Option<(Mark, T)>> {
107106
if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT {
108-
mark::hit!(your_stack_belongs_to_me);
107+
cov_mark::hit!(your_stack_belongs_to_me);
109108
return ExpandResult::str_err("reached recursion limit during macro expansion".into());
110109
}
111110

crates/hir_def/src/body/lower.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use syntax::{
1919
},
2020
AstNode, AstPtr, SyntaxNodePtr,
2121
};
22-
use test_utils::mark;
2322

2423
use crate::{
2524
adt::StructKind,
@@ -286,7 +285,7 @@ impl ExprCollector<'_> {
286285
None => self.collect_expr_opt(condition.expr()),
287286
// if let -- desugar to match
288287
Some(pat) => {
289-
mark::hit!(infer_resolve_while_let);
288+
cov_mark::hit!(infer_resolve_while_let);
290289
let pat = self.collect_pat(pat);
291290
let match_expr = self.collect_expr_opt(condition.expr());
292291
let placeholder_pat = self.missing_pat();

crates/hir_def/src/body/scope.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ mod tests {
186186
use base_db::{fixture::WithFixture, FileId, SourceDatabase};
187187
use hir_expand::{name::AsName, InFile};
188188
use syntax::{algo::find_node_at_offset, ast, AstNode};
189-
use test_utils::{assert_eq_text, extract_offset, mark};
189+
use test_utils::{assert_eq_text, extract_offset};
190190

191191
use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId};
192192

@@ -454,7 +454,7 @@ fn foo() {
454454

455455
#[test]
456456
fn while_let_desugaring() {
457-
mark::check!(infer_resolve_while_let);
457+
cov_mark::check!(infer_resolve_while_let);
458458
do_check_local_name(
459459
r#"
460460
fn test() {

crates/hir_def/src/body/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ mod block;
22

33
use base_db::{fixture::WithFixture, SourceDatabase};
44
use expect_test::Expect;
5-
use test_utils::mark;
65

76
use crate::{test_db::TestDB, ModuleDefId};
87

@@ -48,7 +47,7 @@ fn check_at(ra_fixture: &str, expect: Expect) {
4847

4948
#[test]
5049
fn your_stack_belongs_to_me() {
51-
mark::check!(your_stack_belongs_to_me);
50+
cov_mark::check!(your_stack_belongs_to_me);
5251
lower(
5352
"
5453
macro_rules! n_nuple {

crates/hir_def/src/body/tests/block.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,16 @@ fn macro_resolve() {
165165
check_at(
166166
r#"
167167
//- /lib.rs crate:lib deps:core
168-
use core::mark;
168+
use core::cov_mark;
169169
170170
fn f() {
171171
fn nested() {
172-
mark::hit!(Hit);
172+
cov_mark::hit!(Hit);
173173
$0
174174
}
175175
}
176176
//- /core.rs crate:core
177-
pub mod mark {
177+
pub mod cov_mark {
178178
#[macro_export]
179179
macro_rules! _hit {
180180
($name:ident) => {
@@ -193,8 +193,8 @@ pub mod mark {
193193
nested: v
194194
195195
crate
196+
cov_mark: t
196197
f: v
197-
mark: t
198198
"#]],
199199
);
200200
}
@@ -264,7 +264,7 @@ fn main() {
264264
fn underscore_import() {
265265
// This used to panic, because the default (private) visibility inside block expressions would
266266
// point into the containing `DefMap`, which visibilities should never be able to do.
267-
mark::check!(adjust_vis_in_block_def_map);
267+
cov_mark::check!(adjust_vis_in_block_def_map);
268268
check_at(
269269
r#"
270270
mod m {

crates/hir_def/src/find_path.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::iter;
44

55
use hir_expand::name::{known, AsName, Name};
66
use rustc_hash::FxHashSet;
7-
use test_utils::mark;
87

98
use crate::nameres::DefMap;
109
use crate::{
@@ -215,7 +214,7 @@ fn find_path_inner(
215214
best_path_len - 1,
216215
prefixed,
217216
)?;
218-
mark::hit!(partially_imported);
217+
cov_mark::hit!(partially_imported);
219218
path.push_segment(info.path.segments.last().unwrap().clone());
220219
Some(path)
221220
})
@@ -235,7 +234,7 @@ fn find_path_inner(
235234
// that correctly (FIXME).
236235
if let Some(item_module) = item.as_module_def_id().and_then(|did| did.module(db)) {
237236
if item_module.def_map(db).block_id().is_some() && prefixed.is_some() {
238-
mark::hit!(prefixed_in_block_expression);
237+
cov_mark::hit!(prefixed_in_block_expression);
239238
prefixed = Some(PrefixKind::Plain);
240239
}
241240
}
@@ -252,18 +251,18 @@ fn find_path_inner(
252251
fn select_best_path(old_path: ModPath, new_path: ModPath, prefer_no_std: bool) -> ModPath {
253252
if old_path.starts_with_std() && new_path.can_start_with_std() {
254253
if prefer_no_std {
255-
mark::hit!(prefer_no_std_paths);
254+
cov_mark::hit!(prefer_no_std_paths);
256255
new_path
257256
} else {
258-
mark::hit!(prefer_std_paths);
257+
cov_mark::hit!(prefer_std_paths);
259258
old_path
260259
}
261260
} else if new_path.starts_with_std() && old_path.can_start_with_std() {
262261
if prefer_no_std {
263-
mark::hit!(prefer_no_std_paths);
262+
cov_mark::hit!(prefer_no_std_paths);
264263
old_path
265264
} else {
266-
mark::hit!(prefer_std_paths);
265+
cov_mark::hit!(prefer_std_paths);
267266
new_path
268267
}
269268
} else if new_path.len() < old_path.len() {
@@ -364,7 +363,6 @@ mod tests {
364363
use base_db::fixture::WithFixture;
365364
use hir_expand::hygiene::Hygiene;
366365
use syntax::ast::AstNode;
367-
use test_utils::mark;
368366

369367
use crate::test_db::TestDB;
370368

@@ -522,7 +520,7 @@ mod tests {
522520

523521
#[test]
524522
fn partially_imported() {
525-
mark::check!(partially_imported);
523+
cov_mark::check!(partially_imported);
526524
// Tests that short paths are used even for external items, when parts of the path are
527525
// already in scope.
528526
let code = r#"
@@ -686,7 +684,7 @@ mod tests {
686684

687685
#[test]
688686
fn prefer_std_paths_over_alloc() {
689-
mark::check!(prefer_std_paths);
687+
cov_mark::check!(prefer_std_paths);
690688
let code = r#"
691689
//- /main.rs crate:main deps:alloc,std
692690
$0
@@ -712,7 +710,7 @@ mod tests {
712710

713711
#[test]
714712
fn prefer_core_paths_over_std() {
715-
mark::check!(prefer_no_std_paths);
713+
cov_mark::check!(prefer_no_std_paths);
716714
let code = r#"
717715
//- /main.rs crate:main deps:core,std
718716
#![no_std]
@@ -842,7 +840,7 @@ mod tests {
842840

843841
#[test]
844842
fn inner_items_from_inner_module() {
845-
mark::check!(prefixed_in_block_expression);
843+
cov_mark::check!(prefixed_in_block_expression);
846844
check_found_path(
847845
r#"
848846
fn main() {

crates/hir_def/src/import_map.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use hir_expand::name::Name;
88
use indexmap::{map::Entry, IndexMap};
99
use itertools::Itertools;
1010
use rustc_hash::{FxHashSet, FxHasher};
11-
use test_utils::mark;
1211

1312
use crate::{
1413
db::DefDatabase, item_scope::ItemInNs, visibility::Visibility, AssocItemId, ModuleDefId,
@@ -193,7 +192,7 @@ impl ImportMap {
193192
// cannot use associated type aliases directly: need a `<Struct as Trait>::TypeAlias`
194193
// qualifier, ergo no need to store it for imports in import_map
195194
AssocItemId::TypeAliasId(_) => {
196-
mark::hit!(type_aliases_ignored);
195+
cov_mark::hit!(type_aliases_ignored);
197196
continue;
198197
}
199198
};
@@ -463,7 +462,6 @@ fn item_import_kind(item: ItemInNs) -> Option<ImportKind> {
463462
mod tests {
464463
use base_db::{fixture::WithFixture, SourceDatabase, Upcast};
465464
use expect_test::{expect, Expect};
466-
use test_utils::mark;
467465

468466
use crate::{test_db::TestDB, AssocContainerId, Lookup};
469467

@@ -801,7 +799,7 @@ mod tests {
801799

802800
#[test]
803801
fn fuzzy_import_trait_and_assoc_items() {
804-
mark::check!(type_aliases_ignored);
802+
cov_mark::check!(type_aliases_ignored);
805803
let ra_fixture = r#"
806804
//- /main.rs crate:main deps:dep
807805
//- /dep.rs crate:dep

0 commit comments

Comments
 (0)