Skip to content

ICE when a macro with doc (markdown) escape characters is expanded #25929

Closed
@thelink2012

Description

@thelink2012

Sample

macro_rules! buh {
    (
        $(#[$attr:meta])*
        fn bad();
    ) => {
        $(#[$attr])*
        fn bad() {
        }
    }
}

buh! {
    /// \[Not a link\] (details)
    fn bad();
}

Works fine when not used as a attribute to be expanded by the macro system:

`/// \[Not a link\] (details)
fn fine() {
}

#[doc="\\[Not a link\\] (details)"]
fn fine_too() {
}

Meta

rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
binary: rustc
commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e
commit-date: 2015-05-13
build-date: 2015-05-14
host: i686-pc-windows-gnu
release: 1.0.0

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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'lexer should have rejected a bad character escape \[Windows and GTK Only\] (GTK 2.6)', C:/bo
t/slave/stable-dist-rustc-win-32/build/src/libcore\option.rs:330

stack backtrace:
   1: 0x63102988 - rt::unwind::register::ha3686cf8cb60783c3wv
   2: 0x630c56fc - rt::unwind::begin_unwind_inner::h6a42beee3bbc278bduv
   3: 0x630c611f - rt::unwind::begin_unwind_fmt::h2fc1fc2db73eb310Rsv
   4: 0x63102640 - rust_begin_unwind
   5: 0x6311cf28 - panicking::panic_fmt::h52b0d659b0d05042wwy
   6: 0x6a1f6a42 - parse::char_lit::h76da3a3875da6b37cXT
   7: 0x6a1f86d2 - parse::str_lit::h85149c8921a41c28h2T
   8: 0x6a1f59b7 - parse::parser::Parser<'a>::lit_from_token::h68fc0ae22c986b30yQG
   9: 0x6a1fa317 - parse::parser::Parser<'a>::parse_lit::h9f70e38391de0fa2yUG
  10: 0x6a2482b4 - parse::attr::Parser<'a>.ParserAttr::parse_meta_item::h1c98783168c92ce14kT
  11: 0x6a423862 - ext::tt::macro_parser::parse_nt::h25dc8b6a526655dfPZf
  12: 0x6a13ad50 - ext::tt::macro_parser::parse::ha0f605ccc4fd9aa7GJf
  13: 0x6a137b8f - ast::TokenTree::parse::h79e7e0468b7d782bdCl
  14: 0x6a42563a - ext::tt::macro_rules::MacroRulesMacroExpander.TTMacroExpander::expand::h96b4da2fbcd98be3Xeg
  15: 0x6a38044b - ext::expand::expand_item_mac::h6351873f0995efe7tib
  16: 0x6a37030d - ext::expand::expand_item::hf68f0012c3b848a1scb
  17: 0x6a36ccd8 - ext::expand::expand_item::hf68f0012c3b848a1scb
  18: 0x6a379e6f - ext::expand::expand_item::hf68f0012c3b848a1scb
  19: 0x6a379ae6 - ext::expand::expand_item::hf68f0012c3b848a1scb
  20: 0x6a374757 - ext::expand::expand_item::hf68f0012c3b848a1scb
  21: 0x6a3cfc65 - ext::expand::PatIdentRenamer<'a>.Folder::fold_mac::h289ea2cd95f4c5b4CMb
  22: 0x6a3cfacf - ext::expand::PatIdentRenamer<'a>.Folder::fold_mac::h289ea2cd95f4c5b4CMb
  23: 0x6a37173b - ext::expand::expand_item::hf68f0012c3b848a1scb
  24: 0x6a36ccd8 - ext::expand::expand_item::hf68f0012c3b848a1scb
  25: 0x6a379e6f - ext::expand::expand_item::hf68f0012c3b848a1scb
  26: 0x6a379ae6 - ext::expand::expand_item::hf68f0012c3b848a1scb
  27: 0x6a374757 - ext::expand::expand_item::hf68f0012c3b848a1scb
  28: 0x6a3cfc65 - ext::expand::PatIdentRenamer<'a>.Folder::fold_mac::h289ea2cd95f4c5b4CMb
  29: 0x6a3cfacf - ext::expand::PatIdentRenamer<'a>.Folder::fold_mac::h289ea2cd95f4c5b4CMb
  30: 0x6a37173b - ext::expand::expand_item::hf68f0012c3b848a1scb
  31: 0x6a36ccd8 - ext::expand::expand_item::hf68f0012c3b848a1scb
  32: 0x6a379e6f - ext::expand::expand_item::hf68f0012c3b848a1scb
  33: 0x6a379ae6 - ext::expand::expand_item::hf68f0012c3b848a1scb
  34: 0x6a374757 - ext::expand::expand_item::hf68f0012c3b848a1scb
  35: 0x6a3cfc65 - ext::expand::PatIdentRenamer<'a>.Folder::fold_mac::h289ea2cd95f4c5b4CMb
  36: 0x6a3cfacf - ext::expand::PatIdentRenamer<'a>.Folder::fold_mac::h289ea2cd95f4c5b4CMb
  37: 0x6a37173b - ext::expand::expand_item::hf68f0012c3b848a1scb
  38: 0x6a36ccd8 - ext::expand::expand_item::hf68f0012c3b848a1scb
  39: 0x6a3d6f01 - ext::expand::expand_crate::ha0bcd83c140e9790Y9b
  40: 0x6cd67820 - driver::collect_crate_metadata::h5feaa081cce22dd0E1a
  41: 0x6cd13930 - driver::phase_2_configure_and_expand::he8982b2f8dc553f7Wsa
  42: 0x6cd01827 - driver::compile_input::h9a92f42bfe7ee55eQba
  43: 0x6cdd28dd - run_compiler::h698289cbc458c361z4b
  44: 0x6cdd04d5 - run::h9be6406276759ec9f4b
  45: 0x6cdcf9db - run::h9be6406276759ec9f4b
  46: 0x63100e18 - sys::process2::Command::cwd::h292693c1b697cec3Yeu
  47: 0x765b7c04 - BaseThreadInitThunk
  48: 0x76fcad1f - RtlInitializeExceptionChain

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions