Uh oh!
There was an error while loading. Please reload this page.
cleanups and fixes for #[derive] - #32139
Conversation
durka
commented
Mar 9, 2016
High five? No high five? ✋ 😿 |
bors
commented
Mar 9, 2016
☔ The latest upstream changes (presumably #32009) made this pull request unmergeable. Please resolve the merge conflicts. |
durka
commented
Mar 9, 2016
The failing test is here and I don't really know how to interpret it. I guess the |
bluss
commented
Mar 9, 2016
I think that issue (#24047) should not be worked around in derive but it may be fixed directly instead. |
durka
commented
Mar 9, 2016
I can back out that commit and leave it for later. On Tue, Mar 8, 2016 at 10:59 PM, bluss notifications@github.com wrote:
|
There was a problem hiding this comment.
In the past we've had subtle bugs where fields didn't actually implement some trait you were deriving but it worked anyway, so I'm curious why the extra & is needed here? In theory that should all happen automatically, right?
There was a problem hiding this comment.
Hm I'm somewhat confused, each of those lines works independently? Perhaps this is a case where UFCS should be used?
There was a problem hiding this comment.
Yeah maybe we should use UFCS in the derive expansion, but there's a deeper issue (which is why @bluss suggested not working around it here)... line 17 should be exactly the same as line 19, right?
There was a problem hiding this comment.
Perhaps yeah? I'm not too familiar with auto-ref and how that works
alexcrichton
commented
Mar 9, 2016
Wait this is an issue that can be fixed? |
alexcrichton
commented
Mar 9, 2016
Oh then I keep reading and realize it's |
bluss
commented
Mar 9, 2016
Yes it can be fixed. The code snippet I showed in that issue is a bug that's independent of derive itself. |
durka
commented
Mar 10, 2016
OK I addressed the comments and removed the two commits related to #24047 (don't worry I still have them in another branch!). Let's see if it builds! |
| #![feature(rand, collections, rustc_private)] | ||
| #![no_std] | ||
| // no-prefer-dynamic |
There was a problem hiding this comment.
For the record I have no idea what this does, but without it it asks for the lang items (even though this is supposed to be a lib).
There was a problem hiding this comment.
Yeah building a dylib requires lang items to be resolved, but as an rlib (what no-prefer-dynamic asks for) means that they can stay dangling.
There was a problem hiding this comment.
It already says #![crate_type = "rlib"] though.
There was a problem hiding this comment.
Yeah but that's ignored as --crate-type dylib is passed on the command line
There was a problem hiding this comment.
Got it. I'll take that out.
There was a problem hiding this comment.
Actually #![crate_type = "rlib"]and// no-prefer-dynamic are required for it not to try and resolve the lang items.
3831056 to
47900e6CompareThere was a problem hiding this comment.
I feel like this may want to continue to have a FIXME for doing something "more correct" here, this seems like it's still kinda a hack to get the job done?
There was a problem hiding this comment.
It's a hack yes (but a better one than before IMO). I'll add a FIXME.
alexcrichton
commented
Mar 10, 2016
Thanks @durka! Just a comment to be added I think but other than that looks good to me. |
durka
commented
Mar 10, 2016
Added the FIXME comment. |
durka
commented
Mar 10, 2016
alexcrichton
commented
Mar 11, 2016
cleanups and fixes for #[derive] This contains a bunch of little cleanups and fixes to `#[derive]`. There are more extensive comments on each individual commit. - hygiene cleanups - use `discriminant_value` instead of variant index in `#[derive(Hash)]` - ~~don't move out of borrowed content in `#[derive(PartialOrd, PartialEq)]`~~ - use `intrinsics::unreachable()` instead of `unreachable!()` I don't believe there are any breaking changes in here, but I do want some more eyes on that. Fixes#2810 (!), I believe (we still assume that "std" or "core" is the standard library but so does the rest of rustc...). Fixes#21714 (cc @apasel422). ~~Fixes~~ (postponed) #24047 (cc @withoutboats@bluss). Fixes#31714 (cc @alexcrichton@bluss). Fixes#31886 (cc @oli-obk).
bors
commented
Mar 13, 2016
💔 Test failed - auto-mac-32-opt |
alexcrichton
commented
Mar 13, 2016
@bors: retry On Sun, Mar 13, 2016 at 12:24 PM, bors notifications@github.com wrote:
|
bors
commented
Mar 13, 2016
⌛ Testing commit a037073 with merge fb9b646... |
alexcrichton
commented
Mar 13, 2016
@bors: retry force |
bors
commented
Mar 13, 2016
⌛ Testing commit a037073 with merge afacbfd... |
bors
commented
Mar 13, 2016
💔 Test failed - auto-mac-32-opt |
durka
commented
Mar 14, 2016
Okay what the heck is going on. |
eddyb
commented
Mar 14, 2016
@bors retry |
bors
commented
Mar 14, 2016
⌛ Testing commit a037073 with merge 97339bc... |
bors
commented
Mar 14, 2016
💔 Test failed - auto-mac-32-opt |
durka
commented
Mar 14, 2016
This is starting to seem legitimate just by repetition! I'm thinking I
|
alexcrichton
commented
Mar 14, 2016
Something seems to be getting oddly mixed up as it's referencing stage1 dylibs? Probably couldn't hurt to break apart though I guess? |
derive: use intrinsics::unreachable over unreachable!() derive: use intrinsics::unreachable over unreachable!() Fixes#31574. Spawned from #32139. r? @alexcrichton
derive: clean up hygiene derive: clean up hygiene Fixes#2810. Spawned from #32139. r? @alexcrichton
derive: assume enum repr defaults to isize derive: assume enum repr defaults to isize Fixes#31886. Spawned from #32139. r? @alexcrichton
derive: use discriminant_value in #[derive(Hash)] derive: use discriminant_value in #[derive(Hash)] Fixes#21714. Spawned from #32139. r? @alexcrichton
derive: use discriminant_value in #[derive(Hash)] derive: use discriminant_value in #[derive(Hash)] Fixes#21714. Spawned from #32139. r? @alexcrichton
derive: use discriminant_value in #[derive(Hash)] derive: use discriminant_value in #[derive(Hash)] Fixesrust-lang#21714. Spawned from rust-lang#32139. r? @alexcrichton
This contains a bunch of little cleanups and fixes to
#[derive]. There are more extensive comments on each individual commit.discriminant_valueinstead of variant index in#[derive(Hash)]don't move out of borrowed content in#[derive(PartialOrd, PartialEq)]intrinsics::unreachable()instead ofunreachable!()I don't believe there are any breaking changes in here, but I do want some more eyes on that.
Fixes#2810 (!), I believe (we still assume that "std" or "core" is the standard library but so does the rest of rustc...).
Fixes#21714 (cc @apasel422).
Fixes(postponed) #24047 (cc @withoutboats@bluss).Fixes#31714 (cc @alexcrichton@bluss).
Fixes#31886 (cc @oli-obk).