Rust 2018: an early preview

I have a few comments regarding the new edition:

  • never_type: what happened to this feature? I remember that it was being stabilized and then got pulled out / reverted at the last moment due to some regressions for a few crates. I have not seen any news about it since then. I think this is a very important feature for the language and one I am personally looking forward to. I tried going through the relevant github issues/PRs about it to see if there has been any update since it was reverted (any plans to resolve the issues and stabilize it?), but did not find anything. What’s the plan/status?

    • Since the only problem with this feature (at least in my understanding) seems to be that it breaks a few crates, making it backwards-incompatible, perhaps it could just be enabled for the new Rust2018 edition only? People are going to have to fix breaking changes when they decide to opt into the new edition anyway.
  • Please require the bang for macro imports / use statements, to make a clear distinction from other language items. use some_crate::thing; should import a function or type by the name thing, not a macro. use some_crate::thing!; should import a macro, not a language item. I feel that macros are sufficiently different from other parts of the language that such a distinction is important. It makes everything much clearer.

  • I prefer pub(crate) over crate as a visibility specifier. I think it is much clearer and less confusing. Also, I don’t remember seeing discussion about this. This feels like yet another change being added to the language without sufficient discussion. I have a feeling that this might lead to controversy similar to what happened after impl Trait in argument position was stabilized and people felt like they had no say.

    • There is a nice consistency about pub being the single keyword used to expand the visibility of things beyond private. It also has the benefit of making things more greppable / easier to search. Right now, you can just search for pub to find any non-private items.
  • I also personally dislike in-band lifetimes and lifetime elision. I think it makes the readability of the code worse, as it is more difficult to see where lifetimes come from / where they are defined. I like the current explicitness.

  • dyn Trait: apparently using the old bare Trait syntax will only be a warning in the new edition, not an error? I understand that this is widely-used syntax and will require lots of changes to lots of crates, but it seems like something trivially automatable (with e.g rustfix). I’d have liked to see a single consistent syntax being enforced.

Other than my critcisms above, I love pretty much all the other changes with the new edition. Rust definitely feels like it is becoming even better. Big thanks to everyone involved for your work!

4 Likes