Skip to content

Panic when compiling invalid rust code #55491

Closed
@scampi

Description

@scampi

I ran cargo build on the code below which I had forgotten was incomplete and got a panic.
I would expect to have some parse error instead.

Versions

$ rustc --version --verbose
rustc 1.31.0-nightly (96064eb61 2018-10-28)
binary: rustc
commit-hash: 96064eb61dc703c289fae61bdf90593d3e7b2449
commit-date: 2018-10-28
host: x86_64-unknown-linux-gnu
release: 1.31.0-nightly
LLVM version: 8.0

Code

extern crate hyper;

use hyper::rt::{self, Future, Stream};
use hyper::Client;
use std::io::{self, Write};

const ZENHUB_ENDPOINT: &'static str = "https://api.zenhub.io/";

#[cfg_attr(rustfmt, rustfmt_skip)]
struct ZenhubClient {
    client: Client,
}

impl ZenhubClient {
    fn new() -> ZenhubClient {
        ZenhubClient {
        }
    }

    fn get_board(&self, 
fn main() {
    println!("Hello, world!");
}

Error trace

   Compiling hyper v0.12.13
thread 'main' panicked at 'librustc/hir/map/hir_id_validator.rs:31: 
HirIdValidator: The recorded owner of path segment super (id=36924) is ::server[0]::conn[0]::{{?}}[34] instead of ::server[0]::conn[0]::{{?}}[34]::{{?}}[0]
HirIdValidator: Same HirId ::server[0]::conn[0]::{{?}}[34]::{{?}}[0]/2 assigned for nodes path segment super (id=36924) and path segment spawn_all (id=89958)', librustc/util/bug.rs:47:26
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:480
   6: std::panicking::begin_panic
   7: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   8: rustc::ty::context::tls::with_opt::{{closure}}
   9: rustc::ty::context::tls::with_context_opt
  10: rustc::ty::context::tls::with_opt
  11: rustc::util::bug::opt_span_bug_fmt
  12: rustc::util::bug::bug_fmt
  13: rustc::hir::map::hir_id_validator::check_crate
  14: rustc::hir::map::map_crate
  15: rustc::util::common::time
  16: rustc_driver::driver::compile_input
  17: rustc_driver::run_compiler_with_pool
  18: <scoped_tls::ScopedKey<T>>::set
  19: rustc_driver::run_compiler
  20: <scoped_tls::ScopedKey<T>>::set
  21: syntax::with_globals
  22: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  23: rustc_driver::run
  24: rustc_driver::main
  25: std::rt::lang_start::{{closure}}
  26: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  27: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  28: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  29: main
  30: __libc_start_main
  31: <unknown>
query stack during panic:
end of query stack

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: rustc 1.31.0-nightly (96064eb61 2018-10-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `hyper`.

To learn more, run the command again with --verbose.

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