Skip to content

Commit

Permalink
Moved new dropck-eyepatch compile-fail tests to the ui/ subtree.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Oct 17, 2016
1 parent 0d8f716 commit 4124d8e
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 2 deletions.
Expand Up @@ -11,14 +11,16 @@
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]

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

use std::fmt;
Expand Down
Expand Up @@ -10,6 +10,16 @@

// aux-build:dropck_eyepatch_extern_crate.rs

// The point of this test is to illustrate that the `#[may_dangle]`
// attribute specifically allows, in the context of a type
// implementing `Drop`, a generic parameter to be instantiated with a
// lifetime that does not strictly outlive the owning type itself,
// and that this attribute's effects are preserved when importing
// the type from another crate.
//
// See also dropck-eyepatch.rs for more information about the general
// structure of the test.

extern crate dropck_eyepatch_extern_crate as other;

use other::{Dt,Dr,Pt,Pr,St,Sr};
Expand Down
46 changes: 46 additions & 0 deletions src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
@@ -0,0 +1,46 @@
error: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:39:20
|
39 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
55 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:40:20
|
40 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
55 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:47:29
|
47 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
55 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:48:29
|
48 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
55 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: aborting due to 4 previous errors

14 changes: 14 additions & 0 deletions src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr
@@ -0,0 +1,14 @@
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:32:1
|
32 | impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
| ^

error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:38:1
|
38 | impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
| ^

error: aborting due to 2 previous errors

46 changes: 46 additions & 0 deletions src/test/ui/dropck/dropck-eyepatch-reorder.stderr
@@ -0,0 +1,46 @@
error: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:57:20
|
57 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
73 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:58:20
|
58 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
73 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:65:29
|
65 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
73 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:66:29
|
66 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
73 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: aborting due to 4 previous errors

File renamed without changes.
46 changes: 46 additions & 0 deletions src/test/ui/dropck/dropck-eyepatch.stderr
@@ -0,0 +1,46 @@
error: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:80:20
|
80 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
96 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:81:20
|
81 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
96 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:88:29
|
88 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
96 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:89:29
|
89 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
| ^ does not live long enough
...
96 | }
| - borrowed value dropped before borrower
|
= note: values in a scope are dropped in the opposite order they are created

error: aborting due to 4 previous errors

0 comments on commit 4124d8e

Please sign in to comment.