Skip to content

Commit b89915d

Browse files
committed
more
1 parent f78a6d3 commit b89915d

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

_posts/2018-03-29-Rust-1.25.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ appropriate page on our website, and check out the [detailed release notes for
2323

2424
## What's in 1.25.0 stable
2525

26-
Rust 1.25 contains a bunch of stuff! The first one is straightforward: we've
27-
[upgraded to LLVM 6] from LLVM 4. This has a number of effects, a major one
26+
The last few releases have been relatively minor, but Rust 1.25 contains a
27+
bunch of stuff! The first one is straightforward: we've [upgraded to LLVM 6]
28+
from LLVM 4. This has a number of effects, a major one
2829
being a step closer to AVR support.
2930

3031
A new way to write `use` statements has landed: [nested import groups]. If you've
@@ -56,7 +57,7 @@ use std::{
5657
This can reduce some repetition, and make things a bit more clear.
5758

5859
There are two big documentation changes in this release: first, [Rust By
59-
Example is now included on doc.rust-lang.org]! We'll be redirecing the old
60+
Example is now included on doc.rust-lang.org]! We'll be redirecting the old
6061
domain there shortly. We hope this will bring more attention to a great
6162
resource, and you'll get a local copy with your local documentation.
6263

@@ -97,15 +98,57 @@ See the [detailed release notes][notes] for more.
9798

9899
### Library stabilizations
99100

101+
The biggest story in libraries this release is [`std::ptr::NonNull<T>`]. This type
102+
is similar to `*mut T`, but is non-null and covariant. This blog post isn't the right
103+
place to explain variance, but in a nutshell, `NonNull<T>`, well, guarantees that it
104+
won't be null, which means that `Option<NonNull<T>>` is the same size as `Option<T>`.
105+
If you're building a data structure with unsafe code, `NonNull<T>` is often the right
106+
type for you!
100107

101-
Additionally, a few new APIs were stabilized this release:
108+
[`std::ptr::NonNull<T>`]: https://doc.rust-lang.org/std/ptr/struct.NonNull.html
102109

103-
* [] ()
110+
`libcore` has [gained a `time` module](https://doc.rust-lang.org/core/time/),
111+
containing the `Duration` type previously only available in `libstd`.
112+
113+
Additionally, the `new`, `from_secs`, `from_milis`, `from_micros`, and `from_nanos`
114+
functions associated with `Duration` were made `const fn`s, allowing them to be used
115+
to create a `Duration` as a constant expression.
104116

105117
See the [detailed release notes][notes] for more.
106118

107119
### Cargo features
108120

121+
Cargo's CLI has one really important change this release: `cargo new` will
122+
[now default](https://github.com/rust-lang/cargo/pull/5029) to generating a
123+
binary, rather than a library. We try to keep Cargo's CLI quite stable, but
124+
this change is important, and is unlikely to cause breakage.
125+
126+
For some background, `cargo new` accepts two flags: `--lib`, for creating libraries,
127+
and `--bin`, for creating binaries, or executables. If you don't pass one of these
128+
flags, in previous versions of Cargo, it would default to `--lib`. We made this
129+
decision because each binary (often) depends on many libraries, and so the library
130+
case is more common. However, this is incorrect; each library is *depended upon* by
131+
many binaries. Furthermore, when getting stated, what you often want is a program
132+
you can run and play around with. It's not just new Rustaceans though; even very
133+
long-time community members have said that they find this default surprising.
134+
As such, we're changing it.
135+
136+
Similarly, `cargo new` previously would be a bit opinionated around the names
137+
of packages it would create. Specifically, if your package began with `rust-`
138+
or ended with `-rs`, Cargo would rename it. The intention was that well,
139+
it's a Rust package, this information is redundant. However, people feel
140+
quite strongly about naming, and when they bump into this, they're surprised
141+
and often upset. As such, [we're not going to do that any
142+
more](https://github.com/rust-lang/cargo/pull/5013).
143+
144+
Many users love `cargo doc`, a way to generate local documentation for their
145+
Cargo projects. [It's getting a huge speed
146+
bump](https://github.com/rust-lang/cargo/pull/5013) in this release, as now,
147+
it uses `cargo check`, rather than a full `cargo build`.
148+
149+
Additionally, checkouts of git dependencies [should be a lot
150+
faster](https://github.com/rust-lang/cargo/pull/4919), thanks to the use of
151+
hard links where possible.
109152

110153
See the [detailed release notes][notes] for more.
111154

0 commit comments

Comments
 (0)