This beta of Rust 1.30 is a bit different than a normal beta: it has the feature flags for Rust 2018 turned on. This
means you can kick the tires, and let us know of any issues.
For more information about what you can do with Rust 2018 RC1, please see the Edition Guide.
Things that are stable in RC1 are marked as being available in beta, like non-lexical lifetimes!
Unfortunately, this beta release has a critical misfire around the module system, which prevents migration from working. We will be fixing this and producing a point release ASAP.
In the meantime, if you want to try out migration, you need to use nightly and add the following to your crate before running cargo fix --edition:
#![feature(rust_2018_preview)]
After you finish migration, you can remove the attribute.
The issue is this. The workflow for upgrading your codebase is supposed to be
> cargo +beta fix --edition
Run this until your code compiles with no warnings. Now, your code is valid Rust 2015 and Rust 2018. You should be able to add edition = "2018" to your Cargo.toml, and it will build. You may get new warnings, but it should build.
However, the above does not migrate use statements. This means that after running cargo fix, even once you have warnings, the cargo build after adding the edition key does not compile. This means that you'd have to modify all of your use statements by hand. You can do this, but on a project of non-trivial size, it can be difficult. That's not an accurate impression of what the final workflow should be.
Uniform paths are not part of the edition; what got stabilized is something forward compatible with them, but the decision to enable that has not yet been made.
Is the idea that once the migration has been done, we can get rid of that attribute?
I followed the steps here for my (small) projects, and they gave no errors. However, they do give warnings about this attribute when I try cargo +nightly build afterwards.
Okay, so I can get rid of that, right? That line gives warnings on nightly, but errors on beta. Sorry, all this is a bit confusing - I have just started reading the Edition Guide that you mentioned earlier.
Perfect! That’s exactly what I did now - one project had no errors, the other one had quite a few errors with use, but it was a simple text substitution fix, so no worries!
I see that macro namespaces still work differently for macros defined inside the current module vs dependencies.
I hoped that this would change for the final version but seeing this is still the case for the RC I assume this will stay the same?
This is a major usability/teachability issue in my opinion since now you have to learn both the old and the new system and remember that the old system only applies to your current crate.
Are there any plans to fix this in the near future?
But even then, the system would have to stay the same at least until the next edition.