Closed
Description
I was using the latest version of quick-error
and tried to store a reference without a lifetime annotated in a macro-generated error. This shouldn't (and doesn't) work, but rustc should at least throw an error instead of blowing up, right?
Code sample:
use quick_error::quick_error;
quick_error! {
pub enum AReferenceInQuickError {
CrashesRustc(s: &str) {
display("hello, {}!", s)
}
}
}
fn main() {
let world = "world";
AReferenceInQuickError::CrashesRustc(world);
}
I expected an error of some sort about lifetimes or macros, but instead, the compiler panic
ed:
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: DistinctSources(DistinctSources { begin: (Real("src/main.rs"), BytePos(0)), end: (Macros("::quick_error::quick_error"), BytePos(7612215)) })', src/librustc_errors/lib.rs:197:29
Meta
This rustc was compiled on Gentoo from a recent master
.
$ rustc --version --verbose
rustc 1.42.0-dev (2cf24ab89 2020-01-21)
binary: rustc
commit-hash: 2cf24ab89123532f0e84995301ee734a88bf4701
commit-date: 2020-01-21
host: x86_64-unknown-linux-gnu
release: 1.42.0-dev
LLVM version: 9.0
Minimal example: https://github.com/milkey-mouse/quick-error-ice
Backtrace: https://github.com/milkey-mouse/quick-error-ice/blob/master/backtrace
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to nightly.