Skip to content

stmt_expr_attributes attempts to parse a simple doc-comment #98063

Open
@ckiee

Description

@ckiee

I added the /// XXX: Compile comment to this code: (inside a match)

        AstNode::Heading {
            children,
            level,
            title,
            routing, // TODO use this to link?
        } => format!(
            "<h{level} {id}>{title}</h{level}>{children}",
            level = level,
            title = bet_to_html_string(title)?,
            /// XXX: Compile
            // children = ast_to_html_string(&children, rg.clone())?,
            children = "TODO".to_string(),
            id = match routing {
                Some(route) => "TODO".to_string(),
                None => "".to_string(),
            }
        ),

I expected to see get better diagnostics now that one more build issue is out of the way, but instead it tried to parse the doc-comment for some reason, and failed:

error[E0658]: attributes on expressions are experimental
  --> orgish/src/treewalk/mod.rs:41:13
   |
41 |             /// XXX: Compile
   |             ^^^^^^^^^^^^^^^^
   |
   = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
   = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

Is this intended? Can someone from #15701 weigh in? Is it a regression?

Meta

rustc --version --verbose:

ckie@cookiemonster ~ -> rustc --version --verbose
rustc 1.62.0-nightly (4c60a0ea5 2022-05-04)
binary: rustc
commit-hash: 4c60a0ea5b2385d7400df9db1ad04e96f2a4c154
commit-date: 2022-05-04
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-fmtArea: `core::fmt`A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.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