]> git.lizzy.rs Git - rust.git/blob - src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs
Auto merge of #103647 - lqd:osx-x64-lto, r=Mark-Simulacrum
[rust.git] / src / test / ui / dropck / dropck_no_diverge_on_nonregular_2.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 enum FingerTree<T:'static> {
13     Single(T),
14     // Bug report said Digit before Box would infinite loop (versus
15     // Digit after Box; see dropck_no_diverge_on_nonregular_1).
16     Deep(
17         Digit<T>,
18         Box<FingerTree<Node<T>>>,
19         )
20 }
21
22 fn main() {
23     let ft = //~ ERROR overflow while adding drop-check rules for FingerTree
24         FingerTree::Single(1);
25 }