Skip to content

opening curly braces inside a syntax extension, when missing, lead to weird errors #15266

Closed
@killerswan

Description

@killerswan

From here: https://github.com/killerswan/ovid/blob/ad2efdabb2eb834ca7a50cbda5806ccd033d6283/CSVProvider.rs

This change...

ovid $ git diff
diff --git a/CSVProvider.rs b/CSVProvider.rs
index 4fa650f..ca207ad 100644
--- a/CSVProvider.rs
+++ b/CSVProvider.rs
@@ -169,7 +169,7 @@ fn provide_csv_given_labels(cx: &mut ExtCtxt, sp: Span, tts: &[TokenT

    let item2: Option<Gc<syntax::ast::Item>>  = quote_item!(cx,
       impl MyCSV {
-         pub fn new() -> MyCSV {  // BUG: note removing the { leads to goofy error messs
+         pub fn new() -> MyCSV
             println!("HMMMMMM.");
             return MyCSV {
                data: (vec!["zero".to_string(), "one".to_string(), "two".to_string()]),

...leads to this error pointing to the wrong place:

ovid $ ./build.sh 
CSVProvider.rs:170:59: 170:60 note: unclosed delimiter
CSVProvider.rs:170    let item2: Option<Gc<syntax::ast::Item>>  = quote_item!(cx,
                                                                             ^
CSVProvider.rs:178:7: 178:8 error: incorrect close delimiter: `}`
CSVProvider.rs:178       }

I believe from an earlier revision, @brson and I saw an even weirder location for the error, but even this is wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions