]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
1 | // Issue 8142: Test that Drop impls cannot be specialized beyond the |
2 | // predicates attached to the struct/enum definition itself. | |
3 | ||
c34b1796 AL |
4 | trait Bound { fn foo(&self) { } } |
5 | struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } | |
6 | struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } | |
7 | struct M<'m> { x: &'m i8 } | |
8 | struct N<'n> { x: &'n i8 } | |
9 | struct O<To> { x: *const To } | |
10 | struct P<Tp> { x: *const Tp } | |
11 | struct Q<Tq> { x: *const Tq } | |
12 | struct R<Tr> { x: *const Tr } | |
13 | struct S<Ts:Bound> { x: *const Ts } | |
14 | struct T<'t,Ts:'t> { x: &'t Ts } | |
15 | struct U; | |
16 | struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb } | |
17 | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } | |
18 | ||
c34b1796 AL |
19 | impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT |
20 | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. | |
21 | fn drop(&mut self) { } } | |
22 | ||
c34b1796 AL |
23 | impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT |
24 | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. | |
25 | fn drop(&mut self) { } } | |
26 | ||
c34b1796 AL |
27 | impl<'ml> Drop for M<'ml> { fn drop(&mut self) { } } // ACCEPT |
28 | ||
c34b1796 | 29 | impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT |
e9174d1e | 30 | //~^ ERROR mismatched types |
60c5eb7d XL |
31 | //~| expected struct `N<'n>` |
32 | //~| found struct `N<'static>` | |
c34b1796 | 33 | |
0731742a | 34 | impl<COkNoBound> Drop for O<COkNoBound> { fn drop(&mut self) { } } // ACCEPT |
c34b1796 | 35 | |
c34b1796 AL |
36 | impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT |
37 | //~^ ERROR Implementations of Drop cannot be specialized | |
38 | ||
0731742a XL |
39 | impl<AddsBnd:Bound> Drop for Q<AddsBnd> { fn drop(&mut self) { } } // REJECT |
40 | //~^ ERROR The requirement `AddsBnd: Bound` is added only by the Drop impl. | |
c34b1796 | 41 | |
0731742a XL |
42 | impl<'rbnd,AddsRBnd:'rbnd> Drop for R<AddsRBnd> { fn drop(&mut self) { } } // REJECT |
43 | //~^ ERROR The requirement `AddsRBnd : 'rbnd` is added only by the Drop impl. | |
c34b1796 | 44 | |
c34b1796 AL |
45 | impl<Bs:Bound> Drop for S<Bs> { fn drop(&mut self) { } } // ACCEPT |
46 | ||
c34b1796 AL |
47 | impl<'t,Bt:'t> Drop for T<'t,Bt> { fn drop(&mut self) { } } // ACCEPT |
48 | ||
49 | impl Drop for U { fn drop(&mut self) { } } // ACCEPT | |
50 | ||
c34b1796 | 51 | impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT |
e9174d1e | 52 | //~^ ERROR Implementations of Drop cannot be specialized |
c34b1796 | 53 | |
c34b1796 | 54 | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT |
e74abb32 | 55 | //~^ ERROR cannot infer an appropriate lifetime for lifetime parameter `'lw` |
c34b1796 AL |
56 | |
57 | pub fn main() { } |