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

'rustc --pretty typed' fails for hello world #4264

Closed
richard-uk1 opened this issue Dec 23, 2012 · 13 comments
Closed

'rustc --pretty typed' fails for hello world #4264

richard-uk1 opened this issue Dec 23, 2012 · 13 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-pretty Area: Pretty printing (including `-Z unpretty`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@richard-uk1
Copy link
Contributor

(edited to update syntax)

Command is

rustc --pretty typed hello.rs

Code is (hello.rs)

/*
 *
 */
fn main() {
    println!("Hello, world");
}

Stack trace(some debugging info but not all)

rust: task failed at 'option::get none', /home/qwerty/Programming/rust/rust-dev/src/librustc/rustc.rc:1
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f81918e94fb]
/usr/local/bin/../lib/librustrt.so(+0x2d0f9)[0x7f81918fd0f9]
/usr/local/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f81918ebcb0]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xa2dcb)[0x7f8193098dcb]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x37b7e)[0x7f819302db7e]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x17a70f)[0x7f8191ca670f]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6driver6driver12compile_upto17_b151657a4240fde03_05E+0x1348)[0x7f81922743e8]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x78280c)[0x7f81922ae80c]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN6driver6driver18pretty_print_input17_76d831c4da689e353_05E+0xb8)[0x7f8192278928]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN12run_compiler17_ddc4abe87a436fd43_05E+0x20a7)[0x7f81922a71d7]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x78280c)[0x7f81922ae80c]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x781523)[0x7f81922ad523]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x78058c)[0x7f81922ac58c]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x7c2af)[0x7f81930722af]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb34e0)[0x7f81930a94e0]
/usr/local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f81918e9d64]
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/qwerty/Programming/rust/rust-dev/src/librustc/rustc.rc:425
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f81918e94fb]
/usr/local/bin/../lib/librustrt.so(+0x2d0f9)[0x7f81918fd0f9]
/usr/local/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f81918ebcb0]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xa2dcb)[0x7f8193098dcb]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x37b7e)[0x7f819302db7e]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb34e0)[0x7f81930a94e0]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN7monitor17_3dc9d53d274031c13_05E+0x29de)[0x7f81922ab54e]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(+0x78280c)[0x7f81922ae80c]
/usr/local/bin/../lib/librustc-c84825241471686d-0.5.so(_ZN4main16_2fb85b4a659c4103_05E+0x86)[0x7f81922ae416]
/usr/local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f81918e9d64]
rust: domain main @0x20ca1f0 root task failed
rust: task failed at 'killed', /home/qwerty/Programming/rust/rust-dev/src/libcore/task/mod.rs:570
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f81918e94fb]
/usr/local/bin/../lib/librustrt.so(+0x2d0f9)[0x7f81918fd0f9]
/usr/local/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f81918ebcb0]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xa2dcb)[0x7f8193098dcb]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x37b7e)[0x7f819302db7e]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(_ZN4task5yield17_56812fae66173efd3_05E+0xbd)[0x7f819305aead]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x91c66)[0x7f8193087c66]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb34e0)[0x7f81930a94e0]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(_ZN7private11weaken_task17_ababfc7d1239606c3_05E+0xd9)[0x7f8193087aa9]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x9199b)[0x7f819308799b]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x8c573)[0x7f8193082573]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0x7c2af)[0x7f81930722af]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.5.so(+0xb34e0)[0x7f81930a94e0]
/usr/local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7f81918e9d64]

Compiler is the latest development version from the repos here.
System is linux x86_64 Ubuntu 12.04
gcc: gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

@richard-uk1
Copy link
Contributor Author

If you want me to do some work to get more debugging info I'm willing to do this.

@passy
Copy link

passy commented Dec 26, 2012

I get the same thing with rustc 0.5.

@catamorphism
Copy link
Contributor

I wouldn't be surprised if ---pretty typed has bitrotted -- no further debugging necessary at this point. Thanks for reporting it!

@graydon
Copy link
Contributor

graydon commented Mar 22, 2013

reproduced on 2013-03-22

@graydon
Copy link
Contributor

graydon commented Mar 22, 2013

non-critical for 0.6, de-milestoning

@catamorphism
Copy link
Contributor

Reproduced with 0252c30 -- nominating for milestone 5, production-ready

@graydon
Copy link
Contributor

graydon commented Aug 1, 2013

just a bug, removing milestone/nomination.

@emberian
Copy link
Member

emberian commented Aug 1, 2013

This still fails, but not with an ICE. It just... doesn't print anything.

@thestinger
Copy link
Contributor

Still fails with fn main() { println!("Hello world") }

@chris-morgan
Copy link
Member

@thestinger that's because of #7754 (new formatting uses fixed-size vectors, which is where the problem really is).

@erickt
Copy link
Contributor

erickt commented May 11, 2014

visiting for triage. Errors with this stack trace:

error: internal compiler error: node_id_to_type: no type for node `expr 1u (id=19)`
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/erickt/rust/rust-master/src/libsyntax/diagnostic.rs:155
stack backtrace:
   1:        0x10bcc75b5 - rt::backtrace::imp::write::hae9e0c8649bd0651E1F::v0.11.pre
   2:        0x10bc346ae - rt::unwind::begin_unwind_inner::hd5684ca19e9518eaIBF::v0.11.pre
   3:        0x10b361af5 - rt::unwind::begin_unwind::h6760631091188135926::v0.11.pre
   4:        0x10b3623ab - diagnostic::Handler::bug::h31b3a7870496b98ae0b::v0.11.pre
   5:        0x108f261d8 - driver::session::Session::bug::hd05ef4561dcdac8a04j::v0.11.pre
   6:        0x108f89788 - middle::ty::node_id_to_type::h99b941bc6d3c3a6eDON::v0.11.pre
   7:        0x109736bc4 - driver::driver::TypedAnnotation.pprust..PpAnn::post::h2a84cad08dcbcd71BMi::v0.11.pre
   8:        0x10b4496dd - print::pprust::State<'a>::print_expr::h60c4507008911968DIO::v0.11.pre
   9:        0x10b433d13 - print::pprust::State<'a>::print_type::he7151521714d862e2nN::v0.11.pre
  10:        0x10b44f053 - print::pprust::State<'a>::print_item::hbcedf05303f0115dkDN::v0.11.pre
  11:        0x10b46753f - print::pprust::State<'a>::print_decl::h5ab70339d2092c31fDP::v0.11.pre
  12:        0x10b44ad11 - print::pprust::State<'a>::print_stmt::hc78e10d0e5992b99XrO::v0.11.pre
  13:        0x10b468fca - print::pprust::State<'a>::print_block_maybe_unclosed::ha0e6c0106ccaf1d5KwO::v0.11.pre
  14:        0x10b4459f4 - print::pprust::State<'a>::print_expr::h60c4507008911968DIO::v0.11.pre
  15:        0x10b44b309 - print::pprust::State<'a>::print_stmt::hc78e10d0e5992b99XrO::v0.11.pre
  16:        0x10b468fca - print::pprust::State<'a>::print_block_maybe_unclosed::ha0e6c0106ccaf1d5KwO::v0.11.pre
  17:        0x10b44de7d - print::pprust::State<'a>::print_item::hbcedf05303f0115dkDN::v0.11.pre
  18:        0x10b42fea8 - print::pprust::State<'a>::print_mod::h641f136b20a8e075MjN::v0.11.pre
  19:        0x10b42f744 - print::pprust::print_crate::h9326c22da146057bAQM::v0.11.pre
  20:        0x109737bdb - driver::driver::pretty_print_input::h0542caccd914e61bmOi::v0.11.pre
  21:        0x1097597c9 - run_compiler::h6db406e36b756e80saq::v0.11.pre
  22:        0x109771d8d - main_args::closure.93972
  23:        0x109770502 - monitor::closure.93850
  24:        0x10976b05b - task::TaskBuilder::try::closure.93616
  25:        0x10b302b6c - task::spawn_opts::closure.7397
  26:        0x10bcbec18 - rt::task::Task::run::closure.28413
  27:        0x10bcdfb7c - rust_try
  28:        0x10bcbea97 - rt::task::Task::run::hf99ca2c1546bbfb0XqD::v0.11.pre
  29:        0x10b3029ef - task::spawn_opts::closure.7369
  30:        0x10bcc5f16 - rt::thread::thread_start::h61d07f070734480188D::v0.11.pre
  31:     0x7fff90436899 - _pthread_body
  32:     0x7fff9043672a - _pthread_struct_init

@lilyball
Copy link
Contributor

As documented in #7754, the problem here is a written type that includes an integral expression. Trivial reproduction case:

fn main() {
    let _: [(), ..1u] = [()];
}

As @chris-morgan mentioned earlier, this is causing a problem with println!() (and anything else that uses format!() machinery internally) because the macro expansion includes a fixed-size vector type.

@huonw
Copy link
Member

huonw commented Sep 10, 2014

Fixed by #15804, landed in #16092.

@huonw huonw closed this as completed Sep 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-pretty Area: Pretty printing (including `-Z unpretty`) 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.

10 participants