]> git.lizzy.rs Git - rust.git/commit
Improve doc comment desugaring.
authorNicholas Nethercote <n.nethercote@gmail.com>
Tue, 31 Jan 2023 23:53:00 +0000 (10:53 +1100)
committerNicholas Nethercote <n.nethercote@gmail.com>
Thu, 2 Feb 2023 23:06:52 +0000 (10:06 +1100)
commitaf1d16e82ddc27166438e8bc2a520087862f12af
tree09ecefef955ad55a2b81a0dc604d0e79a0c0968e
parent97872b792c9dd6a9bc5c3f4e62a0bd5958b09cdc
Improve doc comment desugaring.

Sometimes the parser needs to desugar a doc comment into `#[doc =
r"foo"]`. Currently it does this in a hacky way: by pushing a "fake" new
frame (one without a delimiter) onto the `TokenCursor` stack.

This commit changes things so that the token stream itself is modified
in place. The nice thing about this is that it means
`TokenCursorFrame::delim_sp` is now only `None` for the outermost frame.
compiler/rustc_ast/src/tokenstream.rs
compiler/rustc_parse/src/parser/mod.rs