]> git.lizzy.rs Git - rust.git/blob - tests/ui/dropck/dropck_no_diverge_on_nonregular_1.rs
Rollup merge of #106446 - bzEq:fix-unwind-lsda, r=Amanieu
[rust.git] / tests / ui / dropck / dropck_no_diverge_on_nonregular_1.rs
1 // Issue 22443: Reject code using non-regular types that would
2 // otherwise cause dropck to loop infinitely.
3
4 use std::marker::PhantomData;
5
6 struct Digit<T> {
7     elem: T
8 }
9
10 struct Node<T:'static> { m: PhantomData<&'static T> }
11
12
13 enum FingerTree<T:'static> {
14     Single(T),
15     // Bug report said Digit after Box would stack overflow (versus
16     // Digit before Box; see dropck_no_diverge_on_nonregular_2).
17     Deep(
18         Box<FingerTree<Node<T>>>,
19         Digit<T>,
20         )
21 }
22
23 fn main() {
24     let ft = //~ ERROR overflow while adding drop-check rules for FingerTree
25         FingerTree::Single(1);
26 }