1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
// Issue 8142: Test that Drop impls cannot be specialized beyond the
// predicates attached to the type definition itself.
trait Bound {
fn foo(&self) {}
}
struct K<'l1, 'l2> {
x: &'l1 i8,
y: &'l2 u8,
}
struct L<'l1, 'l2> {
x: &'l1 i8,
y: &'l2 u8,
}
struct M<'m> {
x: &'m i8,
}
struct N<'n> {
x: &'n i8,
}
struct O<To> {
x: *const To,
}
struct P<Tp> {
x: *const Tp,
}
struct Q<Tq> {
x: *const Tq,
}
struct R<Tr> {
x: *const Tr,
}
struct S<Ts: Bound> {
x: *const Ts,
}
struct T<'t, Ts: 't> {
x: &'t Ts,
}
struct U;
struct V<Tva, Tvb> {
x: *const Tva,
y: *const Tvb,
}
struct W<'l1, 'l2> {
x: &'l1 i8,
y: &'l2 u8,
}
struct X<const Ca: usize>;
struct Y<const Ca: usize, const Cb: usize>;
enum Enum<T> {
Variant(T),
}
struct TupleStruct<T>(T);
union Union<T: Copy> {
f: T,
}
impl<'al, 'adds_bnd: 'al> Drop for K<'al, 'adds_bnd> {
//~^ ERROR `Drop` impl requires `'adds_bnd: 'al`
fn drop(&mut self) {}
}
impl<'al, 'adds_bnd> Drop for L<'al, 'adds_bnd>
//~^ ERROR `Drop` impl requires `'adds_bnd: 'al`
where
'adds_bnd: 'al,
{
fn drop(&mut self) {}
}
impl<'ml> Drop for M<'ml> {
fn drop(&mut self) {}
}
impl Drop for N<'static> {
//~^ ERROR `Drop` impls cannot be specialized
fn drop(&mut self) {}
}
impl<COkNoBound> Drop for O<COkNoBound> {
fn drop(&mut self) {}
}
impl Drop for P<i8> {
//~^ ERROR `Drop` impls cannot be specialized
fn drop(&mut self) {}
}
impl<AddsBnd: Bound> Drop for Q<AddsBnd> {
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
fn drop(&mut self) {}
}
impl<'rbnd, AddsRBnd: 'rbnd> Drop for R<AddsRBnd> {
fn drop(&mut self) {}
}
impl<Bs: Bound> Drop for S<Bs> {
fn drop(&mut self) {}
}
impl<'t, Bt: 't> Drop for T<'t, Bt> {
fn drop(&mut self) {}
}
impl Drop for U {
fn drop(&mut self) {}
}
impl<One> Drop for V<One, One> {
//~^ ERROR `Drop` impls cannot be specialized
fn drop(&mut self) {}
}
impl<'lw> Drop for W<'lw, 'lw> {
//~^ ERROR `Drop` impls cannot be specialized
fn drop(&mut self) {}
}
impl Drop for X<3> {
//~^ ERROR `Drop` impls cannot be specialized
fn drop(&mut self) {}
}
impl<const Ca: usize> Drop for Y<Ca, Ca> {
//~^ ERROR `Drop` impls cannot be specialized
fn drop(&mut self) {}
}
impl<AddsBnd: Bound> Drop for Enum<AddsBnd> {
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
fn drop(&mut self) {}
}
impl<AddsBnd: Bound> Drop for TupleStruct<AddsBnd> {
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
fn drop(&mut self) {}
}
impl<AddsBnd: Copy + Bound> Drop for Union<AddsBnd> {
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
fn drop(&mut self) {}
}
pub fn main() {}
|