1
Fork 0
rust/compiler/rustc_trait_selection/src
Esteban Küber f5bae722be Point at explicit 'static obligations on a trait
Given `trait Any: 'static` and a `struct` with a `Box<dyn Any + 'a>` field, point at the `'static` bound in `Any` to explain why `'a: 'static`.

```
error[E0478]: lifetime bound not satisfied
   --> f202.rs:2:12
    |
2   |     value: Box<dyn std::any::Any + 'a>,
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: lifetime parameter instantiated with the lifetime `'a` as defined here
   --> f202.rs:1:14
    |
1   | struct Hello<'a> {
    |              ^^
note: but lifetime parameter must outlive the static lifetime
   --> /home/gh-estebank/rust/library/core/src/any.rs:113:16
    |
113 | pub trait Any: 'static {
    |                ^^^^^^^
```

Partially address #33652.
2024-08-21 16:40:15 +00:00
..
error_reporting Point at explicit 'static obligations on a trait 2024-08-21 16:40:15 +00:00
errors Reformat use declarations. 2024-07-29 08:26:52 +10:00
solve Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors 2024-08-14 21:43:07 +08:00
traits Rollup merge of #129217 - jswrenn:transmute-lifetimes, r=compiler-errors 2024-08-19 20:14:56 +02:00
errors.rs Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68 2024-07-30 17:49:08 +00:00
infer.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
lib.rs Move all error reporting into rustc_trait_selection 2024-07-21 22:34:35 -04:00
regions.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
solve.rs Rename a bunch of things 2024-06-21 12:32:05 -04:00