|
| 1 | +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
| 2 | +// file at the top-level directory of this distribution and at |
| 3 | +// http://rust-lang.org/COPYRIGHT. |
| 4 | +// |
| 5 | +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | +// option. This file may not be copied, modified, or distributed |
| 9 | +// except according to those terms. |
| 10 | + |
| 11 | +// this used to cause exponential code-size blowup during LLVM passes. |
| 12 | + |
| 13 | +#![feature(test)] |
| 14 | + |
| 15 | +extern crate test; |
| 16 | + |
| 17 | +struct MayUnwind; |
| 18 | + |
| 19 | +impl Drop for MayUnwind { |
| 20 | + fn drop(&mut self) { |
| 21 | + if test::black_box(false) { |
| 22 | + panic!() |
| 23 | + } |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +struct DS<U> { |
| 28 | + may_unwind: MayUnwind, |
| 29 | + name: String, |
| 30 | + next: U, |
| 31 | +} |
| 32 | + |
| 33 | +fn add<U>(ds: DS<U>, name: String) -> DS<DS<U>> { |
| 34 | + DS { |
| 35 | + may_unwind: MayUnwind, |
| 36 | + name: "?".to_owned(), |
| 37 | + next: ds, |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +fn main() { |
| 42 | + let deserializers = DS { may_unwind: MayUnwind, name: "?".to_owned(), next: () }; |
| 43 | + let deserializers = add(deserializers, "?".to_owned()); |
| 44 | + let deserializers = add(deserializers, "?".to_owned()); |
| 45 | + let deserializers = add(deserializers, "?".to_owned()); |
| 46 | + let deserializers = add(deserializers, "?".to_owned()); |
| 47 | + let deserializers = add(deserializers, "?".to_owned()); |
| 48 | + let deserializers = add(deserializers, "?".to_owned()); |
| 49 | + let deserializers = add(deserializers, "?".to_owned()); // 0.7s |
| 50 | + let deserializers = add(deserializers, "?".to_owned()); // 1.3s |
| 51 | + let deserializers = add(deserializers, "?".to_owned()); // 2.4s |
| 52 | + let deserializers = add(deserializers, "?".to_owned()); // 6.7s |
| 53 | + let deserializers = add(deserializers, "?".to_owned()); // 26.0s |
| 54 | + let deserializers = add(deserializers, "?".to_owned()); // 114.0s |
| 55 | + let deserializers = add(deserializers, "?".to_owned()); // 228.0s |
| 56 | + let deserializers = add(deserializers, "?".to_owned()); // 400.0s |
| 57 | + let deserializers = add(deserializers, "?".to_owned()); // 800.0s |
| 58 | + let deserializers = add(deserializers, "?".to_owned()); // 1600.0s |
| 59 | + let deserializers = add(deserializers, "?".to_owned()); // 3200.0s |
| 60 | +} |
0 commit comments