Skip to content

feature(frontmatter) rejects frontmatters with dashes with leading spaces #141367

Description

@epage

tests/ui/frontmatter/multifrontmatter-2.rs:

---
 ---
//~^ ERROR: invalid preceding whitespace for frontmatter close

 ---
//~^ ERROR: expected item, found `-`
// FIXME(frontmatter): make this diagnostic better
---

#![feature(frontmatter)]

fn main() {}

I expected to see this happen: this should be a //@ check-pass

Instead, this happened: this is an ERROR

Meta

As of #140035 (I had missed this test in the review)

The RFC text says:

All content is ignored by rustc until the same number of dashes is found at the start of a line. The line must terminate by 0+ whitespace and then a newline.

So a line with spaces before a --- should not require escapaing (more - on open/close) but should work just fine.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.F-frontmatter`#![feature(frontmatter)]`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