3 ms·
> But that means my code is stuck on Rust 2015. ...can't you upgrade and choose not to make that change? Did something happen to make that not compile? (not
by Izkata 7y ago
> But that means my code is stuck on Rust 2015.
...can't you upgrade and choose not to make that change? Did something happen to make that not compile?
(not a Rust user)
- boardwaalk 7y agoIt looks like they might need to use "r#try!(...)" in Rust 2018 (a trivial search replace, 'cargo fix' might do it too, not sure), but the macro is still available: https://doc.rust-lang.org/stable/std/macro.try.html https://doc.rust-lang.org/stable/std/macro.try.html It's trivial to implement yourself, too (if you, for example, wanted to give it a non-reserved name).
- davidcuddeback 7y agoThanks. Didn't know about the raw identifier syntax. That's kinda ugly, so I'd probably still go with copying it to all of my projects and giving it a new name if I were to update to Rust 2018.
- alvarelle 7y agoOn the other hand, you could argue that the r# gives you "more prominence" which is exactly the stated goal of using that macro.
- davidcuddeback 7y ago> Did something happen to make that not compile? `try` became a reserved keyword in Rust 2018 and the `try!()` macro was dropped (edit: not dropped, see @boardwaalk's comment). I could copy the old macro to all of my code bases and give it a new name. The two things stopping me from doing that are (1) I don't have any reason to update to Rust 2018, and (2) I can't think of a good name for a replacement macro. I'm thinking `check!()`, but not sold on the name. > (not a Rust user) One thing to know about Rust 2015 vs 2018 vs future "editions" is that they're a distinct versioning mechanism from Rust 1.23, 1.24, etc. The latest version of the Rust compiler still supports Rust 2015 and I believe it's been promised to be supported in perpetuity. So it's not like I run a risk of being without a Rust 2015 compiler available.
- gpm 7y agoJust to expand on the editions things, editions are local to the crate. A Rust 2015 crate can freely use a Rust 2018 crate and the reverse. So davidcuddeback isn't being locked out of using up to date dependencies either.
- majewsky 7y ago> I can't think of a good name for a replacement macro What about do_or_do_not!(). After all, there is no try!(). ;)
- davidcuddeback 7y agoHeh. That's the argument that was made against using Rails' `try()` method at my last place of work. Made me laugh. Thanks. :)