Skip to content

Internal compiler error when compiling encoding_rs #87394

Closed
@aviramha

Description

@aviramha

Code

It happens to me when compiling https://github.com/aviramha/ormsgpack but the compilation fails on encoding_rs

Meta

rustc --version --verbose:

rustc 1.55.0-nightly (952fdf2a1 2021-07-05)
binary: rustc
commit-hash: 952fdf2a1119affa1b37bcacb0c49cf9f0168ac8
commit-date: 2021-07-05
host: x86_64-apple-darwin
release: 1.55.0-nightly
LLVM version: 12.0.1

Error output

error: internal compiler error: /rustc/952fdf2a1119affa1b37bcacb0c49cf9f0168ac8/compiler/rustc_middle/src/ty/consts.rs:195:32: expected bits of [u32; 16], got Const {
    ty: [u32; 16],
    val: Value(
        ByRef {
            alloc: Allocation {
                bytes: [
                    8,
                    0,
                    0,
                    0,
                    24,
                    0,
                    0,
                    0,
                    9,
                    0,
                    0,
                    0,
                    25,
                    0,
                    0,
                    0,
                    10,
                    0,
                    0,
                    0,
                    26,
                    0,
                    0,
                    0,
                    11,
                    0,
                    0,
                    0,
                    27,
                    0,
                    0,
                    0,
                    12,
                    0,
                    0,
                    0,
                    28,
                    0,
                    0,
                    0,
                    13,
                    0,
                    0,
                    0,
                    29,
                    0,
                    0,
                    0,
                    14,
                    0,
                    0,
                    0,
                    30,
                    0,
                    0,
                    0,
                    15,
                    0,
                    0,
                    0,
                    31,
                    0,
                    0,
                    0,
                ],
                relocations: Relocations(
                    SortedMap {
                        data: [],
                    },
                ),
                init_mask: InitMask {
                    blocks: [
                        18446744073709551615,
                        0,
                    ],
                    len: Size {
                        raw: 64,
                    },
                },
                align: Align {
                    pow2: 2,
                },
                mutability: Not,
                extra: (),
            },
            offset: Size {
                raw: 0,
            },
        },
    ),
}


thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1006:9
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.55.0-nightly (952fdf2a1 2021-07-05) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --crate-type lib

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

query stack during panic:
end of query stack
error: aborting due to previous error=>  ] 50/52: en...


The following warnings were emitted during compilation:

warning: Cannot set `RUSTC_BOOTSTRAP=1` from build script of `encoding_rs v0.8.28`.
note: Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project.

error: could not compile `encoding_rs`

To learn more, run the command again with --verbose.
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib -- -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-args=-Wl,-install_name,@rpath/ormsgpack.cpython-38-darwin.so`
Backtrace

error: internal compiler error: /rustc/952fdf2a1119affa1b37bcacb0c49cf9f0168ac8/compiler/rustc_middle/src/ty/consts.rs:195:32: expected bits of [u32; 16], got Const {
    ty: [u32; 16],
    val: Value(
        ByRef {
            alloc: Allocation {
                bytes: [
                    8,
                    0,
                    0,
                    0,
                    24,
                    0,
                    0,
                    0,
                    9,
                    0,
                    0,
                    0,
                    25,
                    0,
                    0,
                    0,
                    10,
                    0,
                    0,
                    0,
                    26,
                    0,
                    0,
                    0,
                    11,
                    0,
                    0,
                    0,
                    27,
                    0,
                    0,
                    0,
                    12,
                    0,
                    0,
                    0,
                    28,
                    0,
                    0,
                    0,
                    13,
                    0,
                    0,
                    0,
                    29,
                    0,
                    0,
                    0,
                    14,
                    0,
                    0,
                    0,
                    30,
                    0,
                    0,
                    0,
                    15,
                    0,
                    0,
                    0,
                    31,
                    0,
                    0,
                    0,
                ],
                relocations: Relocations(
                    SortedMap {
                        data: [],
                    },
                ),
                init_mask: InitMask {
                    blocks: [
                        18446744073709551615,
                        0,
                    ],
                    len: Size {
                        raw: 64,
                    },
                },
                align: Align {
                    pow2: 2,
                },
                mutability: Not,
                extra: (),
            },
            offset: Size {
                raw: 0,
            },
        },
    ),
}


thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1006:9
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::util::bug::opt_span_bug_fmt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt::{{closure}}
   6: rustc_middle::ty::context::tls::with_opt
   7: rustc_middle::util::bug::opt_span_bug_fmt
   8: rustc_middle::util::bug::bug_fmt
   9: rustc_middle::ty::consts::Const::eval_bits::{{closure}}
  10: rustc_codegen_ssa::debuginfo::type_names::push_generic_params_internal
  11: rustc_codegen_ssa::debuginfo::type_names::push_generic_params
  12: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoMethods for rustc_codegen_llvm::context::CodegenCx>::dbg_scope_fn::get_template_parameters
  13: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoMethods for rustc_codegen_llvm::context::CodegenCx>::dbg_scope_fn
  14: rustc_codegen_llvm::debuginfo::<impl rustc_codegen_ssa::traits::debuginfo::DebugInfoMethods for rustc_codegen_llvm::context::CodegenCx>::create_function_debug_context
  15: rustc_codegen_ssa::mir::codegen_mir
  16: rustc_codegen_ssa::base::codegen_instance
  17: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
  18: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  20: rustc_codegen_llvm::base::compile_codegen_unit
  21: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  22: rustc_interface::passes::QueryContext::enter
  23: rustc_interface::queries::Queries::ongoing_codegen
  24: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  25: rustc_span::with_source_map
  26: rustc_interface::interface::create_compiler_and_run
  27: 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.55.0-nightly (952fdf2a1 2021-07-05) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --crate-type lib

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

query stack during panic:
end of query stack
error: aborting due to previous error=>  ] 50/52: en...


The following warnings were emitted during compilation:

warning: Cannot set `RUSTC_BOOTSTRAP=1` from build script of `encoding_rs v0.8.28`.
note: Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project.

error: could not compile `encoding_rs`

To learn more, run the command again with --verbose.
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib -- -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-args=-Wl,-install_name,@rpath/ormsgpack.cpython-38-darwin.so

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-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