1 # `infer_static_outlives_requirements`
3 The tracking issue for this feature is: [#54185]
5 [#54185]: https://github.com/rust-lang/rust/issues/54185
7 ------------------------
8 The `infer_static_outlives_requirements` feature indicates that certain
9 `'static` outlives requirements can be inferred by the compiler rather than
10 stating them explicitly.
12 Note: It is an accompanying feature to `infer_outlives_requirements`,
13 which must be enabled to infer outlives requirements.
15 For example, currently generic struct definitions that contain
16 references, require where-clauses of the form T: 'static. By using
17 this feature the outlives predicates will be inferred, although
18 they may still be written explicitly.
20 ```rust,ignore (pseudo-Rust)
21 struct Foo<U> where U: 'static { // <-- currently required
24 struct Bar<T: 'static> {
32 ```rust,ignore (pseudo-Rust)
33 #![feature(infer_outlives_requirements)]
34 #![feature(infer_static_outlives_requirements)]
37 // Implicitly infer U: 'static
41 struct Bar<T: 'static> {