Skip to content

ICE trying to borrow invalid borrowed-pointer subscript #4855

Closed
@ben0x539

Description

@ben0x539

This ICEs with 'ty_region() invoked on in appropriate ty: ty_bot' from librustc/middle/ty.rs:2860

fn f() {
    &(&())[0];
}

Full output from RUST_LOG=rustc=1,::rt::backtrace rustc foo.rs:

foo.rs:2:5: 2:12 error: cannot index a value of type `()`
foo.rs:2     &(&())[0];
              ^~~~~~~
rust: task failed at 'ty_region() invoked on in appropriate ty: ty_bot', <core-macros>:15
/home/ben/local/lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f27e98df45b]
/home/ben/local/lib/librustrt.so(+0x2a319)[0x7f27e98f0319]
/home/ben/local/lib/librustrt.so(upcall_fail+0x180)[0x7f27e98e1260]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0xede2b)[0x7f27eb2e9e2b]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0xeddd2)[0x7f27eb2e9dd2]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(_ZN3sys12begin_unwind17_7cd364c41f10422f3_06E+0x71)[0x7f27eb23f7c1]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle2ty9ty_region16_ec2ac5e61988ff53_06E+0x3a3)[0x7f27e9e800f3]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x447da7)[0x7f27e9f65da7]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check8regionck9guarantor11for_addr_of16_865e35391e563703_06E+0x1b8)[0x7f27e9f63bf8]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check8regionck10visit_expr15_ffa67acb0e7eb83_06E+0x3c2)[0x7f27e9f61ea2]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x2008fd)[0x7f27e9d1e8fd]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x1f36da)[0x7f27e9d116da]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check8regionck11regionck_fn17_c357d3bfb73ebbe63_06E+0x84)[0x7f27e9f5e264]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check8check_fn17_fa3ed2169ed2cb4e3_06E+0x27fb)[0x7f27e9f85f6b]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check13check_bare_fn17_f976929db7b153b03_06E+0x109)[0x7f27e9f83659]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check10check_item17_3d814abd76fd2c443_06E+0x302)[0x7f27e9f81f12]
/home/ben/local/lib/libsyntax-84efebcb12c867a2-0.6.so(+0xc4295)[0x7f27ea88d295]
/home/ben/local/lib/libsyntax-84efebcb12c867a2-0.6.so(+0xc3ef4)[0x7f27ea88cef4]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck5check16check_item_types17_d9a38036e15a3aa13_06E+0x437)[0x7f27e9f81997]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6middle6typeck11check_crate17_9af8cefe15f38e113_06E+0x15d)[0x7f27ea0b9d9d]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x83f634)[0x7f27ea35d634]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6driver6driver12compile_upto17_9cca91efebe42f243_06E+0x14a9)[0x7f27ea31c449]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x83f634)[0x7f27ea35d634]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN6driver6driver13compile_input16_bc3c374899a11ac3_06E+0xb9)[0x7f27ea320f09]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN12run_compiler17_269863f0a1b14e743_06E+0x2308)[0x7f27ea34c118]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x83c6e6)[0x7f27ea35a6e6]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x83909c)[0x7f27ea35709c]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x83f634)[0x7f27ea35d634]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0xbf5b4)[0x7f27eb2bb5b4]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0x11c390)[0x7f27eb318390]
/home/ben/local/lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f27e98dfcc4]
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', <core-macros>:15
/home/ben/local/lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f27e98df45b]
/home/ben/local/lib/librustrt.so(+0x2a319)[0x7f27e98f0319]
/home/ben/local/lib/librustrt.so(upcall_fail+0x180)[0x7f27e98e1260]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0xede2b)[0x7f27eb2e9e2b]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0xeddd2)[0x7f27eb2e9dd2]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(_ZN3sys12begin_unwind17_7cd364c41f10422f3_06E+0x71)[0x7f27eb23f7c1]
/home/ben/local/lib/libcore-c3ca5d77d81b46c1-0.6.so(+0x11c390)[0x7f27eb318390]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN7monitor17_7f512e86f4d8c0183_06E+0x288b)[0x7f27ea34f29b]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(+0x83f634)[0x7f27ea35d634]
/home/ben/local/lib/librustc-c84825241471686d-0.6.so(_ZN4main16_706f4ee7413ae583_06E+0x7e)[0x7f27ea35d21e]
/home/ben/local/lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f27e98dfcc4]
rust: domain main @0xf733b0 root task failed

Sorry for making the poor compiler throw up with my bad code. :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions