Closed bvssvni closed 1 year ago
This can be solved by introducing LifetimeError
and LifetimeResult
:
#[derive(Debug)]
pub enum LifetimeError {
None,
FailedToUnify,
}
pub type LifetimeResult = Result<Lifetime, LifetimeError>;
The LifetimeError::FailedToUnify
is used when it is undecidable which lifetime to assign to the expression.
In most cases, one can solve these problems using clone
, so this is suggested in the error message.
This design makes a pragmatic tradeoff between practical use and computational complexity.