Rollup merge of #133488 - Enselic:recurse-2, r=BoxyUwU

tests: Add regression test for self referential structs with cow as last field

Making compilation pass for this code was retroactively stabilized via FCP in 1.79. The code does not compile in 1.78.

See https://github.com/rust-lang/rust/issues/129541 for details.

Closes #107481
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-11-30 12:56:51 +08:00 committed by GitHub
commit f1d9ba8741
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<String, Self>>);
#[derive(Clone)]
struct Baz<'a>(Cow<'a, Vec<Self>>);
#[derive(Clone)]
struct Qux<'a>(Cow<'a, Box<Self>>);
fn main() {}