From 7fc4b963470de530a212f2b7eb87a0aeddba9a04 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Tue, 26 Nov 2024 06:25:56 +0100 Subject: [PATCH] tests: Add regression test for self referential struct with cow as last field --- ...lf-referential-struct-cow-as-last-field.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/ui/traits/solver-cycles/107481-self-referential-struct-cow-as-last-field.rs diff --git a/tests/ui/traits/solver-cycles/107481-self-referential-struct-cow-as-last-field.rs b/tests/ui/traits/solver-cycles/107481-self-referential-struct-cow-as-last-field.rs new file mode 100644 index 0000000000000..f953eb1c0f744 --- /dev/null +++ b/tests/ui/traits/solver-cycles/107481-self-referential-struct-cow-as-last-field.rs @@ -0,0 +1,19 @@ +// Regression test for #107481 + +//@ check-pass + +use std::{borrow::Cow, collections::HashMap}; + +#[derive(Clone)] +struct Foo<'a>(Cow<'a, [Self]>); + +#[derive(Clone)] +struct Bar<'a>(Cow<'a, HashMap>); + +#[derive(Clone)] +struct Baz<'a>(Cow<'a, Vec>); + +#[derive(Clone)] +struct Qux<'a>(Cow<'a, Box>); + +fn main() {}