Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point at explicit 'static obligations on a trait #129070

Merged
merged 1 commit into from
Aug 22, 2024

Commits on Aug 21, 2024

  1. 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 rust-lang#33652.
    estebank committed Aug 21, 2024
    Configuration menu
    Copy the full SHA
    f5bae72 View commit details
    Browse the repository at this point in the history