rust-lang / rust-lang/rust-analyzer

Reparse fuzz failure (MACRO_CALL)

Open
#5,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-parser S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

original:
SOURCE_FILE@0..25
  FN_DEF@0..25
    FN_KW@0..2 "fn"
    WHITESPACE@2..3 " "
    NAME@3..7
      IDENT@3..7 "main"
    PARAM_LIST@7..9
      L_PAREN@7..8 "("
      R_PAREN@8..9 ")"
    BLOCK_EXPR@9..25
      L_CURLY@9..10 "{"
      WHITESPACE@10..12 "\n\t"
      EXPR_STMT@12..14
        PATH_EXPR@12..14
          PATH@12..14
            PATH_SEGMENT@12..14
              NAME_REF@12..14
                IDENT@12..14 "cn"
      COMMENT@14..19 "/////"
      WHITESPACE@19..21 "\n\n"
      MACRO_CALL@21..23
        PATH@21..22
          PATH_SEGMENT@21..22
            NAME_REF@21..22
              IDENT@21..22 "c"
        BANG@22..23 "!"
      WHITESPACE@23..24 "\n"
      R_CURLY@24..25 "}"
reparsed:
SOURCE_FILE@0..23
  FN_DEF@0..23
    FN_KW@0..2 "fn"
    WHITESPACE@2..3 " "
    NAME@3..7
      IDENT@3..7 "main"
    PARAM_LIST@7..9
      L_PAREN@7..8 "("
      R_PAREN@8..9 ")"
    BLOCK_EXPR@9..23
      L_CURLY@9..10 "{"
      WHITESPACE@10..12 "\n\t"
      EXPR_STMT@12..14
        PATH_EXPR@12..14
          PATH@12..14
            PATH_SEGMENT@12..14
              NAME_REF@12..14
                IDENT@12..14 "cn"
      COMMENT@14..17 "///"
      WHITESPACE@17..19 "\n\n"
      MACRO_CALL@19..21
        PATH@19..20
          PATH_SEGMENT@19..20
            NAME_REF@19..20
              IDENT@19..20 "c"
        BANG@20..21 "!"
      WHITESPACE@21..22 "\n"
      R_CURLY@22..23 "}"
full reparse:
SOURCE_FILE@0..23
  FN_DEF@0..23
    FN_KW@0..2 "fn"
    WHITESPACE@2..3 " "
    NAME@3..7
      IDENT@3..7 "main"
    PARAM_LIST@7..9
      L_PAREN@7..8 "("
      R_PAREN@8..9 ")"
    BLOCK_EXPR@9..23
      L_CURLY@9..10 "{"
      WHITESPACE@10..12 "\n\t"
      EXPR_STMT@12..14
        PATH_EXPR@12..14
          PATH@12..14
            PATH_SEGMENT@12..14
              NAME_REF@12..14
                IDENT@12..14 "cn"
      MACRO_CALL@14..21
        COMMENT@14..17 "///"
        WHITESPACE@17..19 "\n\n"
        PATH@19..20
          PATH_SEGMENT@19..20
            NAME_REF@19..20
              IDENT@19..20 "c"
        BANG@20..21 "!"
      WHITESPACE@21..22 "\n"
      R_CURLY@22..23 "}"
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `"MACRO_CALL@19..21"`,
 right: `"MACRO_CALL@14..21"`: different syntax tree produced by the full reparse'

1.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reparse fuzz failure shown in the issue and inspect the attached 1.zip reproduction. Compare the incremental reparse with the full reparse around the COMMENT and MACRO_CALL nodes; done means both reparses produce the same syntax tree without the assertion panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.