Skip to content

Rust: a block comment opened by "/*/" is not recognised, so its whole body leaks into every code-stream family #9461

Backlog

Description

@squid-protocol

Found by the SOP-002 gap-cell decoy work (protocol SOP-002-v1, epic #8863), batch c (Req A, comment forms).

Rust reference, "Comments": /* opens a block comment and the / of /*/ is ordinary text, so /*/ ... */ is one complete comment (rustc and C/Go lexers agree). Through Prism(...).split_streams() the Rust code stream keeps the whole text and the comment stream is empty, so the body is scanned as code.

Snippets (language rust):

/*/ use std::collections::HashMap; */
/*/ pub(crate) fn helper() {} */
/*/ unsafe { asm!("nop"); } */

Expected: import / encapsulation / inline_asm 0 (all comment text). Actual: 1 each; code_stream == the raw input, comment_stream == "". For comparison c and go blank /*/ ... */ correctly, and ordinary nested /* a /* b */ c */, /** */, /*! */ all work in rust. Likely affects every rust family, not only these three.

Activity

  1. added
    bug
    on Nov 26, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions