Skip to content

RFC: Remove inner attributes and inner doc-comments syntax #12341

Closed
@liigo

Description

@liigo

The problem

There is a big pain to distinguish inner- and outer- attributes, the same as doc-comments, for a long time. Two different syntax, make it no clarity and no consistency. Especially, the semicolon in inner-attr is most ambiguous (for newbies). They are many comments in #2569 about this.

The solution

We remove the inner-attributes and inner-doc-comments, and we always use outer ones everywhere. In the past, there was no place to write crate-scope outer-attributes and outer-doc-comments. But now, crate is already a keyword, we can reuse it to define crates (#12107), and place attributes and doc-comments on top of it:

src/libstd/lib.rs:

/// The std library's documents, and attributes, go here
#[crate_type="rlib"]
#[crate_id="std"]
pub crate std;

As a result, inner attributes and doc-comments are not required any more, we can remove them entirely. Perhaps we should keep the //! comment syntax, if most people like it (I do).

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