diff options
Diffstat (limited to 'src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs')
-rw-r--r-- | src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs b/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs index 23e51a9c1..a155adcec 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/tests/regression.rs @@ -1488,7 +1488,6 @@ fn regression_11688_4() { #[test] fn gat_crash_1() { - cov_mark::check!(ignore_gats); check_no_mismatches( r#" trait ATrait {} @@ -1527,30 +1526,22 @@ unsafe impl Storage for InlineStorage { #[test] fn gat_crash_3() { - // FIXME: This test currently crashes rust analyzer in a debug build but not in a - // release build (i.e. for the user). With the assumption that tests will always be run - // in debug mode, we catch the unwind and expect that it panicked. See the - // [`crate::utils::generics`] function for more information. - cov_mark::check!(ignore_gats); - std::panic::catch_unwind(|| { - check_no_mismatches( - r#" + check_no_mismatches( + r#" trait Collection { - type Item; - type Member<T>: Collection<Item = T>; - fn add(&mut self, value: Self::Item) -> Result<(), Self::Error>; +type Item; +type Member<T>: Collection<Item = T>; +fn add(&mut self, value: Self::Item) -> Result<(), Self::Error>; } struct ConstGen<T, const N: usize> { - data: [T; N], +data: [T; N], } impl<T, const N: usize> Collection for ConstGen<T, N> { - type Item = T; - type Member<U> = ConstGen<U, N>; +type Item = T; +type Member<U> = ConstGen<U, N>; } - "#, - ); - }) - .expect_err("must panic"); + "#, + ); } #[test] @@ -1691,3 +1682,28 @@ fn macrostmts() -> u8 { "#, ); } + +#[test] +fn dyn_with_unresolved_trait() { + check_types( + r#" +fn foo(a: &dyn DoesNotExist) { + a.bar(); + //^&{unknown} +} + "#, + ); +} + +#[test] +fn self_assoc_with_const_generics_crash() { + check_no_mismatches( + r#" +trait Trait { type Item; } +impl<T, const N: usize> Trait for [T; N] { + type Item = (); + fn f<U>(_: Self::Item) {} +} + "#, + ); +} |