Skip to content

Commit

Permalink
Fix SpaceMut::as_space signature to reflect lifetimes properly
Browse files Browse the repository at this point in the history
  • Loading branch information
vsbogd committed Sep 24, 2024
1 parent de48f6f commit 479afb1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion c/src/space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ impl SpaceMut for CSpace {
let from: atom_ref_t = from.into();
(api.replace)(&self.params, &from, to.into())
}
fn as_space(&self) -> &dyn Space {
fn as_space<'a>(&self) -> &(dyn Space + 'a) {
self
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/space/grounding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl SpaceMut for GroundingSpace {
fn replace(&mut self, from: &Atom, to: Atom) -> bool {
GroundingSpace::replace(self, from, to)
}
fn as_space(&self) -> &dyn Space {
fn as_space<'a>(&self) -> &(dyn Space + 'a) {
self
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/space/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ pub trait SpaceMut: Space {

/// Turn a &dyn SpaceMut into an &dyn Space. Obsolete when Trait Upcasting is stabilized.
/// [Rust issue #65991](https://github.com/rust-lang/rust/issues/65991) Any month now.
fn as_space(&self) -> &dyn Space;
fn as_space<'a>(&self) -> &(dyn Space + 'a);
}

#[derive(Clone)]
Expand Down Expand Up @@ -305,7 +305,7 @@ impl SpaceMut for DynSpace {
fn replace(&mut self, from: &Atom, to: Atom) -> bool {
self.0.borrow_mut().replace(from, to)
}
fn as_space(&self) -> &dyn Space {
fn as_space<'a>(&self) -> &(dyn Space + 'a) {
self
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/space/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl SpaceMut for ModuleSpace {
fn replace(&mut self, from: &Atom, to: Atom) -> bool {
self.main.replace(from, to)
}
fn as_space(&self) -> &dyn Space {
fn as_space<'a>(&self) -> &(dyn Space + 'a) {
self
}
}
Expand Down

0 comments on commit 479afb1

Please sign in to comment.