Skip to content

Commit 7d83312

Browse files
authored
Rollup merge of #148506 - estebank:issue-41966, r=davidtwco
Special case detecting `'static` lifetime requirement coming from `-> Box<dyn Trait>` ``` error[E0310]: the parameter type `R` may not live long enough --> $DIR/implicit-static-lifetime-in-dyn-trait-return-type.rs:10:5 | LL | fn bb<R>(r: R) -> Box<dyn Foo> { | ------- this `dyn Trait` has an implicit `'static` lifetime bound LL | Box::new(Bar(r)) | ^^^^^^^^^^^^^^^^ | | | the parameter type `R` must be valid for the static lifetime... | ...so that the type `R` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | LL | fn bb<R: 'static>(r: R) -> Box<dyn Foo> { | +++++++++ ``` Partly address rust-lang/rust#41966 and rust-lang/rust#54753. rust-lang/rust#103849, which shows a case where there's an intermediary binding, is not addressed at all, as aren't cases *other* than `Box<dyn Trait>` return type.
2 parents a9fb3a5 + 0498b26 commit 7d83312

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)