1 // Copyright 2016 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.
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.
11 // compile-flags: -C no-prepopulate-passes
13 #![crate_type = "lib"]
15 struct SomeUniqueName;
17 impl Drop for SomeUniqueName {
22 pub fn possibly_unwinding() {
25 // CHECK-LABEL: @droppy
28 // Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so
29 // that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
30 // regular function exit. We used to have problems with quadratic growths of drop calls in such
32 // CHECK-NOT: invoke{{.*}}drop{{.*}}SomeUniqueName
33 // CHECK: call{{.*}}drop{{.*}}SomeUniqueName
34 // CHECK: call{{.*}}drop{{.*}}SomeUniqueName
35 // CHECK-NOT: call{{.*}}drop{{.*}}SomeUniqueName
36 // CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
37 // CHECK: call{{.*}}drop{{.*}}SomeUniqueName
38 // CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
39 // CHECK: call{{.*}}drop{{.*}}SomeUniqueName
40 // CHECK-NOT: {{(call|invoke).*}}drop{{.*}}SomeUniqueName
41 // The next line checks for the } that ends the function definition
42 // CHECK-LABEL: {{^[}]}}
43 let _s = SomeUniqueName;
45 let _s = SomeUniqueName;
47 let _s = SomeUniqueName;