Skip to content

Improve diagnostics regarding how static_in_const doesn't work for associated constants #38831

Closed
@clarfonthey

Description

@clarfonthey

Example code:

#![feature(associated_consts, static_in_const)]
struct Test;
impl Test {
    const CONST: &str = "Hello, world!";
}

Would default CONST to &'static str if this actually worked for associated constants. The original RFC decided to not do this, so, it makes sense to document the behaviour.

EDIT: the error message should be better, not the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions