-
Notifications
You must be signed in to change notification settings - Fork 59
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
Support building multihash with no hashes enabled. #94
Conversation
Is that PR still needed? Is this about that you need to specify a hasher if you use the |
Yes there is. The user can select the hashes later, but we don't want to prescribe any in libipld |
I think I got it now. So users could just use e.g. the |
The default params sets the hashes enum to the multihash code, that's a problem if it doesn't exist |
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 still don't fully get the problem that is solved here, but the fix looks sensible. I'll look at it tomorrow again, but I also don't want to block @dvc94ch, hence merging.
Thanks |
IMO this is kind of an unfortunate fix --- you're effectively turning a static errors into dynamic errors. An "empty" enum like Would you mind pasting the build error without this? |
It is not a dynamic error, it is indeed |
The If you deref self, the empty case works: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=04dac198be4a65584265aa38b1399127 |
I guess do that, and change the match arm patterns to use |
I'm on it. Any other recommendations? |
@Ericson2314 thanks for chiming in. I was also under the impression that it will steal lead to compile time errors. |
Thanks!
Heh yes it's all quite subtle, but from following rust-lang/rust#57012 's incredibly long saga has beaten these things into my head. :) |
@dvc94ch any news? I'm thinking about reverting this one again and doing a new release. I also still don't fully understand the problem in relation to rust-ipld. What wouldn't work if this PR would be reverted, can you provide a example? Perhaps we can find a way to fix the problem from the rust-ipld side. |
Are you kidding me? What's with the bike shedding. I really wonder sometimes where these random people on the internet come from that have nothing better to do. Since rust actually is not smart enough to determine that it is dead code, there is a begin_unwind with a string in the mir code. In release mode llvm takes care of it. In debug mode you have a string with the panic message, increasing your code size by a couple of bytes. However if you used unimplemented anywhere in your code you already have that message in your binary. |
This is not about bike shedding. I clearly indicated that I'm not sure about this change, but I trust you enough that it is a sensible change, so I went ahead merged and released. Then another person (@Ericson2314) chimes in and raises concerns about this change (which I think is great, I like to get feedback from others). @dvc94ch replies with:
Which I read as "I look into this, I'll provide an update with my findings". I haven't seen an update and as I still haven't looked closely into it, hence I was asking if @dvc94ch could perhaps provide an example why this change is exactly needed. This way I would then be able whether this code base is better with or without that change. Now that I had a closer look, I'm not sure about this change. To me it looks like it's changing something I had there intentionally. To me the usual user should just use the default features and things work. If you are a power user, you should know what you're doing. Hence prior to this change no @dvc94ch so is this change exactly about that? That you want to have the |
I forgot to add that it might be totally fine to export an empty |
Cargo features are additive. That means it will based on the dependency graph create a union of features that need to be enabled. libipld doesn't care about which specific hashes are enabled, and depending on multihash without |
@dvc94ch Please chose your words more wisely. Such comments are unacceptable. This is a welcoming project, where people are free to have different opinions and priorities. |
@dvc94ch Thanks for the explanation. Though wouldn't it make sense if IPLD would use |
But it's ok for random people to tell other people what to do? He is welcome to open his own PR. This work was paid for, meaning I was on the clock. No time to spend hours thinking about what is to many people completely irrelevant stuff.
Maybe, PR's welcome. |
It is not. I have to admit that when I first read @Ericson2314 comment I read it as ""hey, that's a simple fix that might solve the problem I'm seeing". I didn't read it as a request, but I can see now that it could be read as such. |
Coming back to the original point from @Ericson2314. I read it as "there will be runtime rather than compile time errors", but that's not the case, right? |
There is no way that it can ever panic in practice (as in I did not introduce a bug). You can argue about if one solution is mildly better than the other. |
@vmx please merge and release 0.13.2, this is blocking a new libipld release