Skip to content

Commit 4124d8e

Browse files
committed
Moved new dropck-eyepatch compile-fail tests to the ui/ subtree.
1 parent 0d8f716 commit 4124d8e

9 files changed

+166
-2
lines changed

src/test/compile-fail/auxiliary/dropck_eyepatch_extern_crate.rs renamed to src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
#![feature(generic_param_attrs)]
1212
#![feature(dropck_eyepatch)]
1313

14+
// This is a support file for ../dropck-eyepatch-extern-crate.rs
15+
//
1416
// The point of this test is to illustrate that the `#[may_dangle]`
1517
// attribute specifically allows, in the context of a type
1618
// implementing `Drop`, a generic parameter to be instantiated with a
1719
// lifetime that does not strictly outlive the owning type itself,
18-
// and that this attributes effects are preserved when importing
20+
// and that this attribute's effects are preserved when importing
1921
// the type from another crate.
2022
//
21-
// See also dropck-eyepatch.rs for more information about the general
23+
// See also ../dropck-eyepatch.rs for more information about the general
2224
// structure of the test.
2325

2426
use std::fmt;

src/test/compile-fail/dropck-eyepatch-extern-crate.rs renamed to src/test/ui/dropck/dropck-eyepatch-extern-crate.rs

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010

1111
// aux-build:dropck_eyepatch_extern_crate.rs
1212

13+
// The point of this test is to illustrate that the `#[may_dangle]`
14+
// attribute specifically allows, in the context of a type
15+
// implementing `Drop`, a generic parameter to be instantiated with a
16+
// lifetime that does not strictly outlive the owning type itself,
17+
// and that this attribute's effects are preserved when importing
18+
// the type from another crate.
19+
//
20+
// See also dropck-eyepatch.rs for more information about the general
21+
// structure of the test.
22+
1323
extern crate dropck_eyepatch_extern_crate as other;
1424

1525
use other::{Dt,Dr,Pt,Pr,St,Sr};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: `c` does not live long enough
2+
--> $DIR/dropck-eyepatch-extern-crate.rs:39:20
3+
|
4+
39 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
5+
| ^ does not live long enough
6+
...
7+
55 | }
8+
| - borrowed value dropped before borrower
9+
|
10+
= note: values in a scope are dropped in the opposite order they are created
11+
12+
error: `c` does not live long enough
13+
--> $DIR/dropck-eyepatch-extern-crate.rs:40:20
14+
|
15+
40 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
16+
| ^ does not live long enough
17+
...
18+
55 | }
19+
| - borrowed value dropped before borrower
20+
|
21+
= note: values in a scope are dropped in the opposite order they are created
22+
23+
error: `c` does not live long enough
24+
--> $DIR/dropck-eyepatch-extern-crate.rs:47:29
25+
|
26+
47 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
27+
| ^ does not live long enough
28+
...
29+
55 | }
30+
| - borrowed value dropped before borrower
31+
|
32+
= note: values in a scope are dropped in the opposite order they are created
33+
34+
error: `c` does not live long enough
35+
--> $DIR/dropck-eyepatch-extern-crate.rs:48:29
36+
|
37+
48 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
38+
| ^ does not live long enough
39+
...
40+
55 | }
41+
| - borrowed value dropped before borrower
42+
|
43+
= note: values in a scope are dropped in the opposite order they are created
44+
45+
error: aborting due to 4 previous errors
46+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
2+
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:32:1
3+
|
4+
32 | impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
5+
| ^
6+
7+
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
8+
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:38:1
9+
|
10+
38 | impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
11+
| ^
12+
13+
error: aborting due to 2 previous errors
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: `c` does not live long enough
2+
--> $DIR/dropck-eyepatch-reorder.rs:57:20
3+
|
4+
57 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
5+
| ^ does not live long enough
6+
...
7+
73 | }
8+
| - borrowed value dropped before borrower
9+
|
10+
= note: values in a scope are dropped in the opposite order they are created
11+
12+
error: `c` does not live long enough
13+
--> $DIR/dropck-eyepatch-reorder.rs:58:20
14+
|
15+
58 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
16+
| ^ does not live long enough
17+
...
18+
73 | }
19+
| - borrowed value dropped before borrower
20+
|
21+
= note: values in a scope are dropped in the opposite order they are created
22+
23+
error: `c` does not live long enough
24+
--> $DIR/dropck-eyepatch-reorder.rs:65:29
25+
|
26+
65 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
27+
| ^ does not live long enough
28+
...
29+
73 | }
30+
| - borrowed value dropped before borrower
31+
|
32+
= note: values in a scope are dropped in the opposite order they are created
33+
34+
error: `c` does not live long enough
35+
--> $DIR/dropck-eyepatch-reorder.rs:66:29
36+
|
37+
66 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
38+
| ^ does not live long enough
39+
...
40+
73 | }
41+
| - borrowed value dropped before borrower
42+
|
43+
= note: values in a scope are dropped in the opposite order they are created
44+
45+
error: aborting due to 4 previous errors
46+
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: `c` does not live long enough
2+
--> $DIR/dropck-eyepatch.rs:80:20
3+
|
4+
80 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
5+
| ^ does not live long enough
6+
...
7+
96 | }
8+
| - borrowed value dropped before borrower
9+
|
10+
= note: values in a scope are dropped in the opposite order they are created
11+
12+
error: `c` does not live long enough
13+
--> $DIR/dropck-eyepatch.rs:81:20
14+
|
15+
81 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
16+
| ^ does not live long enough
17+
...
18+
96 | }
19+
| - borrowed value dropped before borrower
20+
|
21+
= note: values in a scope are dropped in the opposite order they are created
22+
23+
error: `c` does not live long enough
24+
--> $DIR/dropck-eyepatch.rs:88:29
25+
|
26+
88 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
27+
| ^ does not live long enough
28+
...
29+
96 | }
30+
| - borrowed value dropped before borrower
31+
|
32+
= note: values in a scope are dropped in the opposite order they are created
33+
34+
error: `c` does not live long enough
35+
--> $DIR/dropck-eyepatch.rs:89:29
36+
|
37+
89 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
38+
| ^ does not live long enough
39+
...
40+
96 | }
41+
| - borrowed value dropped before borrower
42+
|
43+
= note: values in a scope are dropped in the opposite order they are created
44+
45+
error: aborting due to 4 previous errors
46+

0 commit comments

Comments
 (0)