Skip to content

Support doc comments and attributes on nested items #6932

Closed
@ironcev

Description

@ironcev

E.g., while this compiles:

library;

fn fun() {
    struct S {
        field: u8,
    }

    const CONST: u8 = 0;
}

trying to attribute or comment nested items will result in "Expected an expression." error on every doc comment or attribute:

library;

fn fun() {
    /// Comment.             // <<<--- ERROR: Expected an expression.
    #[allow(dead_code)]      // <<<--- ERROR: Expected an expression.
    struct S {
        /// Comment.         // <<<--- ERROR: Expected an expression.
        #[allow(dead_code)]  // <<<--- ERROR: Expected an expression.
        field: u8,
    }

    /// Comment.             // <<<--- ERROR: Expected an expression.
    #[allow(dead_code)]      // <<<--- ERROR: Expected an expression.
    const CONST: u8 = 0;
}

Metadata

Metadata

Assignees

Labels

ODHack12ODHack13P: lowcompilerGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgencompiler: parserEverything to do with the parsergood first issueGood for newcomersmay be rewardedteam:compilerCompiler Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions