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

Add -Z span-debug to allow for easier debugging of proc macros #72799

Merged
merged 1 commit into from
Jun 8, 2020

Commits on Jun 4, 2020

  1. Add -Z span-debug to allow for easier debugging of proc macros

    Currently, the `Debug` impl for `proc_macro::Span` just prints out
    the byte range. This can make debugging proc macros (either as a crate
    author or as a compiler developer) very frustrating, since neither the
    actual filename nor the `SyntaxContext` is displayed.
    
    This commit adds a perma-unstable flag `-Z span-debug`. When enabled,
    the `Debug` impl for `proc_macro::Span` simply forwards directly to
    `rustc_span::Span`. Once rust-lang#72618 is merged, this will start displaying
    actual line numbers.
    
    While `Debug` impls are not subject to Rust's normal stability
    guarnatees, we probably shouldn't expose any additional information on
    stable until `#![feature(proc_macro_span)]` is stabilized. Otherwise,
    we would be providing a 'backdoor' way to access information that's
    supposed be behind unstable APIs.
    Aaron1011 committed Jun 4, 2020
    Configuration menu
    Copy the full SHA
    b541d3d View commit details
    Browse the repository at this point in the history