Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify lifetime uses in data/literal binary operators #495

Merged
merged 1 commit into from
Mar 12, 2022

Conversation

panarch
Copy link
Member

@panarch panarch commented Mar 12, 2022

Replace 'b to 'static, make it to use more narrow lifetimes.

e.g.

// from
pub fn add<'b>(&self, other: &Literal<'a>) -> Result<Literal<'b>> {
 ..
}

// to
pub fn add(&self, other: &Literal<'a>) -> Result<Literal<'static>> {
 ..
}

@panarch panarch requested review from ever0de and 24seconds March 12, 2022 08:18
@panarch panarch self-assigned this Mar 12, 2022
Copy link
Member

@ever0de ever0de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

It seems that you can set the lifetime based on self. How about this one?

@panarch
Copy link
Member Author

panarch commented Mar 12, 2022

seems that you can set the lifetime based on self. How about this one?

Oh, I think.. I don't get it. Can you provide more details about it?

@ever0de
Copy link
Member

ever0de commented Mar 12, 2022

seems that you can set the lifetime based on self. How about this one?

Oh, I think.. I don't get it. Can you provide more details about it?

I thought the lifetime of Literal didn't have to be longer than self.

But it doesn't actually work.

pub fn add(&self, other: &Literal) -> Result<Literal> {
 ..
}

@panarch panarch merged commit 69211eb into main Mar 12, 2022
@panarch panarch deleted the simplify-lifetime-uses-in-literal-binary-op branch March 12, 2022 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants