aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-01-26 22:57:03 +0000
committerFlorian Diebold <[email protected]>2019-01-26 22:59:11 +0000
commit94bbb2418aa5201ddf2d5faf01f349896303cb82 (patch)
tree7a90002872ed3a2ea6d6df369519053e277d1a1f /crates/ra_hir/src
parent77f92674f9a2ea8e8cd303d15710621a4f7839cb (diff)
Add marks
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/marks.rs2
-rw-r--r--crates/ra_hir/src/ty.rs4
-rw-r--r--crates/ra_hir/src/ty/tests.rs5
3 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_hir/src/marks.rs b/crates/ra_hir/src/marks.rs
index 338ed0516..d704c3adb 100644
--- a/crates/ra_hir/src/marks.rs
+++ b/crates/ra_hir/src/marks.rs
@@ -1,4 +1,6 @@
1test_utils::marks!( 1test_utils::marks!(
2 name_res_works_for_broken_modules 2 name_res_works_for_broken_modules
3 item_map_enum_importing 3 item_map_enum_importing
4 type_var_cycles_resolve_completely
5 type_var_cycles_resolve_as_possible
4); 6);
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 67fcc5346..31ea45706 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -29,6 +29,8 @@ use ra_arena::map::ArenaMap;
29use join_to_string::join; 29use join_to_string::join;
30use rustc_hash::FxHashMap; 30use rustc_hash::FxHashMap;
31 31
32use test_utils::tested_by;
33
32use crate::{ 34use crate::{
33 Module, Function, Struct, StructField, Enum, EnumVariant, Path, Name, ImplBlock, 35 Module, Function, Struct, StructField, Enum, EnumVariant, Path, Name, ImplBlock,
34 FnSignature, FnScopes, ModuleDef, AdtDef, 36 FnSignature, FnScopes, ModuleDef, AdtDef,
@@ -1020,6 +1022,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1020 Ty::Infer(tv) => { 1022 Ty::Infer(tv) => {
1021 let inner = tv.to_inner(); 1023 let inner = tv.to_inner();
1022 if tv_stack.contains(&inner) { 1024 if tv_stack.contains(&inner) {
1025 tested_by!(type_var_cycles_resolve_as_possible);
1023 // recursive type 1026 // recursive type
1024 return tv.fallback_value(); 1027 return tv.fallback_value();
1025 } 1028 }
@@ -1062,6 +1065,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1062 Ty::Infer(tv) => { 1065 Ty::Infer(tv) => {
1063 let inner = tv.to_inner(); 1066 let inner = tv.to_inner();
1064 if tv_stack.contains(&inner) { 1067 if tv_stack.contains(&inner) {
1068 tested_by!(type_var_cycles_resolve_completely);
1065 // recursive type 1069 // recursive type
1066 return tv.fallback_value(); 1070 return tv.fallback_value();
1067 } 1071 }
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index e34daa0f7..f74d6f5ea 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -3,6 +3,7 @@ use std::fmt::Write;
3 3
4use ra_db::{SourceDatabase, salsa::Database}; 4use ra_db::{SourceDatabase, salsa::Database};
5use ra_syntax::ast::{self, AstNode}; 5use ra_syntax::ast::{self, AstNode};
6use test_utils::covers;
6 7
7use crate::{ 8use crate::{
8 source_binder, 9 source_binder,
@@ -564,6 +565,8 @@ fn quux() {
564 565
565#[test] 566#[test]
566fn recursive_vars() { 567fn recursive_vars() {
568 covers!(type_var_cycles_resolve_completely);
569 covers!(type_var_cycles_resolve_as_possible);
567 check_inference( 570 check_inference(
568 "recursive_vars", 571 "recursive_vars",
569 r#" 572 r#"
@@ -577,6 +580,8 @@ fn test() {
577 580
578#[test] 581#[test]
579fn recursive_vars_2() { 582fn recursive_vars_2() {
583 covers!(type_var_cycles_resolve_completely);
584 covers!(type_var_cycles_resolve_as_possible);
580 check_inference( 585 check_inference(
581 "recursive_vars_2", 586 "recursive_vars_2",
582 r#" 587 r#"