Refine SemanticModel lifetime bounds (#10221)

## Summary

Corrects/refines some semantic model and related lifetime bounds.

## Test Plan

`cargo check`
This commit is contained in:
Micha Reiser 2024-03-04 09:21:13 +01:00 committed by GitHub
parent 4eac9baf43
commit 64f66cd8fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 46 additions and 40 deletions

View file

@ -95,7 +95,7 @@ impl<'a> Scope<'a> {
}
/// Returns a tuple of the name and ID of all bindings defined in this scope.
pub fn bindings(&self) -> impl Iterator<Item = (&str, BindingId)> + '_ {
pub fn bindings(&self) -> impl Iterator<Item = (&'a str, BindingId)> + '_ {
self.bindings.iter().map(|(&name, &id)| (name, id))
}
@ -238,7 +238,7 @@ impl<'a> Scopes<'a> {
}
/// Returns an iterator over all [`Scope`] ancestors, starting from the given [`ScopeId`].
pub fn ancestors(&self, scope_id: ScopeId) -> impl Iterator<Item = &Scope> + '_ {
pub fn ancestors(&self, scope_id: ScopeId) -> impl Iterator<Item = &Scope<'a>> + '_ {
std::iter::successors(Some(&self[scope_id]), |&scope| {
scope.parent.map(|scope_id| &self[scope_id])
})