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: Unexpected def description when inspecting MIR #59021

Closed
dlrobertson opened this issue Mar 8, 2019 · 1 comment
Closed

ICE: Unexpected def description when inspecting MIR #59021

dlrobertson opened this issue Mar 8, 2019 · 1 comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-pretty Area: Pretty printing (including `-Z unpretty`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dlrobertson
Copy link
Contributor

dlrobertson commented Mar 8, 2019

Summary

When compiling the following:

pub enum TestMe {
    X(usize),
}

with the following rustc command:

rustc --crate-type=lib --out-dir=./build --emit=mir ./test.rs

the following ICE occurs:

error: internal compiler error: src/librustc_mir/util/pretty.rs:612: Unexpected def description Some(Variant(DefId(0/1:11 ~ test[8787]::TestMe[0]::Y[0])))

Versions

This appears to be a regression from stable to (beta|nightly). It occurs on nightly and beta, but I couldn't get the ICE to occur on stable (1.33).

Backtrace

Backtrace
error: internal compiler error: src/librustc_mir/util/pretty.rs:612: Unexpected def description Some(Variant(DefId(0/1:11 ~ test[8787]::TestMe[0]::Y[0])))

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:59
   3: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:197
   4: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   5: core::ops::function::Fn::call
             at /home/drobertson/git/rust/src/libcore/ops/function.rs:69
   6: rustc::util::common::panic_hook
             at src/librustc/util/common.rs:39
   7: core::ops::function::Fn::call
             at /home/drobertson/git/rust/src/libcore/ops/function.rs:69
   8: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   9: std::panicking::begin_panic
             at /home/drobertson/git/rust/src/libstd/panicking.rs:408
  10: rustc_errors::Handler::bug
             at src/librustc_errors/lib.rs:620
  11: rustc::util::bug::opt_span_bug_fmt::{{closure}}
             at src/librustc/util/bug.rs:36
  12: rustc::ty::context::tls::with_opt::{{closure}}
             at src/librustc/ty/context.rs:2120
  13: rustc::ty::context::tls::with_context_opt
             at src/librustc/ty/context.rs:2055
  14: rustc::ty::context::tls::with_opt
             at src/librustc/ty/context.rs:2120
  15: rustc::util::bug::opt_span_bug_fmt
             at src/librustc/util/bug.rs:32
  16: rustc::util::bug::bug_fmt
             at src/librustc/util/bug.rs:12
  17: rustc_mir::util::pretty::write_mir_sig
             at src/librustc_mir/util/pretty.rs:612
  18: rustc_mir::util::pretty::write_mir_intro
             at src/librustc_mir/util/pretty.rs:553
  19: rustc_mir::util::pretty::write_mir_fn
             at src/librustc_mir/util/pretty.rs:293
  20: rustc_mir::util::pretty::write_mir_pretty
             at src/librustc_mir/util/pretty.rs:269
  21: rustc_mir::transform::dump_mir::emit_mir
             at src/librustc_mir/transform/dump_mir.rs:65
  22: rustc_driver::driver::compile_input::{{closure}}
             at src/librustc_driver/driver.rs:327
  23: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
             at src/librustc_driver/driver.rs:1220
  24: rustc::ty::context::tls::enter_global::{{closure}}::{{closure}}
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:2009
  25: rustc::ty::context::tls::enter_context::{{closure}}
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1975
  26: rustc::ty::context::tls::set_tlv
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1908
  27: rustc::ty::context::tls::enter_context
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1974
  28: rustc::ty::context::tls::enter_global::{{closure}}
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:2008
  29: rustc::ty::context::tls::with_thread_locals::{{closure}}::{{closure}}
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1963
  30: <std::thread::local::LocalKey<T>>::try_with
             at /home/drobertson/git/rust/src/libstd/thread/local.rs:296
  31: <std::thread::local::LocalKey<T>>::with
             at /home/drobertson/git/rust/src/libstd/thread/local.rs:242
  32: rustc::ty::context::tls::with_thread_locals::{{closure}}
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1955
  33: <std::thread::local::LocalKey<T>>::try_with
             at /home/drobertson/git/rust/src/libstd/thread/local.rs:296
  34: <std::thread::local::LocalKey<T>>::with
             at /home/drobertson/git/rust/src/libstd/thread/local.rs:242
  35: rustc::ty::context::tls::with_thread_locals
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1947
  36: rustc::ty::context::tls::enter_global
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1986
  37: rustc::ty::context::TyCtxt::create_and_enter
             at /home/drobertson/git/rust/src/librustc/ty/context.rs:1300
  38: rustc_driver::driver::phase_3_run_analysis_passes
             at src/librustc_driver/driver.rs:1201
  39: rustc_driver::driver::compile_input
             at src/librustc_driver/driver.rs:275
  40: rustc_driver::run_compiler_with_pool
             at src/librustc_driver/lib.rs:268
  41: rustc_driver::run_compiler::{{closure}}
             at src/librustc_driver/lib.rs:185
  42: rustc_driver::driver::spawn_thread_pool::{{closure}}
             at src/librustc_driver/driver.rs:61
  43: <scoped_tls::ScopedKey<T>>::set
             at /home/drobertson/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  44: rustc_driver::driver::spawn_thread_pool
             at src/librustc_driver/driver.rs:60
  45: rustc_driver::run_compiler
             at src/librustc_driver/lib.rs:184
  46: rustc_driver::main::{{closure}}
             at src/librustc_driver/lib.rs:1401
  47: rustc_driver::run::{{closure}}::{{closure}}
             at src/librustc_driver/lib.rs:136
  48: <scoped_tls::ScopedKey<T>>::set
             at /home/drobertson/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  49: syntax::with_globals::{{closure}}
             at /home/drobertson/git/rust/src/libsyntax/lib.rs:100
  50: <scoped_tls::ScopedKey<T>>::set
             at /home/drobertson/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  51: syntax::with_globals
             at /home/drobertson/git/rust/src/libsyntax/lib.rs:99
  52: rustc_driver::run::{{closure}}
             at src/librustc_driver/lib.rs:135
  53: rustc_driver::monitor::{{closure}}
             at src/librustc_driver/lib.rs:1317
query stack during panic:
end of query stack
error: aborting due to previous error


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.35.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib
@jonas-schievink jonas-schievink added A-pretty Area: Pretty printing (including `-Z unpretty`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Mar 8, 2019
@dlrobertson
Copy link
Contributor Author

dlrobertson commented Mar 9, 2019

Pretty sure this is happening when creating the constructor for the variants (e.g. TestMe::X(_1: usize)). is_function is not set for Def::Variant here, so we hit the ICE.

Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
Centril added a commit to Centril/rust that referenced this issue Mar 11, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
kennytm added a commit to kennytm/rust that referenced this issue Mar 11, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
pietroalbini added a commit to pietroalbini/rust that referenced this issue Mar 13, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
kennytm added a commit to kennytm/rust that referenced this issue Mar 15, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
kennytm added a commit to kennytm/rust that referenced this issue Mar 16, 2019
Fix ICE in MIR pretty printing

A `Def::Variant` should be considered as a function in mir pretty
printing. Each variant has a constructor that we must print.

Given the following enum definition:

```rust
pub enum TestMe {
    X(usize),
}
```

We will need to generate a constructor for the variant `X` with a
signature that looks something like the following:

```
fn TestMe::X(_1: usize) -> TestMe;
```

Fixes: rust-lang#59021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-pretty Area: Pretty printing (including `-Z unpretty`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants