Skip to content

Commit 5a8b6b6

Browse files
committed
---
yaml --- r: 194410 b: refs/heads/tmp c: 1955e05 h: refs/heads/master v: v3
1 parent f3d8b12 commit 5a8b6b6

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: a3b13610c5b93d9ada072471a001a5613df6a960
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 5b2e8693e42dee545d336c0364773b3fbded93a5
37+
refs/heads/tmp: 1955e052675d4457432da85a00db0ae55be64e83
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3939
refs/tags/homu-tmp: 28a0b25f424090255966273994748a9f9901059f
4040
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright 2015 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+
// Issue 8142: Test that Drop impls cannot be specialized beyond the
12+
// predicates attached to the struct/enum definition itself.
13+
14+
#![feature(unsafe_destructor)]
15+
16+
trait Bound { fn foo(&self) { } }
17+
struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
18+
struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
19+
struct M<'m> { x: &'m i8 }
20+
struct N<'n> { x: &'n i8 }
21+
struct O<To> { x: *const To }
22+
struct P<Tp> { x: *const Tp }
23+
struct Q<Tq> { x: *const Tq }
24+
struct R<Tr> { x: *const Tr }
25+
struct S<Ts:Bound> { x: *const Ts }
26+
struct T<'t,Ts:'t> { x: &'t Ts }
27+
struct U;
28+
struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb }
29+
struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
30+
31+
#[unsafe_destructor]
32+
impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT
33+
//~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl.
34+
fn drop(&mut self) { } }
35+
36+
#[unsafe_destructor]
37+
impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT
38+
//~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl.
39+
fn drop(&mut self) { } }
40+
41+
#[unsafe_destructor]
42+
impl<'ml> Drop for M<'ml> { fn drop(&mut self) { } } // ACCEPT
43+
44+
#[unsafe_destructor]
45+
impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT
46+
//~^ ERROR Implementations of Drop cannot be specialized
47+
48+
#[unsafe_destructor]
49+
impl<Cok_nobound> Drop for O<Cok_nobound> { fn drop(&mut self) { } } // ACCEPT
50+
51+
#[unsafe_destructor]
52+
impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT
53+
//~^ ERROR Implementations of Drop cannot be specialized
54+
55+
#[unsafe_destructor]
56+
impl<Adds_bnd:Bound> Drop for Q<Adds_bnd> { fn drop(&mut self) { } } // REJECT
57+
//~^ ERROR The requirement `Adds_bnd : Bound` is added only by the Drop impl.
58+
59+
#[unsafe_destructor]
60+
impl<'rbnd,Adds_rbnd:'rbnd> Drop for R<Adds_rbnd> { fn drop(&mut self) { } } // REJECT
61+
//~^ ERROR The requirement `Adds_rbnd : 'rbnd` is added only by the Drop impl.
62+
63+
#[unsafe_destructor]
64+
impl<Bs:Bound> Drop for S<Bs> { fn drop(&mut self) { } } // ACCEPT
65+
66+
#[unsafe_destructor]
67+
impl<'t,Bt:'t> Drop for T<'t,Bt> { fn drop(&mut self) { } } // ACCEPT
68+
69+
impl Drop for U { fn drop(&mut self) { } } // ACCEPT
70+
71+
#[unsafe_destructor]
72+
impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT
73+
//~^ERROR Implementations of Drop cannot be specialized
74+
75+
#[unsafe_destructor]
76+
impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
77+
//~^ERROR Implementations of Drop cannot be specialized
78+
79+
pub fn main() { }

0 commit comments

Comments
 (0)