Skip to content

ICE: 'bad input type for cast', compiler/rustc_mir/src/transform/check_consts/validation.rs:665:59 #83056

Closed
@chengniansun

Description

@chengniansun

Code

struct WSAPROTOCOLCHAIN {
    ChainEntries: [DWORD; SetFileAttributesW as usize],
}
extern "C" {
    fn SetFileAttributesW() -> BOOL;
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (4a8b6f708 2021-03-11)
binary: rustc
commit-hash: 4a8b6f708c38342a6c74aa00cf4323774c7381a6
commit-date: 2021-03-11
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

error[E0412]: cannot find type `DWORD` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:20
  |
2 |     ChainEntries: [DWORD; SetFileAttributesW as usize],
  |                    ^^^^^ not found in this scope

error[E0412]: cannot find type `BOOL` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:5:32
  |
5 |     fn SetFileAttributesW() -> BOOL;
  |                                ^^^^ 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 | / struct WSAPROTOCOLCHAIN {
2 | |     ChainEntries: [DWORD; SetFileAttributesW as usize],
3 | | }
4 | | extern "C" {
5 | |     fn SetFileAttributesW() -> BOOL;
6 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

thread 'rustc' panicked at 'bad input type for cast', compiler/rustc_mir/src/transform/check_consts/validation.rs:665:59
note: run with `RUST_BACKTRACE=1` environment variable to display 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0-nightly (4a8b6f708 2021-03-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_const_qualif] const checking `WSAPROTOCOLCHAIN::ChainEntries::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `WSAPROTOCOLCHAIN::ChainEntries::{constant#0}`
end of query stack
error: aborting due to 3 previous errors

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

error[E0412]: cannot find type `DWORD` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:20
  |
2 |     ChainEntries: [DWORD; SetFileAttributesW as usize],
  |                    ^^^^^ not found in this scope

error[E0412]: cannot find type `BOOL` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:5:32
  |
5 |     fn SetFileAttributesW() -> BOOL;
  |                                ^^^^ 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 | / struct WSAPROTOCOLCHAIN {
2 | |     ChainEntries: [DWORD; SetFileAttributesW as usize],
3 | | }
4 | | extern "C" {
5 | |     fn SetFileAttributesW() -> BOOL;
6 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

thread 'rustc' panicked at 'bad input type for cast', compiler/rustc_mir/src/transform/check_consts/validation.rs:665:59
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4a8b6f708c38342a6c74aa00cf4323774c7381a6/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/4a8b6f708c38342a6c74aa00cf4323774c7381a6/library/core/src/panicking.rs:92:14
   2: core::option::expect_failed
             at /rustc/4a8b6f708c38342a6c74aa00cf4323774c7381a6/library/core/src/option.rs:1321:5
   3: <rustc_mir::transform::check_consts::validation::Validator as rustc_middle::mir::visit::Visitor>::visit_rvalue
   4: <rustc_mir::transform::check_consts::validation::Validator as rustc_middle::mir::visit::Visitor>::visit_statement
   5: rustc_mir::transform::check_consts::validation::Validator::check_body
   6: rustc_mir::transform::mir_const_qualif
   7: core::ops::function::FnOnce::call_once
   8: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
   9: rustc_query_system::query::plumbing::force_query_with_job
  10: rustc_query_system::query::plumbing::get_query_impl
  11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const_qualif
  12: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
  13: 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
  14: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  15: rustc_data_structures::stack::ensure_sufficient_stack
  16: rustc_query_system::query::plumbing::force_query_with_job
  17: rustc_query_system::query::plumbing::get_query_impl
  18: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
  19: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  20: 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
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::force_query_with_job
  24: rustc_query_system::query::plumbing::get_query_impl
  25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  26: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  27: 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
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_data_structures::stack::ensure_sufficient_stack
  30: rustc_query_system::query::plumbing::force_query_with_job
  31: rustc_query_system::query::plumbing::get_query_impl
  32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
  33: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  34: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  35: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const
  36: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  37: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
  38: rustc_trait_selection::traits::project::normalize
  39: <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in
  40: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  41: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  42: rustc_typeck::check::wfcheck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::non_enum_variant
  43: rustc_infer::infer::InferCtxtBuilder::enter
  44: rustc_typeck::check::wfcheck::check_item_well_formed
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_query_system::query::plumbing::force_query_with_job
  47: rustc_query_system::query::plumbing::get_query_impl
  48: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_item_well_formed
  49: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_item
  50: rustc_data_structures::sync::par_for_each_in
  51: rustc_hir::hir::Crate::par_visit_all_item_likes
  52: rustc_session::session::Session::track_errors
  53: rustc_typeck::check_crate
  54: rustc_interface::passes::analysis
  55: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  56: rustc_data_structures::stack::ensure_sufficient_stack
  57: rustc_query_system::query::plumbing::force_query_with_job
  58: rustc_query_system::query::plumbing::get_query_impl
  59: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  60: rustc_interface::passes::QueryContext::enter
  61: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  62: rustc_span::with_source_map
  63: rustc_interface::interface::create_compiler_and_run
  64: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0-nightly (4a8b6f708 2021-03-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_const_qualif] const checking `WSAPROTOCOLCHAIN::ChainEntries::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `WSAPROTOCOLCHAIN::ChainEntries::{constant#0}`
#2 [eval_to_const_value_raw] simplifying constant for the type system `WSAPROTOCOLCHAIN::ChainEntries::{constant#0}`
#3 [eval_to_const_value_raw] simplifying constant for the type system `WSAPROTOCOLCHAIN::ChainEntries::{constant#0}`
#4 [check_item_well_formed] checking that `WSAPROTOCOLCHAIN` is well-formed
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions