Skip to content

Constants should not require 'static bound for their typeparams #33573

New issue

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

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

Already on GitHub? # to your account

Closed
nagisa opened this issue May 11, 2016 · 0 comments
Closed

Constants should not require 'static bound for their typeparams #33573

nagisa opened this issue May 11, 2016 · 0 comments
Labels
A-associated-items Area: Associated items (types, constants & functions)

Comments

@nagisa
Copy link
Member

nagisa commented May 11, 2016

Code like

trait Lattice {
    const BOTTOM: Self;
}

impl<T> Lattice for Option<T> {
    const BOTTOM: Option<T> = None;
}

fails to compile (after #33572) despite being “just” all-right because compiler demands for a 'static lifetime on T, which is completely unnecessary (constants are instantiated inline).

Expected results: should compile.

@nagisa nagisa changed the title Constants should not require 'static bount for their typeparams Constants should not require 'static bound for their typeparams May 12, 2016
@nagisa nagisa added the A-associated-items Area: Associated items (types, constants & functions) label May 16, 2016
bors added a commit that referenced this issue May 22, 2017
…-const-ty-refs, r=eddyb

Remove 'static bound in assoc const test.

Types do not have to be `'static` to be referenced in
associated consts.

Fixes #33573.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-associated-items Area: Associated items (types, constants & functions)
Projects
None yet
Development

No branches or pull requests

1 participant