Skip to content

Recursive static with impl Trait errors out early #59631

Closed
@oli-obk

Description

@oli-obk

The following code should probably work. (cc @Aaron1011)

#![feature(impl_trait_in_bindings)]
static FOO: impl Copy = &FOO;

fn main() {
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error: non-defining existential type use in defining scope
 --> src/main.rs:2:25
  |
2 | static FOO: impl Copy = &FOO;
  |                         ^^^^ lifetime `'<empty>` is part of concrete type but not used in parameter list of existential type

error: aborting due to previous error

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.F-impl_trait_in_bindings`#![feature(impl_trait_in_bindings)]`requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions