-
Notifications
You must be signed in to change notification settings - Fork 841
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
Conversation
@@ -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 + '_ { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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
8e60645
to
9d618fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the methodological, small sequence of PRs leading up to removing ArrayData 👍
@@ -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 + '_ { |
There was a problem hiding this comment.
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"?
let b = NullArray::new(12); | ||
let b = b.data(); | ||
test_equal(a, b, true); | ||
test_equal(&a, &b, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is certainly nicer
Which issue does this PR close?
Part of #3880
Rationale for this change
This is part of being able to move away from
Array::data
What changes are included in this PR?
Are there any user-facing changes?