rust-lang / rust-lang/rust-analyzer

Reparse fuzz failure (CONST_DEF)

Open
#5,400 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..39
  FN_DEF@0..39
    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..39
      L_CURLY@9..10 "{"
      WHITESPACE@10..12 "\n\t"
      EXPR_STMT@12..15
        PATH_EXPR@12..15
          PATH@12..15
            PATH_SEGMENT@12..15
              NAME_REF@12..15
                IDENT@12..15 "csn"
      COMMENT@15..20 "/////"
      WHITESPACE@20..22 "\n\n"
      CONST_DEF@22..36
        CONST_KW@22..27 "const"
        COMMENT@27..31 "///o"
        WHITESPACE@31..33 "\n\u{b}"
        NAME@33..34
          IDENT@33..34 "Y"
        WHITESPACE@34..35 "\u{b}"
        NEVER_TYPE@35..36
          BANG@35..36 "!"
      LITERAL@36..37
        INT_NUMBER@36..37 "0"
      WHITESPACE@37..38 "\n"
      R_CURLY@38..39 "}"
reparsed:
SOURCE_FILE@0..37
  FN_DEF@0..37
    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..37
      L_CURLY@9..10 "{"
      WHITESPACE@10..12 "\n\t"
      EXPR_STMT@12..15
        PATH_EXPR@12..15
          PATH@12..15
            PATH_SEGMENT@12..15
              NAME_REF@12..15
                IDENT@12..15 "csn"
      COMMENT@15..18 "///"
      WHITESPACE@18..20 "\n\n"
      CONST_DEF@20..34
        CONST_KW@20..25 "const"
        COMMENT@25..29 "///o"
        WHITESPACE@29..31 "\n\u{b}"
        NAME@31..32
          IDENT@31..32 "Y"
        WHITESPACE@32..33 "\u{b}"
        NEVER_TYPE@33..34
          BANG@33..34 "!"
      LITERAL@34..35
        INT_NUMBER@34..35 "0"
      WHITESPACE@35..36 "\n"
      R_CURLY@36..37 "}"
full reparse:
SOURCE_FILE@0..37
  FN_DEF@0..37
    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..37
      L_CURLY@9..10 "{"
      WHITESPACE@10..12 "\n\t"
      EXPR_STMT@12..15
        PATH_EXPR@12..15
          PATH@12..15
            PATH_SEGMENT@12..15
              NAME_REF@12..15
                IDENT@12..15 "csn"
      CONST_DEF@15..34
        COMMENT@15..18 "///"
        WHITESPACE@18..20 "\n\n"
        CONST_KW@20..25 "const"
        COMMENT@25..29 "///o"
        WHITESPACE@29..31 "\n\u{b}"
        NAME@31..32
          IDENT@31..32 "Y"
        WHITESPACE@32..33 "\u{b}"
        NEVER_TYPE@33..34
          BANG@33..34 "!"
      LITERAL@34..35
        INT_NUMBER@34..35 "0"
      WHITESPACE@35..36 "\n"
      R_CURLY@36..37 "}"
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `"CONST_DEF@20..34"`,
 right: `"CONST_DEF@15..34"`: different syntax tree produced by the full reparse'

2.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 by reproducing the reparse failure from the attached 2.zip and compare the original, reparsed, and full-reparse trees shown in the report. Trace the parser path handling the CONST_DEF and preceding comment; done means the reparse no longer panics and produces the same syntax tree as a full reparse.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.