]> git.proxmox.com Git - rustc.git/blame - src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / dropck / dropck_no_diverge_on_nonregular_3.rs
CommitLineData
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
9use std::marker::PhantomData;
10
11struct Digit<T> {
12 elem: T
13}
14
15struct Node<T:'static> { m: PhantomData<&'static T> }
16
17enum 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
26enum Wrapper<T:'static> {
27 Simple,
28 Other(FingerTree<T>),
29}
30
31fn 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}