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 | 45 |
1 files changed, 44 insertions, 1 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 93a88ab58..23e51a9c1 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 @@ -573,7 +573,6 @@ fn issue_6811() { } "#, expect![[r#" - !0..16 'let_a=...t_b=1;': () !3..5 '_a': i32 !6..7 '1': i32 !11..13 '_b': i32 @@ -1527,6 +1526,34 @@ 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#" +trait Collection { + 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], +} +impl<T, const N: usize> Collection for ConstGen<T, N> { + type Item = T; + type Member<U> = ConstGen<U, N>; +} + "#, + ); + }) + .expect_err("must panic"); +} + +#[test] fn cfgd_out_self_param() { cov_mark::check!(cfgd_out_self_param); check_no_mismatches( @@ -1648,3 +1675,19 @@ fn main() { "#]], ); } + +#[test] +fn trailing_empty_macro() { + check_no_mismatches( + r#" +macro_rules! m2 { + ($($t:tt)*) => {$($t)*}; +} + +fn macrostmts() -> u8 { + m2! { 0 } + m2! {} +} + "#, + ); +} |