+++ /dev/null
-// Needs an explicit where clause stating outlives condition. (RFC 2093)
-
-// Type T needs to outlive lifetime 'static.
-struct Foo<U> {
- bar: Bar<U> //~ ERROR the parameter type `U` may not live long enough [E0310]
-}
-struct Bar<T: 'static> {
- x: T,
-}
-
-
-fn main() { }
+++ /dev/null
-error[E0310]: the parameter type `U` may not live long enough
- --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:10
- |
-LL | bar: Bar<U>
- | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
- |
-note: ...that is required by this bound
- --> $DIR/feature-gate-infer_static_outlives_requirements.rs:7:15
- |
-LL | struct Bar<T: 'static> {
- | ^^^^^^^
-help: consider adding an explicit lifetime bound...
- |
-LL | struct Foo<U: 'static> {
- | +++++++++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0310`.
/*
- * We don't infer `T: 'static` outlives relationships by default.
- * Instead an additional feature gate `infer_static_outlives_requirements`
- * is required.
+ * We don't infer `T: 'static` outlives relationships.
*/
struct Foo<U> {
error[E0310]: the parameter type `U` may not live long enough
- --> $DIR/dont-infer-static.rs:8:10
+ --> $DIR/dont-infer-static.rs:6:10
|
LL | bar: Bar<U>
| ^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
|
note: ...that is required by this bound
- --> $DIR/dont-infer-static.rs:10:15
+ --> $DIR/dont-infer-static.rs:8:15
|
LL | struct Bar<T: 'static> {
| ^^^^^^^
+++ /dev/null
-#![feature(rustc_attrs)]
-#![feature(infer_static_outlives_requirements)]
-
-#[rustc_outlives]
-struct Foo<U> { //~ ERROR rustc_outlives
- bar: Bar<U>
-}
-struct Bar<T: 'static> {
- x: T,
-}
-
-fn main() {}
+++ /dev/null
-error: rustc_outlives
- --> $DIR/infer-static.rs:5:1
- |
-LL | / struct Foo<U> {
-LL | | bar: Bar<U>
-LL | | }
- | |_^
- |
- = note: U: 'static
-
-error: aborting due to previous error
-