Skip to content

command rustc --print crate-name panics on Alpine 3.17 Linux #110709

Closed
@jtmoon79

Description

Bug

Command rustc --print crate-name panics on Alpine 3.17.3 Linux.

Platform

$ cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.17.3
PRETTY_NAME="Alpine Linux v3.17"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

Install gcc

$ apk add gcc

Otherwise, it's a vanilla install of Alpine.

Code

Generate a default project, cargo init rust_test1

main.rs should have

fn main() {
    println!("Hello, world!");
}

Meta

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.68.2 (9eb3afe9e 2023-03-27)
binary: rustc
commit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0
commit-date: 2023-03-27
host: x86_64-unknown-linux-musl
release: 1.68.2
LLVM version: 15.0.6

Installed is profile minimal, stable using rustup.rs script.

Error output

$ rustc --print crate-name
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_driver/src/lib.rs:627:44
stack backtrace:
   0:     0x7f8b9fc4d27a - std::backtrace_rs::backtrace::libunwind::trace::hc93ac8db1c139992
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f8b9fc4d27a - std::backtrace_rs::backtrace::trace_unsynchronized::h7843f94574a041be
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f8b9fc4d27a - std::sys_common::backtrace::_print_fmt::hc3969df642a3a61b
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f8b9fc4d27a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha12d9be49bbb8e5b
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f8b9fcabf7e - core::fmt::write::h5f281037b4b065b4
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/fmt/mod.rs:1213:17
   5:     0x7f8b9fc3f1b5 - std::io::Write::write_fmt::hf106dc810a998073
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/io/mod.rs:1682:15
   6:     0x7f8b9fc4d045 - std::sys_common::backtrace::_print::hffcece682b73ab95
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f8b9fc4d045 - std::sys_common::backtrace::print::h5b41a51142c7a0df
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f8b9fc4fe0f - std::panicking::default_hook::{{closure}}::he5c13146821875d3
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:267:22
   9:     0x7f8b9fc4fb4b - std::panicking::default_hook::he6811e3107b4065f
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:286:9
  10:     0x7f8ba0be5aa5 - rustc_driver[93068305c98cd6a9]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f8b9fc505ea - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h416e4c3d1e9dcc1c
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/alloc/src/boxed.rs:2002:9
  12:     0x7f8b9fc505ea - std::panicking::rust_panic_with_hook::hcdc7c5919b95830b
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:692:13
  13:     0x7f8b9fc50322 - std::panicking::begin_panic_handler::{{closure}}::hbc5b796e16764860
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:577:13
  14:     0x7f8b9fc4d72c - std::sys_common::backtrace::__rust_end_short_backtrace::hb2a08b36610e93dc
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7f8b9fc50072 - rust_begin_unwind
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:575:5
  16:     0x7f8b9fc124b3 - core::panicking::panic_fmt::hc56acef47e47b1d7
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:64:14
  17:     0x7f8b9fc1254d - core::panicking::panic::h1f4b10fdaa567232
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:114:5
  18:     0x7f8ba0be2061 - rustc_driver[93068305c98cd6a9]::print_crate_info
  19:     0x7f8ba0bd22b9 - rustc_span[a19c5257b1dbf235]::with_source_map::<(), rustc_interface[7cf74a2888ad13bd]::interface::run_compiler<(), rustc_driver[93068305c98cd6a9]::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
  20:     0x7f8ba0b73376 - std[eb07acef3c2b20ec]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7cf74a2888ad13bd]::util::run_in_thread_pool_with_globals<rustc_interface[7cf74a2888ad13bd]::interface::run_compiler<(), rustc_driver[93068305c98cd6a9]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  21:     0x7f8ba0b4efad - <<std[eb07acef3c2b20ec]::thread::Builder>::spawn_unchecked_<rustc_interface[7cf74a2888ad13bd]::util::run_in_thread_pool_with_globals<rustc_interface[7cf74a2888ad13bd]::interface::run_compiler<(), rustc_driver[93068305c98cd6a9]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[fbb309e159922797]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:     0x7f8b9fc59f43 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb6354b871c8f288a
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/alloc/src/boxed.rs:1988:9
  23:     0x7f8b9fc59f43 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9eb1e4ea6e9a6116
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/alloc/src/boxed.rs:1988:9
  24:     0x7f8b9fc59f43 - std::sys::unix::thread::Thread::new::thread_start::h401c60ce7501a4b8
                               at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys/unix/thread.rs:108:17
  25:     0x7f8ba9b7508b - <unknown>

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.68.2 (9eb3afe9e 2023-03-27) running on x86_64-unknown-linux-musl

query stack during panic:
end of query stack
Backtrace

$ RUST_BACKTRACE=1 cargo build
   Compiling rust_test1 v0.1.0 (/root/rust_test1)
    Finished dev [unoptimized + debuginfo] target(s) in 0.32s

(it builds fine; that's not the bug here)

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