Skip to content

Regression in error message when a custom derive panics #47812

Closed
@dtolnay

Description

@dtolnay

Between nightly-2018-01-26 and nightly-2018-01-27 the error message for a custom derive panic got worse. This is the range 9fd7da9...bacb5c5. Mentioning @Zoxc because #47634 sounds relevant.

src/main.rs
#[macro_use]
extern crate repro;

#[derive(Panic)]
struct S;

fn main() {}
src/lib.rs
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_derive(Panic)]
pub fn f(_input: TokenStream) -> TokenStream {
    panic!("no can do");
}

Before:

error: proc-macro derive panicked
 --> src/main.rs:4:10
  |
4 | #[derive(Panic)]
  |          ^^^^^
  |
  = help: message: no can do

After:

thread 'rustc' panicked at 'no can do', src/lib.rs:57:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: proc-macro derive panicked
 --> src/main.rs:4:10
  |
4 | #[derive(Panic)]
  |          ^^^^^
  |
  = help: message: no can do

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions