Skip to content

mir\interpret\place ice: Layout mismatch when copying! #68843

Closed as not planned
Closed as not planned
@CAD97

Description

@CAD97

With this patch to rustc, I get an ICE compiling stage 1 core:

   Compiling core v0.0.0 (D:\repos\rust-lang\rust\src\libcore)
thread 'rustc' panicked at 'Layout mismatch when copying!
src: OpTy {
    op: Immediate(
        Scalar(
            0xffffffffffffffff,
        ),
    ),
    layout: TyLayout {
        ty: isize,
        details: LayoutDetails {
            variants: Single {
                index: 0,
            },
            fields: Union(
                0,
            ),
            abi: Scalar(
                Scalar {
                    value: Int(
                        I64,
                        true,
                    ),
                    valid_range: 0..=18446744073709551615,
                },
            ),
            largest_niche: None,
            align: AbiAndPrefAlign {
                abi: Align {
                    pow2: 3,
                },
                pref: Align {
                    pow2: 3,
                },
            },
            size: Size {
                raw: 8,
            },
        },
    },
}
dest: PlaceTy {
    place: Ptr(
        MemPlace {
            ptr: alloc0+0,
            align: Align {
                pow2: 3,
            },
            meta: None,
        },
    ),
    layout: TyLayout {
        ty: isize,
        details: LayoutDetails {
            variants: Single {
                index: 0,
            },
            fields: Union(
                0,
            ),
            abi: Scalar(
                Scalar {
                    value: Int(
                        I64,
                        true,
                    ),
                    valid_range: 0..=18446744073709551615,
                },
            ),
            largest_niche: None,
            align: AbiAndPrefAlign {
                abi: Align {
                    pow2: 3,
                },
                pref: Align {
                    pow2: 3,
                },
            },
            size: Size {
                raw: 8,
            },
        },
    },
}', src\librustc_mir\interpret\place.rs:855:9
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
   1: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   2: core::fmt::write
   3: std::io::Write::write_fmt
   4: std::panicking::take_hook
   5: std::panicking::take_hook
   6: rustc_driver::report_ice
   7: std::panicking::rust_panic_with_hook
   8: rust_begin_unwind
   9: std::panicking::begin_panic_fmt
  10: rustc_mir::interpret::place::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::mplace_array_fields
  11: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
  12: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::run
  13: rustc_mir::const_eval::eval_queries::const_eval_raw_provider
  14: rustc::ty::query::__query_compute::const_eval_raw
  15: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  16: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  17: rustc::ty::query::__query_compute::const_eval_validated
  18: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  19: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  20: rustc::ty::query::__query_compute::const_eval_validated
  21: <rustc::traits::Vtable<N> as core::clone::Clone>::clone
  22: rustc::dep_graph::graph::DepGraph::with_task_impl
  23: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  24: rustc::mir::interpret::queries::<impl rustc::ty::context::TyCtxt>::const_eval_poly
  25: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  26: rustc::hir::map::Map::visit_item_likes_in_module
  27: rustc_typeck::collect::collect_mod_item_types
  28: rustc::ty::query::__query_compute::collect_mod_item_types
  29: rustc::ty::fold::<impl rustc::ty::context::TyCtxt>::anonymize_late_bound_regions
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  33: rustc_typeck::check_crate
  34: rustc_interface::passes::create_global_ctxt
  35: rustc::ty::query::__query_compute::analysis
  36: rustc::dep_graph::graph::DepGraph::with_task_impl
  37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  38: rustc::ty::context::tls::enter_global
  39: rustc_interface::interface::run_compiler_in_existing_thread_pool
  40: scoped_tls::ScopedKey<T>::set
  41: syntax::attr::with_globals
  42: rustc_data_structures::cold_path
  43: _rust_maybe_catch_panic
  44: core::fmt::Write::write_fmt
  45: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
  46: std::sys_common::thread::start_thread
  47: std::sys::windows::thread::Thread::new
  48: BaseThreadInitThunk
  49: RtlUserThreadStart
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z external-macro-backtrace -Z binary-dep-depinfo -Z force-unstable-if-unmarked -C opt-level=3 -C debuginfo=0 -C target-feature=+crt-static -C prefer-dynamic -C debug-assertions=n --crate-type lib

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

query stack during panic:
#0 [const_eval_raw] const-evaluating `cmp::Ordering::Less::{{constant}}#0`
#1 [const_eval_validated] const-evaluating + checking `cmp::Ordering::Less::{{constant}}#0`
#2 [const_eval_validated] const-evaluating + checking `cmp::Ordering::Less::{{constant}}#0`
#3 [collect_mod_item_types] collecting item types in module `cmp`
#4 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `core`.

As this is an ICE compiling core I'm not exactly sure how to minimize it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions