diff options
author | Florian Diebold <[email protected]> | 2019-09-07 15:39:05 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-09-07 15:49:57 +0100 |
commit | 8fb3cab76c60fbff5ae6f5984ac07b09b42b742c (patch) | |
tree | fdf832ba772141368f27d733cd718ee9a599a346 /crates/ra_hir/src/ty | |
parent | 9db34eec209c740ed919afb288f75daa755cd268 (diff) |
Fix crash for super trait cycles
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 3f86a5c80..c4bddde85 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -3695,6 +3695,27 @@ fn test<T: Trait1, U: Trait2>(x: T, y: U) { | |||
3695 | } | 3695 | } |
3696 | 3696 | ||
3697 | #[test] | 3697 | #[test] |
3698 | fn super_trait_cycle() { | ||
3699 | // This just needs to not crash | ||
3700 | assert_snapshot!( | ||
3701 | infer(r#" | ||
3702 | trait A: B {} | ||
3703 | trait B: A {} | ||
3704 | |||
3705 | fn test<T: A>(x: T) { | ||
3706 | x.foo(); | ||
3707 | } | ||
3708 | "#), | ||
3709 | @r###" | ||
3710 | [44; 45) 'x': T | ||
3711 | [50; 66) '{ ...o(); }': () | ||
3712 | [56; 57) 'x': T | ||
3713 | [56; 63) 'x.foo()': {unknown} | ||
3714 | "### | ||
3715 | ); | ||
3716 | } | ||
3717 | |||
3718 | #[test] | ||
3698 | fn super_trait_assoc_type_bounds() { | 3719 | fn super_trait_assoc_type_bounds() { |
3699 | assert_snapshot!( | 3720 | assert_snapshot!( |
3700 | infer(r#" | 3721 | infer(r#" |