Skip to content

Preserve spans when splicing into quotes #15146

@kmcallister

Description

@kmcallister

This expression is parsed by my macro directly from the source file. But the span information is lost, resulting in unhelpful error messages:

<quote expansion>:1:27: 1:32 error: use of partially moved value: `token`
<quote expansion>:1 self.step(states::InHead, token)
                                              ^~~~~
/home/keegan/proj/servo/html5/src/lib.rs:10:1: 40:21 note: in expansion of match_token!
/home/keegan/proj/servo/html5/src/tree_builder/mod.rs:361:39: 395:16 note: expansion site
<quote expansion>:1:29: 1:33 note: `token#1` moved here because it has type `collections::string::String`, which is moved by default (use `ref` to override)
<quote expansion>:1 CharacterTokens(Whitespace, text)

Fixing this should probably be part of a larger refactor to do splicing in a way other than by generating strings and re-parsing them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions