From 4124d8e48b9ffbd9f33819eba74baadf6cfdbe6c Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 17 Oct 2016 18:02:23 +0200 Subject: [PATCH] Moved new dropck-eyepatch compile-fail tests to the `ui/` subtree. --- .../auxiliary/dropck_eyepatch_extern_crate.rs | 6 ++- .../dropck}/dropck-eyepatch-extern-crate.rs | 10 ++++ .../dropck-eyepatch-extern-crate.stderr | 46 +++++++++++++++++++ .../dropck-eyepatch-implies-unsafe-impl.rs | 0 ...dropck-eyepatch-implies-unsafe-impl.stderr | 14 ++++++ .../dropck}/dropck-eyepatch-reorder.rs | 0 .../ui/dropck/dropck-eyepatch-reorder.stderr | 46 +++++++++++++++++++ .../dropck}/dropck-eyepatch.rs | 0 src/test/ui/dropck/dropck-eyepatch.stderr | 46 +++++++++++++++++++ 9 files changed, 166 insertions(+), 2 deletions(-) rename src/test/{compile-fail => ui/dropck}/auxiliary/dropck_eyepatch_extern_crate.rs (90%) rename src/test/{compile-fail => ui/dropck}/dropck-eyepatch-extern-crate.rs (77%) create mode 100644 src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr rename src/test/{compile-fail => ui/dropck}/dropck-eyepatch-implies-unsafe-impl.rs (100%) create mode 100644 src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr rename src/test/{compile-fail => ui/dropck}/dropck-eyepatch-reorder.rs (100%) create mode 100644 src/test/ui/dropck/dropck-eyepatch-reorder.stderr rename src/test/{compile-fail => ui/dropck}/dropck-eyepatch.rs (100%) create mode 100644 src/test/ui/dropck/dropck-eyepatch.stderr diff --git a/src/test/compile-fail/auxiliary/dropck_eyepatch_extern_crate.rs b/src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs similarity index 90% rename from src/test/compile-fail/auxiliary/dropck_eyepatch_extern_crate.rs rename to src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs index 15983ada5ea..1b00d88dcb3 100644 --- a/src/test/compile-fail/auxiliary/dropck_eyepatch_extern_crate.rs +++ b/src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs @@ -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; diff --git a/src/test/compile-fail/dropck-eyepatch-extern-crate.rs b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs similarity index 77% rename from src/test/compile-fail/dropck-eyepatch-extern-crate.rs rename to src/test/ui/dropck/dropck-eyepatch-extern-crate.rs index 189340992e9..5e200dbdbfa 100644 --- a/src/test/compile-fail/dropck-eyepatch-extern-crate.rs +++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs @@ -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}; diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr new file mode 100644 index 00000000000..5d2096e8b07 --- /dev/null +++ b/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 + diff --git a/src/test/compile-fail/dropck-eyepatch-implies-unsafe-impl.rs b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.rs similarity index 100% rename from src/test/compile-fail/dropck-eyepatch-implies-unsafe-impl.rs rename to src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.rs diff --git a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr new file mode 100644 index 00000000000..c53cf020a9b --- /dev/null +++ b/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 { + | ^ + +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 + diff --git a/src/test/compile-fail/dropck-eyepatch-reorder.rs b/src/test/ui/dropck/dropck-eyepatch-reorder.rs similarity index 100% rename from src/test/compile-fail/dropck-eyepatch-reorder.rs rename to src/test/ui/dropck/dropck-eyepatch-reorder.rs diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.stderr new file mode 100644 index 00000000000..33b18f6f02e --- /dev/null +++ b/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 + diff --git a/src/test/compile-fail/dropck-eyepatch.rs b/src/test/ui/dropck/dropck-eyepatch.rs similarity index 100% rename from src/test/compile-fail/dropck-eyepatch.rs rename to src/test/ui/dropck/dropck-eyepatch.rs diff --git a/src/test/ui/dropck/dropck-eyepatch.stderr b/src/test/ui/dropck/dropck-eyepatch.stderr new file mode 100644 index 00000000000..75e612ca9c8 --- /dev/null +++ b/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 +