Skip to content

Inner and outer docs/comments were swapped #112

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2017

Conversation

brauliobz
Copy link
Contributor

No description provided.

@steveklabnik
Copy link
Member

Hm, I think it works both ways: that is, //! is "outer" because it's attached to the enclosing thing, and /// is "inner" because it is attached to the next thing.

@brauliobz
Copy link
Contributor Author

brauliobz commented Sep 5, 2017

It's really confusing... but the adjective refers to the attribute, not to the item the attribute applies to. From the parser:

    /// Parse attributes that appear before an item
    pub fn parse_outer_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
    pub fn parse_inner_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
        ...
        // Don't even try to parse if it's not an inner attribute.
        if !self.look_ahead(1, |t| t == &token::Not) {

@Havvy Havvy merged commit 768cb76 into rust-lang:master Sep 24, 2017
@Havvy
Copy link
Contributor

Havvy commented Sep 24, 2017

I don't think the naming in the reference is canonical, but probably best to follow what rustc does.

💟 Thanks

@brauliobz brauliobz deleted the grammar_comments branch September 25, 2017 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants