Skip to content

Associated consts cannot elide `'static #41792

Closed
@withoutboats

Description

@withoutboats
#![feature(associated_consts)]

trait Foo {
    const X: &str;
}

impl Foo for () {
    const X: &str = "";
}

fn main() {}

https://play.rust-lang.org/?gist=84bbc056b2289ed71e169e8a4b9236df&version=nightly&backtrace=0

rustc 1.19.0-nightly (f4209651e 2017-05-05)
error[E0106]: missing lifetime specifier
 --> <anon>:4:14
  |
4 |     const X: &str;
  |              ^ expected lifetime parameter

error[E0106]: missing lifetime specifier
 --> <anon>:8:14
  |
8 |     const X: &str = "";
  |              ^ expected lifetime parameter

@eddyb

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