error[E0310]: the parameter type `T` may not live long enough --> $DIR/wf-in-fn-type-static.rs:23:5 | LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static LL | x: fn() -> &'static T //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-fn-type-static.rs:23:5 | LL | x: fn() -> &'static T //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough --> $DIR/wf-in-fn-type-static.rs:28:5 | LL | struct Bar { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: Copy LL | x: fn(&'static T) //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-fn-type-static.rs:28:5 | LL | x: fn(&'static T) //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0310`.