Skip to content

Compiler crashes on invalid variable definition #55587

Closed
@patrigg

Description

@patrigg

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

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