Moved new dropck-eyepatch compile-fail tests to the ui/
subtree.
This commit is contained in:
parent
0d8f7164bb
commit
4124d8e48b
9 changed files with 166 additions and 2 deletions
|
@ -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;
|
|
@ -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};
|
46
src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
Normal file
46
src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
Normal file
|
@ -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
|
||||
|
|
@ -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
src/test/ui/dropck/dropck-eyepatch-reorder.stderr
Normal file
46
src/test/ui/dropck/dropck-eyepatch-reorder.stderr
Normal file
|
@ -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
|
||||
|
46
src/test/ui/dropck/dropck-eyepatch.stderr
Normal file
46
src/test/ui/dropck/dropck-eyepatch.stderr
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue