Skip to content

Compiler crashes on invalid variable definition #55587

New issue

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

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

Already on GitHub? # to your account

Closed
patrigg opened this issue Nov 1, 2018 · 1 comment · Fixed by #55956
Closed

Compiler crashes on invalid variable definition #55587

patrigg opened this issue Nov 1, 2018 · 1 comment · Fixed by #55956
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@patrigg
Copy link

patrigg commented Nov 1, 2018

The compiler unexpectedly crashes when I try to compile a program with an ill-formed variable definition.

I tried this code:

use std::path::Path;

fn main() {
    let Path::new();
}

I expected to see this happen: Compilation error message telling me that the variable definition is ill-formed.

Instead, this happened: The compiler crashes with the following error.

Compiling XXXX v0.1.0 (C:\XXXX)
Running rustc --crate-name XXXX src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=4bbcaaecf78792fe -C extra-filename=-4bbcaaecf78792fe --out-dir C:\Code\thingos\tools\thingos_pass\target\debug\deps -C incremental=C:\XXXX\target\debug\incremental -L dependency=C:\XXXX\target\debug\deps
thread 'main' panicked at 'expected fn type', libcore\option.rs:1000:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

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.30.0 (da5f414 2018-10-24) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile XXXX.

Caused by:
process didn't exit successfully: rustc --crate-name XXXX src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=4bbcaaecf78792fe -C extra-filename=-4bbcaaecf78792fe --out-dir C:\XXXX\target\debug\deps -C incremental=C:\XXXX\target\debug\incremental -L dependency=C:\XXXX\target\debug\deps (exit code: 101)

Meta

rustc --version --verbose:

rustc 1.30.0 (da5f414 2018-10-24)
binary: rustc
commit-hash: da5f414
commit-date: 2018-10-24
host: x86_64-pc-windows-msvc
release: 1.30.0
LLVM version: 8.0

@estebank estebank added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 2, 2018
@estebank
Copy link
Contributor

estebank commented Nov 2, 2018

   8: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   9: core::option::expect_failed
             at libcore/option.rs:1008
  10: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_pat_tuple_struct
  11: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_pat_walk
  12: rustc_typeck::check::FnCtxt::check_decl_local
  13: rustc_typeck::check::FnCtxt::check_block_with_expected
  14: rustc_typeck::check::FnCtxt::check_expr_kind
  15: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  16: rustc_typeck::check::FnCtxt::check_return_expr
  17: rustc_typeck::check::check_fn

let pat_ty = pat_ty.no_late_bound_regions().expect("expected fn type");

euclio added a commit to euclio/rust that referenced this issue Nov 14, 2018
kennytm added a commit to kennytm/rust that referenced this issue Nov 15, 2018
add tests for some fixed ICEs

Fixes rust-lang#55587.
Fixes rust-lang#54348.

Looks like these ICEs are already fixed in nightly, so this PR just adds tests.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Nov 15, 2018
add tests for some fixed ICEs

Fixes rust-lang#55587.
Fixes rust-lang#54348.

Looks like these ICEs are already fixed in nightly, so this PR just adds tests.

r? @estebank
# for free to join this conversation on GitHub. Already have an account? # 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.

2 participants