|
| 1 | +error[E0310]: the parameter type `T` may not live long enough |
| 2 | + --> $DIR/static-lifetime-tip-with-default-type.rs:7:24 |
| 3 | + | |
| 4 | +LL | struct Foo<T, K = i32>(&'static T, &'static K); |
| 5 | + | ^^^^^^^^^^ |
| 6 | + | | |
| 7 | + | the parameter type `T` must be valid for the static lifetime... |
| 8 | + | ...so that the reference type `&'static T` does not outlive the data it points at |
| 9 | + | |
| 10 | +help: consider adding an explicit lifetime bound |
| 11 | + | |
| 12 | +LL | struct Foo<T: 'static, K = i32>(&'static T, &'static K); |
| 13 | + | +++++++++ |
| 14 | + |
| 15 | +error[E0310]: the parameter type `K` may not live long enough |
| 16 | + --> $DIR/static-lifetime-tip-with-default-type.rs:7:36 |
| 17 | + | |
| 18 | +LL | struct Foo<T, K = i32>(&'static T, &'static K); |
| 19 | + | ^^^^^^^^^^ |
| 20 | + | | |
| 21 | + | the parameter type `K` must be valid for the static lifetime... |
| 22 | + | ...so that the reference type `&'static K` does not outlive the data it points at |
| 23 | + | |
| 24 | +help: consider adding an explicit lifetime bound |
| 25 | + | |
| 26 | +LL | struct Foo<T, K: 'static = i32>(&'static T, &'static K); |
| 27 | + | +++++++++ |
| 28 | + |
| 29 | +error[E0310]: the parameter type `T` may not live long enough |
| 30 | + --> $DIR/static-lifetime-tip-with-default-type.rs:11:28 |
| 31 | + | |
| 32 | +LL | struct Bar<r#T, r#K = i32>(&'static r#T, &'static r#K); |
| 33 | + | ^^^^^^^^^^^^ |
| 34 | + | | |
| 35 | + | the parameter type `T` must be valid for the static lifetime... |
| 36 | + | ...so that the reference type `&'static T` does not outlive the data it points at |
| 37 | + | |
| 38 | +help: consider adding an explicit lifetime bound |
| 39 | + | |
| 40 | +LL | struct Bar<r#T: 'static, r#K = i32>(&'static r#T, &'static r#K); |
| 41 | + | +++++++++ |
| 42 | + |
| 43 | +error[E0310]: the parameter type `K` may not live long enough |
| 44 | + --> $DIR/static-lifetime-tip-with-default-type.rs:11:42 |
| 45 | + | |
| 46 | +LL | struct Bar<r#T, r#K = i32>(&'static r#T, &'static r#K); |
| 47 | + | ^^^^^^^^^^^^ |
| 48 | + | | |
| 49 | + | the parameter type `K` must be valid for the static lifetime... |
| 50 | + | ...so that the reference type `&'static K` does not outlive the data it points at |
| 51 | + | |
| 52 | +help: consider adding an explicit lifetime bound |
| 53 | + | |
| 54 | +LL | struct Bar<r#T, r#K: 'static = i32>(&'static r#T, &'static r#K); |
| 55 | + | +++++++++ |
| 56 | + |
| 57 | +error[E0310]: the parameter type `T` may not live long enough |
| 58 | + --> $DIR/static-lifetime-tip-with-default-type.rs:15:20 |
| 59 | + | |
| 60 | +LL | struct Boo<T= i32>(&'static T); |
| 61 | + | ^^^^^^^^^^ |
| 62 | + | | |
| 63 | + | the parameter type `T` must be valid for the static lifetime... |
| 64 | + | ...so that the reference type `&'static T` does not outlive the data it points at |
| 65 | + | |
| 66 | +help: consider adding an explicit lifetime bound |
| 67 | + | |
| 68 | +LL | struct Boo<T: 'static= i32>(&'static T); |
| 69 | + | +++++++++ |
| 70 | + |
| 71 | +error[E0310]: the parameter type `T` may not live long enough |
| 72 | + --> $DIR/static-lifetime-tip-with-default-type.rs:19:8 |
| 73 | + | |
| 74 | +LL | = i32>(&'static T); |
| 75 | + | ^^^^^^^^^^ |
| 76 | + | | |
| 77 | + | the parameter type `T` must be valid for the static lifetime... |
| 78 | + | ...so that the reference type `&'static T` does not outlive the data it points at |
| 79 | + | |
| 80 | +help: consider adding an explicit lifetime bound |
| 81 | + | |
| 82 | +LL | struct Far<T: 'static |
| 83 | + | +++++++++ |
| 84 | + |
| 85 | +error[E0310]: the parameter type `K` may not live long enough |
| 86 | + --> $DIR/static-lifetime-tip-with-default-type.rs:22:27 |
| 87 | + | |
| 88 | +LL | struct S<'a, K: 'a = i32>(&'static K); |
| 89 | + | ^^^^^^^^^^ |
| 90 | + | | |
| 91 | + | the parameter type `K` must be valid for the static lifetime... |
| 92 | + | ...so that the reference type `&'static K` does not outlive the data it points at |
| 93 | + | |
| 94 | +help: consider adding an explicit lifetime bound |
| 95 | + | |
| 96 | +LL | struct S<'a, K: 'a + 'static = i32>(&'static K); |
| 97 | + | +++++++++ |
| 98 | + |
| 99 | +error[E0392]: lifetime parameter `'a` is never used |
| 100 | + --> $DIR/static-lifetime-tip-with-default-type.rs:22:10 |
| 101 | + | |
| 102 | +LL | struct S<'a, K: 'a = i32>(&'static K); |
| 103 | + | ^^ unused lifetime parameter |
| 104 | + | |
| 105 | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` |
| 106 | + |
| 107 | +error: aborting due to 8 previous errors |
| 108 | + |
| 109 | +Some errors have detailed explanations: E0310, E0392. |
| 110 | +For more information about an error, try `rustc --explain E0310`. |
0 commit comments