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: compiler/rustc_mir/src/interpret/eval_context.rs:188:17: The type checker should prevent reading from a never-written local #83531

Closed
chengniansun opened this issue Mar 26, 2021 · 5 comments
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

Code

union Foo {
    a: isize,
    b: &VTable,
}
enum Bar {
    Boo = [Foo { b: () }.a][3],
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (52e3dffa5 2021-03-25)
binary: rustc
commit-hash: 52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07
commit-date: 2021-03-25
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error[E0412]: cannot find type `VTable` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:9
  |
3 |     b: &VTable,
  |         ^^^^^^ not found in this scope

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / union Foo {
2 | |     a: isize,
3 | |     b: &VTable,
4 | | }
5 | | enum Bar {
6 | |     Boo = [Foo { b: () }.a][3],
7 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0106]: missing lifetime specifier
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:8
  |
3 |     b: &VTable,
  |        ^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
1 | union Foo<'a> {
2 |     a: isize,
3 |     b: &'a VTable,
  |

error[E0658]: unions with non-`Copy` fields other than `ManuallyDrop<T>` are unstable
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:5
  |
3 |     b: &VTable,
  |     ^^^^^^^^^^
  |
  = note: see issue #55149 <https://github.com/rust-lang/rust/issues/55149> for more information
  = help: add `#![feature(untagged_unions)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_mir/src/interpret/eval_context.rs:188:17: The type checker should prevent reading from a never-written local

thread 'rustc' panicked at 'Box<Any>', /rustc/52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (52e3dffa5 2021-03-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `Bar::Boo::{constant#0}`
#1 [eval_to_const_value_raw] simplifying constant for the type system `Bar::Boo::{constant#0}`
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0106, E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0106`.
Backtrace

error[E0412]: cannot find type `VTable` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:9
  |
3 |     b: &VTable,
  |         ^^^^^^ not found in this scope

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / union Foo {
2 | |     a: isize,
3 | |     b: &VTable,
4 | | }
5 | | enum Bar {
6 | |     Boo = [Foo { b: () }.a][3],
7 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0106]: missing lifetime specifier
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:8
  |
3 |     b: &VTable,
  |        ^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
1 | union Foo<'a> {
2 |     a: isize,
3 |     b: &'a VTable,
  |

error[E0658]: unions with non-`Copy` fields other than `ManuallyDrop<T>` are unstable
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:5
  |
3 |     b: &VTable,
  |     ^^^^^^^^^^
  |
  = note: see issue #55149 <https://github.com/rust-lang/rust/issues/55149> for more information
  = help: add `#![feature(untagged_unions)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_mir/src/interpret/eval_context.rs:188:17: The type checker should prevent reading from a never-written local

thread 'rustc' panicked at 'Box<Any>', /rustc/52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::access_local
   8: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand
   9: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
  10: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::run
  11: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
  12: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_allocation_raw>::compute
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  14: rustc_data_structures::stack::ensure_sufficient_stack
  15: rustc_query_system::query::plumbing::force_query_with_job
  16: rustc_query_system::query::plumbing::get_query_impl
  17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
  18: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  19: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_const_value_raw>::compute
  20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  21: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_query_system::query::plumbing::force_query_with_job
  23: rustc_query_system::query::plumbing::get_query_impl
  24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  25: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  26: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_const_value_raw>::compute
  27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  28: rustc_data_structures::stack::ensure_sufficient_stack
  29: rustc_query_system::query::plumbing::force_query_with_job
  30: rustc_query_system::query::plumbing::get_query_impl
  31: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  32: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  33: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_poly
  34: rustc_typeck::collect::convert_item
  35: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  36: rustc_middle::hir::map::Map::visit_item_likes_in_module
  37: rustc_typeck::collect::collect_mod_item_types
  38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  39: rustc_query_system::query::plumbing::force_query_with_job
  40: rustc_query_system::query::plumbing::get_query_impl
  41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  42: rustc_session::session::Session::track_errors
  43: rustc_typeck::check_crate
  44: rustc_interface::passes::analysis
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_data_structures::stack::ensure_sufficient_stack
  47: rustc_query_system::query::plumbing::force_query_with_job
  48: rustc_query_system::query::plumbing::get_query_impl
  49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  50: rustc_interface::passes::QueryContext::enter
  51: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  52: rustc_span::with_source_map
  53: rustc_interface::interface::create_compiler_and_run
  54: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (52e3dffa5 2021-03-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `Bar::Boo::{constant#0}`
#1 [eval_to_const_value_raw] simplifying constant for the type system `Bar::Boo::{constant#0}`
#2 [eval_to_const_value_raw] simplifying constant for the type system `Bar::Boo::{constant#0}`
#3 [collect_mod_item_types] collecting item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0106, E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0106`.

@chengniansun chengniansun added C-bug Category: This is a bug. 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. labels Mar 26, 2021
@chengniansun
Copy link
Author

This might be relevant to or a duplicate of #69487

@chengniansun
Copy link
Author

Besides, I finally trigged this hidden rustc feature.

Code

fn main() {
    break rust;
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (52e3dffa5 2021-03-25)
binary: rustc
commit-hash: 52e3dffa50cfffdcfa145c0cc0ba48b49abc0c07
commit-date: 2021-03-25
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error[E0425]: cannot find value `rust` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:11
  |
2 |     break rust;
  |           ^^^^ not found in this scope

error[E0268]: `break` outside of a loop
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:5
  |
2 |     break rust;
  |     ^^^^^^^^^^ cannot `break` outside of a loop

error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?

note: the compiler expectedly panicked. this is a feature.

note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675

note: rustc 1.53.0-nightly (52e3dffa5 2021-03-25) running on x86_64-unknown-linux-gnu

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0268, E0425.
For more information about an error, try `rustc --explain E0268`.
Backtrace

error[E0425]: cannot find value `rust` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:11
  |
2 |     break rust;
  |           ^^^^ not found in this scope

error[E0268]: `break` outside of a loop
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:5
  |
2 |     break rust;
  |     ^^^^^^^^^^ cannot `break` outside of a loop

error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?

note: the compiler expectedly panicked. this is a feature.

note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675

note: rustc 1.53.0-nightly (52e3dffa5 2021-03-25) running on x86_64-unknown-linux-gnu

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0268, E0425.
For more information about an error, try `rustc --explain E0268`.

@jonas-schievink jonas-schievink added A-const-eval Area: Constant evaluation (MIR interpretation) I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 26, 2021
@JohnTitor
Copy link
Member

Assigning P-medium as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@JohnTitor JohnTitor added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 29, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Apr 2, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 2, 2021
@RalfJung
Copy link
Member

Yeah this very much looks like a duplicate of #69487.

@Enselic
Copy link
Member

Enselic commented Sep 7, 2023

Triage: No one said it was not a duplicate, so let's close as duplicate.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority 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

6 participants