diff --git a/compiler/noirc_frontend/src/hir/mod.rs b/compiler/noirc_frontend/src/hir/mod.rs index 3a435f302af..94783d99940 100644 --- a/compiler/noirc_frontend/src/hir/mod.rs +++ b/compiler/noirc_frontend/src/hir/mod.rs @@ -185,7 +185,7 @@ impl Context { pub fn get_definition_location_from(&self, location: Location) -> Option { let interner = &self.def_interner; - interner.find_location_index(location).and_then(|index| interner.resolve_location(index)) + interner.find_location_index(location).and_then(|index| interner.resolve_location(&index.into())) } /// Return a Vec of all `contract` declarations in the source code and the functions they contain diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index 7ee0fd7bfde..ea3c85a18c7 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -458,7 +458,7 @@ impl NodeInterner { /// The [Location] may not necessarily point to the beginning of the item /// so we check if the location's span is contained within the start or end /// of each items [Span] - pub fn find_location_index(&self, location: Location) -> Option<&Index> { + pub fn find_location_index(&self, location: Location) -> Option> { let mut location_candidate: Option<(&Index, &Location)> = None; for (index, interned_location) in self.id_to_location.iter() { @@ -472,7 +472,7 @@ impl NodeInterner { } } } - location_candidate.map(|(index, _location)| index) + location_candidate.map(|(index, _location)| *index) } /// Interns a HIR Function.