@@ -29,47 +29,45 @@ This release contains two very exciting new features: `rustfmt` and incremental
29
29
30
30
For years now, we've wanted a tool that automatically can reformat your Rust code to some sort
31
31
of "standard style." With this release, we're happy to announce that a * preview* of ` rustfmt `
32
- can be used with 1.24 stable. Before we get into the details, here's how to install ` rustfmt ` :
32
+ can be used with 1.24 stable. To give it a try, do this :
33
33
34
34
``` bash
35
35
$ rustup component add rustfmt-preview
36
36
```
37
37
38
- Notably, you should * not* install ` rustfmt ` through ` cargo install ` . Why not? Well, ` rustfmt `
39
- relies on using the compiler as a library to do its job. As such, the exact right version of
40
- ` rustfmt ` for the exact compiler version you're using is critical, otherwise, it will not work.
41
- ` rustup ` knows what compiler version you're using, and so is able to pair it with the correct
42
- ` rustfmt ` version. Once you've added this component to a given toolchain, ` rustup ` will
43
- automatically update it as well. Run the command once, and then on every future
44
- ` rustup update stable ` , ` rustfmt-preview ` will be updated as well.
38
+ There are two important aspects here: first, you're using `rustup component
39
+ add` instead of ` cargo install` here. If you've previously used ` rustfmt` via
40
+ ` cargo install ` , you should uninstall it first. Second, this is a preview, as
41
+ it says in the name. ` rustfmt ` is not at 1.0 yet, and some stuff is being
42
+ tweaked, and bugs are being fixed. Once ` rustfmt ` hits 1.0, we'll be
43
+ releasing a ` rustfmt ` component and deprecating ` rustfmt-preview ` .
45
44
46
- > This strategy is expected to be used for other developer tools that integrate tightly with
47
- > the compiler, like the RLS and Clippy, in the future.
48
-
49
- Finally, please take note of that ` -preview ` in the name: ` rustfmt ` is still not quite
50
- at 1.0 yet. Some tweaks to the default styles are still occuring, though they're relatively
51
- minor. Once ` rustfmt ` hits 1.0, we'll be releasing a ` rustfmt ` component and
52
- deprecating ` rustfmt-preview ` . Since this is the first major component we're distributing
53
- this way, we wanted to clearly signal that it is still developing.
45
+ In the near future, we plan on writing a post about this release strategy, as it's big
46
+ enough for its own post, and is broader than just this release.
54
47
55
48
For more, please check out [ ` rustfmt ` on GitHub] ( https://github.com/rust-lang-nursery/rustfmt ) .
56
49
57
50
#### Incremental compilation
58
51
59
- Back in September, we blogged about [ Incremental Compilation] ( https://blog.rust-lang.org/2016/09/08/incremental.html ) .
52
+ Back in September of 2016 (!!!) , we blogged about [ Incremental Compilation] ( https://blog.rust-lang.org/2016/09/08/incremental.html ) .
60
53
While that post goes into the details, the idea is basically this: when you're working on
61
54
a project, you often compile it, then change something small, then compile again. Historically,
62
55
the compiler has compiled your * entire* project, no matter how little you've changed the code.
63
56
The idea with incremental compilation is that you only need to compile the code you've actually
64
57
changed, which means that that second build is faster.
65
58
66
59
As of Rust 1.24, this is now [ turned on by default] ( https://github.com/rust-lang/cargo/pull/4817 ) .
67
- This means that your builds should get faster!
60
+ This means that your builds should get faster! Don't forget about ` cargo check ` when trying
61
+ to get the lowest possible build times.
68
62
69
63
This is still not the end story for compiler performance generally, nor incremental compilation
70
64
specifically. We have a lot more work planned in the future. For example, another change
71
65
related to performance hit stable this release:
72
66
[ ` codegen-units ` is now set to 16 by default] ( https://github.com/rust-lang/rust/pull/46910 ) .
67
+ One small note about this change: it makes builds faster, but makes the final binary a bit
68
+ slower. For maximum speed, setting ` codegen-units ` to ` 1 ` in your ` Cargot.toml ` is needed
69
+ to eake out every last drop of performance.
70
+
73
71
More to come!
74
72
75
73
#### Other good stuff
@@ -95,7 +93,7 @@ See the [detailed release notes][notes] for more.
95
93
96
94
### Library stabilizations
97
95
98
- If you're a fan of ` str::find ` , used to find a given ` char ` inside of a ` &str ` , you'll be
96
+ If you're a fan of ` str::find ` , which is used to find a given ` char ` inside of a ` &str ` , you'll be
99
97
happy to see this pull request: [ it's now 10x faster] ( https://github.com/rust-lang/rust/pull/46735 ) !
100
98
This is thanks to ` memchr ` . ` [u8]::contains ` [ uses it too] ( https://github.com/rust-lang/rust/pull/46713 ) ,
101
99
though it doesn't get such an extreme speedup.
0 commit comments