Skip to content

Commit 8143bd8

Browse files
committed
feedback
1 parent aa44f3d commit 8143bd8

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

_posts/2018-02-15-Rust-1.24.md

+17-19
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,45 @@ This release contains two very exciting new features: `rustfmt` and incremental
2929

3030
For years now, we've wanted a tool that automatically can reformat your Rust code to some sort
3131
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:
3333

3434
```bash
3535
$ rustup component add rustfmt-preview
3636
```
3737

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`.
4544

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.
5447

5548
For more, please check out [`rustfmt` on GitHub](https://github.com/rust-lang-nursery/rustfmt).
5649

5750
#### Incremental compilation
5851

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).
6053
While that post goes into the details, the idea is basically this: when you're working on
6154
a project, you often compile it, then change something small, then compile again. Historically,
6255
the compiler has compiled your *entire* project, no matter how little you've changed the code.
6356
The idea with incremental compilation is that you only need to compile the code you've actually
6457
changed, which means that that second build is faster.
6558

6659
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.
6862

6963
This is still not the end story for compiler performance generally, nor incremental compilation
7064
specifically. We have a lot more work planned in the future. For example, another change
7165
related to performance hit stable this release:
7266
[`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+
7371
More to come!
7472

7573
#### Other good stuff
@@ -95,7 +93,7 @@ See the [detailed release notes][notes] for more.
9593

9694
### Library stabilizations
9795

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
9997
happy to see this pull request: [it's now 10x faster](https://github.com/rust-lang/rust/pull/46735)!
10098
This is thanks to `memchr`. `[u8]::contains` [uses it too](https://github.com/rust-lang/rust/pull/46713),
10199
though it doesn't get such an extreme speedup.

0 commit comments

Comments
 (0)