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

Propagate macro backtraces more often, improve formatting diagnostics #24003

Merged
merged 5 commits into from
Apr 12, 2015

Commits on Apr 11, 2015

  1. Propagate macro backtraces more often, improve formatting diagnostics

     * In noop_fold_expr, call new_span in these cases:
        - ExprMethodCall's identifier
        - ExprField's identifier
        - ExprTupField's integer
    
       Calling new_span for ExprMethodCall's identifier is necessary to print
       an acceptable diagnostic for write!(&2, ""). We see this error:
    
           <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt`
           <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) )
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       With this change, we also see a macro expansion backtrace leading to
       the write!(&2, "") call site.
    
     * After fully expanding a macro, we replace the expansion expression's
       span with the original span. Call fld.new_span to add a backtrace to
       this span. (Note that I'm call new_span after bt.pop(), so the macro
       just expanded isn't on the backtrace.)
    
       The motivating example for this change is println!("{}"). The format
       string literal is concat!($fmt, "arg") and is inside the libstd macro.
       We need to see the backtrace to find the println! call site.
    
     * Add a backtrace to the format_args! format expression span.
    
    Addresses rust-lang#23459
    rprichard committed Apr 11, 2015
    Configuration menu
    Copy the full SHA
    0f46e4f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a893c64 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5a8f102 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fab3295 View commit details
    Browse the repository at this point in the history
  5. Remove the vestigial ExtCtxt::print_backtrace function.

    It was added in 2011-08-05 and reduced to a no-op ten days later.
    rprichard committed Apr 11, 2015
    Configuration menu
    Copy the full SHA
    ddbdf51 View commit details
    Browse the repository at this point in the history