From e8cb11c7e39d896a6d361e86470cf3dcae8856a9 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 18 Feb 2015 10:20:01 -0500 Subject: [PATCH] Missing test. --- .../regions-close-object-into-object-5.rs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/test/compile-fail/regions-close-object-into-object-5.rs diff --git a/src/test/compile-fail/regions-close-object-into-object-5.rs b/src/test/compile-fail/regions-close-object-into-object-5.rs new file mode 100644 index 000000000000..05c6c6d9f9e0 --- /dev/null +++ b/src/test/compile-fail/regions-close-object-into-object-5.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(box_syntax)] +#![allow(warnings)] + +use std::marker::MarkerTrait; + +trait A +{ + fn get(&self) -> T { panic!() } +} + +struct B<'a, T>(&'a (A+'a)); + +trait X : MarkerTrait {} + +impl<'a, T> X for B<'a, T> {} + +fn f<'a, T, U>(v: Box+'static>) -> Box { + box B(&*v) as Box //~ ERROR the parameter type `T` may not live long enough +} + +fn main() {} +