Bug: compilation failure with rustc 1.84.0 and enable-debug-symbols
Status: RESOLVED
Priority: --
Resolution: MOVED
Created: 2025-01-23 13:17:28+00:00
Resolved: 2025-01-28 12:50:23+00:00

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Steps to reproduce:

on OpenBSD, while migrating the rustc compiler from 1.83.0 to 1.84.0, a new error occured and the build of thunderbird (128.6.0esr) failed.

I am still unsure if it is regression in rustc compiler or not.

When buiding, `--enable-debug-symbols` is used and it leads to "LLVM Error" and "!dbg attachment points at wrong subprogram for function" warnings.

When using `--disable-debug` or `--enable-debug` the build is fine and finish.


Actual results:

```
!dbg attachment points at wrong subprogram for function
!334951 = distinct !DISubprogram(name: "render_into<alloc::string::String>", linkageName: "_ZN95_$LT$uniffi_bindgen..bindings..python..gen_python..TypeRenderer$u20$as$u20$askama..Template$GT$11render_into17h931ec4ae692281a1E", scope: !334952, file: !3046, line: 235, type: !15, scopeLine: 235, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6, templateParams: !16)
ptr @"_ZN95_$LT$uniffi_bindgen..bindings..python..gen_python..TypeRenderer$u20$as$u20$askama..Template$GT$11render_into17h931ec4ae692281a1E"
  invoke void @_ZN5alloc3fmt6format12format_inner17h0e4c74636ba13eb9E(ptr noalias nocapture noundef nonnull sret([24 x i8]) align 8 dereferenceable(24) %57, ptr noalias nocapture noundef nonnull readonly align 8 dereferenceable(48) %56)
          to label %27722 unwind label %27716, !dbg !411313
!411313 = !DILocation(line: 652, column: 34, scope: !3499, inlinedAt: !411314)
!3504 = distinct !DISubprogram(name: "map_or_else<&str, alloc::string::String, alloc::fmt::format::{closure_env#0}, fn(&str) -> alloc::string::String>", linkageName: "_ZN4core6option15Option$LT$T$GT$11map_or_else17h90686408a2079105E", scope: !34, file: !33, line: 1212, type: !15, scopeLine: 1212, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6, templateParams: !16)
!3504 = distinct !DISubprogram(name: "map_or_else<&str, alloc::string::String, alloc::fmt::format::{closure_env#0}, fn(&str) -> alloc::string::String>", linkageName: "_ZN4core6option15Option$LT$T$GT$11map_or_else17h90686408a2079105E", scope: !34, file: !33, line: 1212, type: !15, scopeLine: 1212, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6, templateParams: !16)
!dbg attachment points at wrong subprogram for function
!334951 = distinct !DISubprogram(name: "render_into<alloc::string::String>", linkageName: "_ZN95_$LT$uniffi_bindgen..bindings..python..gen_python..TypeRenderer$u20$as$u20$askama..Template$GT$11render_into17h931ec4ae692281a1E", scope: !334952, file: !3046, line: 235, type: !15, scopeLine: 235, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6, templateParams: !16)
ptr @"_ZN95_$LT$uniffi_bindgen..bindings..python..gen_python..TypeRenderer$u20$as$u20$askama..Template$GT$11render_into17h931ec4ae692281a1E"
  invoke void @_ZN5alloc3fmt6format12format_inner17h0e4c74636ba13eb9E(ptr noalias nocapture noundef nonnull sret([24 x i8]) align 8 dereferenceable(24) %57, ptr noalias nocapture noundef nonnull readonly align 8 dereferenceable(48) %56)
          to label %29200 unwind label %29189, !dbg !411242
!411242 = !DILocation(line: 652, column: 34, scope: !3499, inlinedAt: !411243)
!3504 = distinct !DISubprogram(name: "map_or_else<&str, alloc::string::String, alloc::fmt::format::{closure_env#0}, fn(&str) -> alloc::string::String>", linkageName: "_ZN4core6option15Option$LT$T$GT$11map_or_else17h90686408a2079105E", scope: !34, file: !33, line: 1212, type: !15, scopeLine: 1212, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6, templateParams: !16)
!3504 = distinct !DISubprogram(name: "map_or_else<&str, alloc::string::String, alloc::fmt::format::{closure_env#0}, fn(&str) -> alloc::string::String>", linkageName: "_ZN4core6option15Option$LT$T$GT$11map_or_else17h90686408a2079105E", scope: !34, file: !33, line: 1212, type: !15, scopeLine: 1212, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6, templateParams: !16)
rustc-LLVM ERROR: Broken module found, compilation aborted!
warning: `uniffi_bindgen` (lib) generated 6 warnings (6 duplicates)
error: could not compile `uniffi_bindgen` (lib); 6 warnings emitted

Caused by:
  process didn't exit successfully: `CARGO=/usr/local/bin/cargo CARGO_CRATE_NAME=uniffi_bindgen CARGO_MANIFEST_DIR=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/thunderbird-128.6.0/comm/third_party/rust/uniffi_bindgen CARGO_MANIFEST_PATH=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/thunderbird-128.6.0/comm/third_party/rust/uniffi_bindgen/Cargo.toml CARGO_PKG_AUTHORS='Firefox Sync Team <sync-team@mozilla.com>' CARGO_PKG_DESCRIPTION='a multi-language bindings generator for rust (codegen and cli tooling)' CARGO_PKG_HOMEPAGE='https://mozilla.github.io/uniffi-rs' CARGO_PKG_LICENSE=MPL-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=uniffi_bindgen CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/mozilla/uniffi-rs' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.27.1 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=27 CARGO_PKG_VERSION_PATCH=1 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/release/deps /usr/local/bin/rustc --crate-name uniffi_bindgen --edition=2021 /data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/thunderbird-128.6.0/comm/third_party/rust/uniffi_bindgen/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C embed-bitcode=no --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("clap"))' -C metadata=20f246106ffeeace -C extra-filename=-20f246106ffeeace --out-dir /data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps --target x86_64-unknown-openbsd -C linker=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/thunderbird-128.6.0/build/cargo-linker -C strip=debuginfo -L dependency=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps -L dependency=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/release/deps --extern anyhow=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libanyhow-22e28368c6e41043.rmeta --extern askama=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libaskama-fb23090c6fe7858e.rmeta --extern camino=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libcamino-601f895e63a704bc.rmeta --extern cargo_metadata=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libcargo_metadata-a220a8ac4b3b04a3.rmeta --extern fs_err=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libfs_err-3e53c1d96e8258b2.rmeta --extern glob=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libglob-088cab2374b64562.rmeta --extern goblin=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libgoblin-923ceb5297cef101.rmeta --extern heck=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libheck-fbf7a72729cc5176.rmeta --extern once_cell=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libonce_cell-ece9875099e3d1cd.rmeta --extern paste=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/release/deps/libpaste-11f9f8dbe54795bd.so --extern serde=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libserde-d0644049528fe69c.rmeta --extern textwrap=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libtextwrap-f65b0ba98d05d607.rmeta --extern toml=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libtoml-fb09214b8e8ba0a4.rmeta --extern uniffi_meta=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libuniffi_meta-c18a26c89f8fd472.rmeta --extern uniffi_testing=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libuniffi_testing-6bc220bb8fd4a407.rmeta --extern uniffi_udl=/data/semarie/repos/openbsd/ports/pobj/thunderbird-128.6.0/build-amd64/x86_64-unknown-openbsd/release/deps/libuniffi_udl-cfba91e434d57432.rmeta --cap-lints warn -C debuginfo=1 --cap-lints warn -Cembed-bitcode=yes -C codegen-units=1` (exit status: 101)
̀``


Expected results:

The build should finish.