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

Regression in #[derive(Eq)] on type with non-Eq members. #36830

Closed
rphmeier opened this issue Sep 29, 2016 · 13 comments
Closed

Regression in #[derive(Eq)] on type with non-Eq members. #36830

rphmeier opened this issue Sep 29, 2016 · 13 comments
Assignees
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@rphmeier
Copy link
Contributor

Playground: https://play.rust-lang.org/?gist=ca6a481e640668153d66259c0ef1dde6&version=stable&backtrace=0

#[derive(Eq)]
pub struct Signature([u8; 65]);

impl PartialEq for Signature {
    fn eq(&self, other: &Self) -> bool {
        &self.0[..] == &other.0[..]
    }
}

fn main() { }

Succeeds on rustc 1.11.0 (9b21dcd6a 2016-08-15), but fails on rustc 1.13.0-beta.1 (cbbeba430 2016-09-28)

Seems to be related to std::cmp::AssertParamIsEq.

@TimNN TimNN added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Sep 29, 2016
@bluss
Copy link
Member

bluss commented Sep 29, 2016

Caused by #36384

@bluss
Copy link
Member

bluss commented Sep 29, 2016

Explanation: previous ".assert_param_is_eq" used method resolution, finding slice methods on arrays. New code only looks at the type itself (the array).

cc @petrochenkov

@petrochenkov
Copy link
Contributor

Theoretically, this is a bugfix, because the previous implementation didn't enforced the bounds properly.
However, I'm not sure if these restrictions on deriving Eq are necessary at all.

@bluss
Copy link
Member

bluss commented Sep 29, 2016

Without this road block, there would be many more Eq implementations on structs with floats in them.

@durka
Copy link
Contributor

durka commented Sep 29, 2016

Should maybe crater #36384 to see the "bugfix" impact.

@alexcrichton alexcrichton added I-nominated T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Sep 29, 2016
@alexcrichton
Copy link
Member

Discussed during libs triage, conclusion was that we're likely to let this slide (as it's a bug fix) but we'll wait for the next crater build to ensure that no massive impact is seen.

@alexcrichton
Copy link
Member

Ok, ran crater, there are two regressions related to this

I believe the latter is yours, right @rphmeier? The former presumably hasn't been reported yet.

@alexcrichton
Copy link
Member

adding back the nominated tag to discuss again.

@rphmeier
Copy link
Contributor Author

rphmeier commented Oct 7, 2016

@alexcrichton right, I haven't published the fix to crates.io yet though.

@alexcrichton
Copy link
Member

Ok, the libs team discussed this today and the conclusion was that we can just send PRs to fix these issues.

@rphmeier to clarify have you got this fixed locally? If you need any help I can send a PR!

@alexcrichton
Copy link
Member

@bluss holy cow thanks so much for sending a PR to fix xor_name!

@rphmeier
Copy link
Contributor Author

@alexcrichton Yep, fixed in the repo, just haven't pushed the fix to crates.io yet. I'll try and do it tomorrow.

@alexcrichton
Copy link
Member

Ok, in that case I'm going to close this, thanks for the update though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants