Skip to content

Commit ea0f1ca

Browse files
committed
Look for HIFFY_FUNCTIONS in both variables and definitions
1 parent 5cb6122 commit ea0f1ca

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

humility-hiffy/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,14 @@ impl<'a> HiffyContext<'a> {
184184
}
185185

186186
fn definition(hubris: &'a HubrisArchive, name: &str) -> Result<HubrisGoff> {
187+
// Depending on compiler version, definitions may be in either
188+
// `self.definitions` or `self.variables`, so we'll check in both
189+
// places. Behavior depends on whether the compiler included DWARF /
190+
// ELF debug info for the type of an otherwise-unused variable marked as
191+
// `#[used]`; this changed in rust-lang/rust#140872
187192
let goff = hubris
188193
.lookup_definition(name)
194+
.or_else(|_| hubris.lookup_variable(name).map(|v| &v.goff))
189195
.context("expected hiffy definition not found")?;
190196

191197
Ok(*goff)

0 commit comments

Comments
 (0)