Skip to content

macro referencing unbound syntax variable causes ICE #4040

Closed
@rntz

Description

@rntz
macro_rules! foo( () => ($s) )

fn main() { foo!(); }

The above program is of course invalid, but instead of giving an error message it produces an ICE:

RUST_LOG=rustc=1,::rt::backtrace make bugs/macro_ice
rustc -g -L . bugs/macro_ice.rs
rust: task failed at 'Key not found in table: { repr: 36 }', /home/rntz/s/rust/src/libsyntax/syntax.rc:1
/home/rntz/p/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f784e543deb]
/home/rntz/p/bin/../lib/librustrt.so(+0x2e559)[0x7f784e557559]
/home/rntz/p/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f784e5465a0]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1ac6df)[0x7f784f4126df]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1ef365)[0x7f784f455365]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN3ext2tt10transcribe13tt_next_token16_ab8a1099a48b1893_05E+0xc7f)[0x7f784f34db6f]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN5parse6parser6Parser16_e77dbaaf1ebfd603_05E+0x6c)[0x7f784f3529fc]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1f80ab)[0x7f784f45e0ab]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1f8df1)[0x7f784f45edf1]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN3ext6expand11expand_expr17_ede5d8d64ebfc12b3_05E+0xbb1)[0x7f784f414e01]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1b3695)[0x7f784f419695]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_144359fold_expr17_cbc07ddfc4e937bf3_05E+0xd1)[0x7f784f33f261]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0xc2de8)[0x7f784f328de8]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0xd3aaf)[0x7f784f339aaf]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_144239fold_stmt17_3dea617f49874e6b3_05E+0xab)[0x7f784f33ec1b]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0xb8aaf)[0x7f784f31eaaf]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold15noop_fold_block16_e6850c3fde8da7b3_05E+0xe0)[0x7f784f328a30]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0xd36df)[0x7f784f3396df]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_1442010fold_block17_c5bffc3c53d7f2f43_05E+0xae)[0x7f784f33ea8e]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold25noop_fold_item_underscore17_1dbd3245579f405a3_05E+0x17d)[0x7f784f32387d]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_1441420fold_item_underscore17_efac33445786909b3_05E+0x9a)[0x7f784f33e8ba]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14noop_fold_item15_123c3f99bc33673_05E+0x16b)[0x7f784f322c2b]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN3ext6expand11expand_item16_618e6d7fe75df9a3_05E+0xde)[0x7f784f4179be]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1b398f)[0x7f784f41998f]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_144089fold_item17_37728de3d8ef43bc3_05E+0x94)[0x7f784f33e664]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x5803f)[0x7f784f2be03f]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold13noop_fold_mod17_4fdd1bdeda5154ab3_05E+0xd7)[0x7f784f331e17]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN3ext6expand16expand_mod_items16_cf47d56026d55923_05E+0x57)[0x7f784f416d67]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x1b3930)[0x7f784f419930]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_144418fold_mod17_c5c72698951df1563_05E+0x9a)[0x7f784f33f66a]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold15noop_fold_crate17_d2d7c269352de7123_05E+0x14d)[0x7f784f32084d]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0x256c48)[0x7f784f4bcc48]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(+0xd2f3f)[0x7f784f338f3f]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN4fold14__extensions__10meth_1424010fold_crate17_a54e731d82d8d3f73_05E+0xa2)[0x7f784f33b5c2]
/home/rntz/p/bin/../lib/libsyntax-84efebcb12c867a2-0.5.so(_ZN3ext6expand12expand_crate16_eade0bc79a3dca03_05E+0x7fa)[0x7f784f41913a]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(+0x6b41d6)[0x7f784ee3a1d6]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6driver6driver12compile_upto17_13cb5b26b5401eda3_05E+0x50b)[0x7f784ee371cb]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(+0x6eba9c)[0x7f784ee71a9c]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6driver6driver13compile_input17_7a36ff8da44c8e283_05E+0xbb)[0x7f784ee3b55b]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN12run_compiler16_b79619bee9344a03_05E+0x268a)[0x7f784ee6b6ea]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(+0x6eba9c)[0x7f784ee71a9c]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(+0x6ea7c3)[0x7f784ee707c3]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(+0x6e981c)[0x7f784ee6f81c]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x7a31f)[0x7f784fc0831f]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb7240)[0x7f784fc45240]
/home/rntz/p/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f784e544654]
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /home/rntz/s/rust/src/librustc/rustc.rs:233
/home/rntz/p/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f784e543deb]
/home/rntz/p/bin/../lib/librustrt.so(+0x2e559)[0x7f784e557559]
/home/rntz/p/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f784e5465a0]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb7240)[0x7f784fc45240]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN7monitor16_827d3dbfcc5295a3_05E+0x2a9c)[0x7f784ee6e85c]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(+0x6eba9c)[0x7f784ee71a9c]
/home/rntz/p/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN4main16_2fb85b4a659c4103_05E+0x86)[0x7f784ee716a6]
/home/rntz/p/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f784e544654]
rust: domain main @0x11ad200 root task failed
rust: task failed at 'killed', /home/rntz/s/rust/src/libcore/task.rs:615
/home/rntz/p/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f784e543deb]
/home/rntz/p/bin/../lib/librustrt.so(+0x2e559)[0x7f784e557559]
/home/rntz/p/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f784e5465a0]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(_ZN4task5yield17_56812fae66173efd3_05E+0xbd)[0x7f784fbf120d]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x91f36)[0x7f784fc1ff36]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(_ZN7private11weaken_task17_8d55bbcf2be9175d3_05E+0xd9)[0x7f784fc1fd79]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x91c6b)[0x7f784fc1fc6b]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb7240)[0x7f784fc45240]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x90f72)[0x7f784fc1ef72]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x908c2)[0x7f784fc1e8c2]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x8fed6)[0x7f784fc1ded6]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x7a31f)[0x7f784fc0831f]
/home/rntz/p/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb7240)[0x7f784fc45240]
/home/rntz/p/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f784e544654]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsI-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