]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
1 | // Issue 22443: Reject code using non-regular types that would |
2 | // otherwise cause dropck to loop infinitely. | |
3 | // | |
4 | // This version is just checking that we still sanely handle a trivial | |
5 | // wrapper around the non-regular type. (It also demonstrates how the | |
6 | // error messages will report different types depending on which type | |
7 | // dropck is analyzing.) | |
8 | ||
9 | use std::marker::PhantomData; | |
10 | ||
11 | struct Digit<T> { | |
12 | elem: T | |
13 | } | |
14 | ||
15 | struct Node<T:'static> { m: PhantomData<&'static T> } | |
16 | ||
17 | enum FingerTree<T:'static> { | |
18 | Single(T), | |
19 | // According to the bug report, Digit before Box would infinite loop. | |
20 | Deep( | |
21 | Digit<T>, | |
22 | Box<FingerTree<Node<T>>>, | |
23 | ) | |
24 | } | |
25 | ||
26 | enum Wrapper<T:'static> { | |
27 | Simple, | |
28 | Other(FingerTree<T>), | |
29 | } | |
30 | ||
31 | fn main() { | |
1b1a35ee | 32 | let w = //~ ERROR overflow while adding drop-check rules for Option |
c34b1796 | 33 | Some(Wrapper::Simple::<u32>); |
1b1a35ee | 34 | //~^ ERROR overflow while adding drop-check rules for Option |
c34b1796 AL |
35 | //~| ERROR overflow while adding drop-check rules for Wrapper |
36 | } |