Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of spans around macro result parse errors #81608

Merged
merged 1 commit into from
Feb 2, 2021

Commits on Jan 31, 2021

  1. Improve handling of spans around macro result parse errors

    Fixes rust-lang#81543
    
    After we expand a macro, we try to parse the resulting tokens as a AST
    node. This commit makes several improvements to how we handle spans when
    an error occurs:
    
    * Only ovewrite the original `Span` if it's a dummy span. This preserves
      a more-specific span if one is available.
    * Use `self.prev_token` instead of `self.token` when emitting an error
      message after encountering EOF, since an EOF token always has a dummy
      span
    * Make `SourceMap::next_point` leave dummy spans unused. A dummy span
      does not have a logical 'next point', since it's a zero-length span.
      Re-using the span span preserves its 'dummy-ness' for other checks
    Aaron1011 committed Jan 31, 2021
    Configuration menu
    Copy the full SHA
    6c14aad View commit details
    Browse the repository at this point in the history