DILocation's scope must be a DILocalScope

Strange compile error (rustc 1.71.0 (8ede3aae2 2023-07-12)):

Compiling sharpview v0.4.6 (/home/john/projects/sl/SL-test-viewer/sharpview)
DILocation's scope must be a DILocalScope
!19097 = distinct !DISubprogram(name: "drop_in_place<libreplay::dummyclient::DummyWorldClient>", linkageName: "_ZN4core3ptr61drop_in_place$LT$libreplay..dummyclient..DummyWorldClient$GT$17hc7cc9a81473a5678E", scope: !60, file: !2757, line: 497, type: !19098, scopeLine: 497, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !1317, templateParams: !19103, retainedNodes: !19101)
ptr @"_ZN4core3ptr61drop_in_place$LT$libreplay..dummyclient..DummyWorldClient$GT$17hc7cc9a81473a5678E"
  call void @llvm.dbg.value(metadata ptr %83, metadata !15900, metadata !DIExpression()), !dbg !19262
!19262 = !DILocation(line: 0, scope: !11536, inlinedAt: !19263)
!11536 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DirectionalLight", scope: !1662, file: !2, size: 288, align: 32, elements: !11537, templateParams: !18, identifier: "fd077a71d282826ae94ea0462f774923")
location requires a valid scope
!19262 = !DILocation(line: 0, scope: !11536, inlinedAt: !19263)
!11536 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DirectionalLight", scope: !1662, file: !2, size: 288, align: 32, elements: !11537, templateParams: !18, identifier: "fd077a71d282826ae94ea0462f774923")
warning: ignoring invalid debug info in libdialog-8034e8f0e46a68be.libdialog.9fd73a1049660110-cgu.14.rcgu.o
    Finished release [optimized + debuginfo] target(s) in 1m 32s
warning: the following packages contain code that will be rejected by a future version of Rust: iso8601 v0.3.0, nom v4.2.3, quick-xml v0.17.2, rustc-serialize v0.3.24
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`

I'd been compiling a checked release recently with

[profile.checkedrelease]
inherits = "release"
debug-assertions = true

That was working. Done with debugging something that required full debug assertions, I switched to compiling with regular --release. and got the above message.

2 Likes

A second try of "cargo build --release" ran successfully.

Thinking about this, the first time I built a "checkedrelease" build, there was some build error, and I had to do a "cargo clean" and rebuild. Then it worked. First time I ever had to do a clean.

I'm starting to suspect some kind of bug in the part of the build system that decides what to rebuild when you change a parameter in Cargo.toml. Usually that's very reliable, but this is an obscure feature and might not be well debugged.