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

Array equality for &dyn Array (#3880) #3899

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arrow-array/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,13 @@ pub trait ArrayAccessor: Array {
unsafe fn value_unchecked(&self, index: usize) -> Self::Item;
}

impl PartialEq for dyn Array {
impl PartialEq for dyn Array + '_ {
Copy link
Contributor Author

@tustvold tustvold Mar 21, 2023

Choose a reason for hiding this comment

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

This is the major "fix", previously this had an implicit 'static lifetime for dyn Array, which would then result in incredibly opaque compilation errors if you actually tried to use this

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't even understand what this means -- "any lifeime"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's documented here - https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes

I was aware it applied to things like Box<dyn Foo> but hadn't occurred to me that dyn Foo on its own also has an implicit 'static

fn eq(&self, other: &Self) -> bool {
self.data().eq(other.data())
}
}

impl<T: Array> PartialEq<T> for dyn Array {
impl<T: Array> PartialEq<T> for dyn Array + '_ {
fn eq(&self, other: &T) -> bool {
self.data().eq(other.data())
}
Expand Down
Loading