Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: cat_expr Errd from array of unconstrained type -- { []; } #22897

Closed
rprichard opened this issue Feb 28, 2015 · 2 comments · Fixed by #24367
Closed

ICE: cat_expr Errd from array of unconstrained type -- { []; } #22897

rprichard opened this issue Feb 28, 2015 · 2 comments · Fixed by #24367
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@rprichard
Copy link
Contributor

Test case:

fn main() { []; }

Output:

$ RUST_BACKTRACE=1 rustc test.rs 
test.rs:1:13: 1:15 error: internal compiler error: cat_expr Errd
test.rs:1 fn main() { []; }
                      ^~
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 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:129

stack backtrace:
   1:         0xcc029720 - sys::backtrace::write::h66f3f2784d0f6c5ddgA
   2:         0xcc051b80 - panicking::on_panic::h6fdde9e4e9166fe6jaJ
   3:         0xcbf91c30 - rt::unwind::begin_unwind_inner::hba10c536ef2aae75MQI
   4:         0xc92a10c0 - rt::unwind::begin_unwind::h11287547919384241778
   5:         0xc92a1050 - diagnostic::SpanHandler::span_bug::h551f703868554ecfUBD
   6:         0xc9e32fe0 - session::Session::span_bug::h10f6b5fdbea6485fbjp
   7:         0xcb6c5920 - check::regionck::visit_expr::hc78138689559ecf8Yrd
   8:         0xcb6c35c0 - check::regionck::Rcx<'a, 'tcx>::visit_fn_body::h75e2fac33dc50b43a4c
   9:         0xcb75ee50 - check::check_bare_fn::hf42e5aabaa5cb880Oan
  10:         0xcb756f40 - check::check_item::hdbe569c101f96905stn
  11:         0xcb822f10 - check_crate::closure.36015
  12:         0xcb81d9c0 - check_crate::h9d44bf3fde687089EXB
  13:         0xcc6a38c0 - driver::phase_3_run_analysis_passes::h36c633d41f11ca74wFa
  14:         0xcc689ec0 - driver::compile_input::h0de317319ab5c701Hba
  15:         0xcc754e20 - run_compiler::hffa0c0711e361de8E5b
  16:         0xcc753720 - thunk::F.Invoke<A, R>::invoke::h12673221910893163557
  17:         0xcc752610 - rt::unwind::try::try_fn::h15130568597725528481
  18:         0xcc0bd740 - rust_try_inner
  19:         0xcc0bd730 - rust_try
  20:         0xcc752910 - thunk::F.Invoke<A, R>::invoke::h3924406537784056782
  21:         0xcc03d990 - sys::thread::thread_start::h3734be2229bd3edegEE
  22:         0xc5f650c0 - start_thread
  23:         0xcbc0a449 - __clone
  24:                0x0 - <unknown>

Compiler version:

rustc 1.0.0-nightly (b47aebe3f 2015-02-26) (built 2015-02-27)
binary: rustc
commit-hash: b47aebe3fc2da06c760fd8ea19f84cbc41d34831
commit-date: 2015-02-26
build-date: 2015-02-27
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

I modified the test case in #22894 by moving the &*"" into fn main(), and I saw the same ICE. I then changed the "" to the similar &[], and I saw an ICE with a different error message and a different stack trace (e.g. phase 3 instead of phase 4). The & and * are unnecessary.

I also see the cat_expr Errd message in #22037, but there are differences -- this issue happens in phase 3 rather than 4, and there is no "fictitious type" message.

@rprichard rprichard changed the title ICE: cat_expr Errd from array of unspecified type -- { []; } ICE: cat_expr Errd from array of unconstrained type -- { []; } Feb 28, 2015
@kmcallister kmcallister added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 1, 2015
@gkoz
Copy link
Contributor

gkoz commented Mar 14, 2015

This seems to trigger the same bug:

fn main() { 0 as *mut _; }

@seppo0010
Copy link
Contributor

I think I ran into the same problem running similar code

pub fn hello(mystr: &str) -> &[str] {
    &[];
}

pub fn main() {
}

Compiler output

$ RUST_BACKTRACE=1 rustc ./test.rs
./test.rs:2:5: 2:8 error: internal compiler error: cat_expr Errd
./test.rs:2     &[];
                ^~~
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 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:130

stack backtrace:
   1:        0x1106d3f77 - sys::backtrace::write::h799ab135045ca9ca1LC
   2:        0x110701e4d - panicking::on_panic::h9502e488a92fc8bcHAI
   3:        0x1106262de - rt::unwind::begin_unwind_inner::hf0537788ee16eadbiiI
   4:        0x10fdf85ae - rt::unwind::begin_unwind::h447731439410619827
   5:        0x10fdf855b - diagnostic::SpanHandler::span_bug::h3f51c1d819f22bcfjnB
   6:        0x10d5631ac - session::Session::span_bug::h460cdb4f2d9be26b5Xq
   7:        0x10cc93991 - check::regionck::visit_expr::h5f402212d9d0fff7PJd
   8:        0x10cc8e2e3 - check::regionck::Rcx<'a, 'tcx>::visit_fn_body::h9e50b5f998fa9b18amd
   9:        0x10cd2c76c - check::check_bare_fn::h05c77be534ada2cfUQn
  10:        0x10cd25ee2 - check::check_item::h9d89bedf29e4fe82F9n
  11:        0x10ce02676 - check_crate::closure.36302
  12:        0x10cdfcae7 - check_crate::h09aa7856a322fd44bwC
  13:        0x10cb1b355 - driver::phase_3_run_analysis_passes::h1af60e7c926ca39dgGa
  14:        0x10caffa85 - driver::compile_input::h27cf4320fd56e5cbQba
  15:        0x10cbbda15 - run_compiler::h93c68a2a3c26052bV4b
  16:        0x10cbbb1e2 - boxed::F.FnBox<A>::call_box::h4498816167135712709
  17:        0x10cbba6d7 - rt::unwind::try::try_fn::h2387014819904265058
  18:        0x11078bea8 - rust_try_inner
  19:        0x11078be95 - rust_try
  20:        0x10cbba9ca - boxed::F.FnBox<A>::call_box::h4850138824497903476
  21:        0x1106eb37d - sys::thread::create::thread_start::h42d6d904fce5365aihH
  22:     0x7fff97b50267 - _pthread_body
  23:     0x7fff97b501e4 - _pthread_start

version

$ rustc --version --verbose
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-apple-darwin
release: 1.0.0-beta

ebfull added a commit to ebfull/rust that referenced this issue Apr 13, 2015
An actual typeck error is the cause of many failed compilations but an
unrelated bug is being reported instead. It is triggered because a typeck
error is presumably not yet identified during compiler execution, which
would normally bypass an invariant in the presence of other errors. In
this particular situation, we delay the reporting of the bug until
abort_if_errors().

Closes rust-lang#23827, closes rust-lang#24356, closes rust-lang#23041, closes rust-lang#22897, closes rust-lang#23966,
closes rust-lang#24013, and closes rust-lang#23729
@ghost ghost mentioned this issue Apr 18, 2015
bors added a commit that referenced this issue Apr 26, 2015
An actual typeck error is the cause of many failed compilations but an
unrelated bug is being reported instead. It is triggered because a typeck
error is presumably not yet identified during compiler execution, which
would normally bypass an invariant in the presence of other errors. In
this particular situation, we delay the reporting of the bug until
abort_if_errors().

Closes #23827, closes #24356, closes #23041, closes #22897, closes #23966,
closes #24013, and closes #23729

**There is at least one situation where this bug may still be genuinely
triggered (#23437).**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants