Skip to content

Explicit lifetime bound now required for Any #95028

Closed
@Sytten

Description

@Sytten

This might be working as expected but I just wanted to report that builds of diesel started failing on nightly 2022-03-16 (commit 52b3455).

The lines in question are https://github.com/diesel-rs/diesel/blob/7184f128a3c1435d12b32f413b14b6632e2f753c/diesel/src/connection/mod.rs#L442-L477.

Here are the errors:

error[E0310]: the parameter type `DB` may not live long enough
   --> /home/runner/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/c1b8ddc/diesel/src/connection/mod.rs:278:14
    |
267 | impl<DB: Backend> dyn BoxableConnection<DB> {
    |      --- help: consider adding an explicit lifetime bound...: `DB: 'static +`
...
278 |         self.as_any().downcast_ref::<T>()
    |              ^^^^^^ ...so that the type `(dyn BoxableConnection<DB> + 'static)` will meet its required lifetime bounds...
    |
note: ...that is required by this bound
   --> /home/runner/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/c1b8ddc/diesel/src/connection/mod.rs:246:62
    |
246 | pub trait BoxableConnection<DB: Backend>: SimpleConnection + std::any::Any {
    |                                                              ^^^^^^^^^^^^^

error[E0310]: the parameter type `DB` may not live long enough
   --> /home/runner/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/c1b8ddc/diesel/src/connection/mod.rs:291:14
    |
267 | impl<DB: Backend> dyn BoxableConnection<DB> {
    |      --- help: consider adding an explicit lifetime bound...: `DB: 'static +`
...
291 |         self.as_any_mut().downcast_mut::<T>()
    |              ^^^^^^^^^^ ...so that the type `(dyn BoxableConnection<DB> + 'static)` will meet its required lifetime bounds...
    |
note: ...that is required by this bound
   --> /home/runner/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/c1b8ddc/diesel/src/connection/mod.rs:246:62
    |
246 | pub trait BoxableConnection<DB: Backend>: SimpleConnection + std::any::Any {
    |                                                              ^^^^^^^^^^^^^

error[E0310]: the parameter type `DB` may not live long enough
   --> /home/runner/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/c1b8ddc/diesel/src/connection/mod.rs:300:14
    |
267 | impl<DB: Backend> dyn BoxableConnection<DB> {
    |      --- help: consider adding an explicit lifetime bound...: `DB: 'static +`
...
300 |         self.as_any().is::<T>()
    |              ^^^^^^ ...so that the type `(dyn BoxableConnection<DB> + 'static)` will meet its required lifetime bounds...
    |
note: ...that is required by this bound
   --> /home/runner/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/c1b8ddc/diesel/src/connection/mod.rs:246:62
    |
246 | pub trait BoxableConnection<DB: Backend>: SimpleConnection + std::any::Any {
    |                                                              ^^^^^^^^^^^^^

This might be due to #92285

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions