Skip to content

ICE on wrong macro #51173

Closed
Closed
@llogiq

Description

@llogiq

Repro:

$ rustc ice.rs 
thread 'main' panicked at 'no entry found for key', libcore/option.rs:960:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.28.0-nightly (990d8aa74 2018-05-25) running on x86_64-unknown-linux-gnu

Compiling the following:

// ice.rs
pub trait Letter {
    fn l(self) -> Self;
}

macro_rules! l_impl {
    ($ty: ty, $ex: expr) => {
        impl Letter for $ty {
            #[doc = concat!(
            "```
use std::{env, exor::*, fmt};
let _x : ", stringify!($ty), " = ", stringify!($ex), ";
```")]
                fn l(self) -> Self { self }
            }
    };
}

l_impl!(std::string::FromUtf8Error, String::from_utf8(vec![193u8]).unwrap_err());

fn main() { }

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions