diff options
Diffstat (limited to 'tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs')
-rw-r--r-- | tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs b/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs new file mode 100644 index 000000000..c9e93174e --- /dev/null +++ b/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs @@ -0,0 +1,16 @@ +// `S` is infinitely recursing so it's not possible to generate a finite +// drop impl (ignoring polymorphization). +// +// Dropck should therefore detect that this is the case and eagerly error. + +struct S<T> { + t: T, + s: Box<S<fn(u: T)>>, +} + +fn f(x: S<u32>) {} //~ ERROR overflow while adding drop-check rules for S<u32> + +fn main() { + // Force instantiation. + f as fn(_); +} |