From 94bbb2418aa5201ddf2d5faf01f349896303cb82 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 26 Jan 2019 23:57:03 +0100 Subject: Add marks --- crates/ra_hir/src/marks.rs | 2 ++ crates/ra_hir/src/ty.rs | 4 ++++ crates/ra_hir/src/ty/tests.rs | 5 +++++ 3 files changed, 11 insertions(+) (limited to 'crates/ra_hir/src') 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 @@ test_utils::marks!( name_res_works_for_broken_modules item_map_enum_importing + type_var_cycles_resolve_completely + type_var_cycles_resolve_as_possible ); 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; use join_to_string::join; use rustc_hash::FxHashMap; +use test_utils::tested_by; + use crate::{ Module, Function, Struct, StructField, Enum, EnumVariant, Path, Name, ImplBlock, FnSignature, FnScopes, ModuleDef, AdtDef, @@ -1020,6 +1022,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Ty::Infer(tv) => { let inner = tv.to_inner(); if tv_stack.contains(&inner) { + tested_by!(type_var_cycles_resolve_as_possible); // recursive type return tv.fallback_value(); } @@ -1062,6 +1065,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { Ty::Infer(tv) => { let inner = tv.to_inner(); if tv_stack.contains(&inner) { + tested_by!(type_var_cycles_resolve_completely); // recursive type return tv.fallback_value(); } 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; use ra_db::{SourceDatabase, salsa::Database}; use ra_syntax::ast::{self, AstNode}; +use test_utils::covers; use crate::{ source_binder, @@ -564,6 +565,8 @@ fn quux() { #[test] fn recursive_vars() { + covers!(type_var_cycles_resolve_completely); + covers!(type_var_cycles_resolve_as_possible); check_inference( "recursive_vars", r#" @@ -577,6 +580,8 @@ fn test() { #[test] fn recursive_vars_2() { + covers!(type_var_cycles_resolve_completely); + covers!(type_var_cycles_resolve_as_possible); check_inference( "recursive_vars_2", r#" -- cgit v1.2.3