-
Notifications
You must be signed in to change notification settings - Fork 294
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
Update to edition 2018 #565
Conversation
Update mdbook to 0.3.5 Command: sed -i '/extern crate/ {N;s/\n$//}' src/**.md; sed -i 's/extern crate error_chain;/use error_chain::error_chain;/; s/extern crate lazy_static;/use lazy_static::lazy_static;/; s/extern crate bitflags;/use bitflags::bitflags;/; s/extern crate serde_json;/ use serde_json::json;/; s/extern crate serde_derive;/use serde::{Serialize, Deserialize};/; /macro_use/d; /extern crate/ d; s/```rust/```rust,edition2018/; s/bail!/error_chain::&/; s/\(debug\|info\|warn\|error\)!/log::&/;' src/**.md Fix rust-lang-nursery#530
@AndyGauge Interested to review? |
Yeah, I was reading it and I'm impressed. One thing I'm concerned about is if there are any |
duh, there's crate badges right above the recipes. That should be instructive enough. I've peeked at it and from 30000 ft it looks good. |
@AndyGauge I think the notable changes are |
@AndyGauge What should I do next for this? |
I'm going to try and get it compiled and uploaded to review it in book format next. |
OK, I've published it here http://www.yetanother.site/rust-cookbook/ and am reviewing |
OK, so I'm now seeing new errors... it looks like error-chain does not like its result type being ignored. error[E0107]: wrong number of type arguments: expected 2, found 1 |
Result is a type that is defined from the error-chain! macro, I'm not sure yet why this is happening. When I tested creating a new program from http://www.yetanother.site/rust-cookbook/compression/tar.html#decompress-a-tarball-while-removing-a-prefix-from-the-paths it compiled without errors. |
In order to make Travis useful, I had to fix #569 to figure out what errors are caused by this change. |
OK, here's the problem.
|
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.
Is this fix supposed to be in the 2018 edition branch? saw the comment too late.
By the way, is error_chain
still valid for 2018 edition? Isn't something like anyhow
suits better now?
It is really hard to come up with consensus on error handling. I'm biased, because I maintain error-chain (picked up both projects after Brian left Mozilla). I think I would use |
@AndyGauge What should I do for this pull request? |
We've discovered a major pain point using I doubt I will be working on this error-chain change immediately, but I think that would be a good solution. If you would rather rewrite the error handling story of the cookbook let me know if you have that capacity. |
Interestingly I discovered that error-chain 0.12 included the 2018 fix. cargo downloads both error-chain 0.11 and 0.12, and incorrectly was using the 0.11 version. I feel like this is a skeptic problem. I just recompiled this branch with rustc 1.45-nightly and had every single test fail. |
version 4 depends on error-chain v 0.11 and version 5 depends on v 0.12 !!!!
OK, let's party like its 2018! |
Yes, I could rewrite the rust error handling story to use anyhow or thiserror. Also, I would like change the global data story to use once_cell. But I may not have time recently but should have some time to work this out in few weeks. |
Turns out error chain was updated and the problem was with the dependency
graph. At this time we shouldnt rewrite the error handling. Thanks!
…On Sun, May 31, 2020, 6:26 PM Ivan Tham ***@***.***> wrote:
I doubt I will be working on this error-chain change immediately, but I
think that would be a good solution. If you would rather rewrite the error
handling story of the cookbook let me know if you have that capacity.
Yes, I could rewrite the rust error handling story to use anyhow or
thiserror.
Also, I would like change the global data story to use once_cell.
But I may not have time recently but should have some time to work this
out in few weeks.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#565 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRZBXXCHJJNUCSL5ENULS3RUL7VZANCNFSM4J43T6RA>
.
|
How about lazy_static? once_cell looks like a better alternative without using macro. https://docs.rs/once_cell/1.4.0/once_cell/#faq |
Funny story. @matklad was helping me with a pre-rfc when once_cell was born. https://internals.rust-lang.org/t/pre-rfc-lazy-static-move-to-std/7993/36 <https://internals.rust-lang.org/t/pre-rfc-lazy-static-move-to-std/7993/36>
I’m fine with a recipe on it. How about highlighting the regex use case? I know @burtsushi describes that as a big part of using either of these, and creating a regex is a good introductory problem. Like https://docs.rs/once_cell/1.4.0/once_cell/#building-block <https://docs.rs/once_cell/1.4.0/once_cell/#building-block> without creating a macro?
Andrew
… On May 31, 2020, at 8:23 PM, Ivan Tham ***@***.***> wrote:
How about lazy_static? once_cell looks like a better alternative without using macro. https://docs.rs/once_cell/1.4.0/once_cell/#faq <https://docs.rs/once_cell/1.4.0/once_cell/#faq>
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub <#565 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABRZBXTPZJUYGA4XNFN5P2TRUMNMBANCNFSM4J43T6RA>.
|
https://docs.rs/once_cell/1.4.0/once_cell/#building-block is creating a macro itself and regex already uses |
Update mdbook to 0.3.5
Command:
sed -i '/extern crate/ {N;s/\n$//}' src/**.md; sed -i 's/extern crate error_chain;/use error_chain::error_chain;/; s/extern crate lazy_static;/use lazy_static::lazy_static;/; s/extern crate bitflags;/use bitflags::bitflags;/; s/extern crate serde_json;/ use serde_json::json;/; s/extern crate serde_derive;/use serde::{Serialize, Deserialize};/; /macro_use/d; /extern crate/ d; s/```rust/```rust,edition2018/; s/bail!/error_chain::&/; s/\(debug\|info\|warn\|error\)!/log::&/;' src/**.md
Fixes #530
Fixes #569