Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/Rust-1.15.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn main() {

This will output:

```text
```
serialized = {"name":"Ferris"}
deserialized = Pet { name: "Ferris" }
```
Expand Down
6 changes: 3 additions & 3 deletions content/Rust-1.16.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ What does it do? Let's take a step back and talk about how `rustc` compiles your
to producing the final binary. You can see each of these steps (and how much time and memory they take)
by passing `-Z time-passes` to a nightly compiler:

```text
```
rustc +nightly hello.rs -Z time-passes
time: 0.003; rss: 16MB parsing
time: 0.000; rss: 16MB recursion limit
Expand Down Expand Up @@ -195,7 +195,7 @@ println!("{}", ffo);

Would give this error:

```text
```
error[E0425]: cannot find value `ffo` in this scope
--> foo.rs:4:20
|
Expand Down Expand Up @@ -277,7 +277,7 @@ When slicing a `&str`, [you'll see better errors]. For example, this code:

Is incorrect. It generates this error:

```text
```
thread 'str::test_slice_fail_boundary_1' panicked at 'byte index 4 is not
a char boundary; it is inside 'α' (bytes 3..5) of `abcαβγ`'
```
Expand Down
4 changes: 2 additions & 2 deletions content/Rust-1.17.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ your preferences.
Backtraces [now have nicer formatting](https://github.com/rust-lang/rust/pull/38165), eliding
some things by default. For example, the full backtrace:

```text
```
thread 'main' panicked at 'explicit panic', foo.rs:2
stack backtrace:
1: 0x55c39a23372c - std::sys::imp::backtrace::tracing::imp::write::hf33ae72d0baa11ed
Expand All @@ -261,7 +261,7 @@ stack backtrace:

is now instead

```text
```
thread 'main' panicked at 'explicit panic', foo.rs:2
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
Expand Down
6 changes: 3 additions & 3 deletions content/Rust-1.20.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Stability is a property of sorting algorithms that may or may not matter to you,
but now you have both options! Here's a brief summary: imagine we had a list
of words like this:

```text
```
rust
crate
package
Expand All @@ -196,7 +196,7 @@ cargo
Two of these words, `cargo` and `crate`, both start with the letter `c`. A stable
sort that sorts only on the first letter must produce this result:

```text
```
crate
cargo
package
Expand All @@ -207,7 +207,7 @@ That is, because `crate` came before `cargo` in the original list, it must also
before it in the final list. An unstable sort could provide that result, but could
also give this answer too:

```text
```
cargo
crate
package
Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.21.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn main() {

In previous versions of Rust, this would fail to compile:

```text
```
error[E0597]: borrowed value does not live long enough
--> src/main.rs:4:14
|
Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.26.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ component, but this should be a one-time problem.
This was unfortunately fixed too late to make it into 1.26 stable, so we added
the patch for 1.26.1 to permit users to install Rust on these platforms.

```console
```
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-freebsd'
info: latest update on 2018-05-10, rust version 1.26.0 (a77568041 2018-05-07)
Expand Down
8 changes: 4 additions & 4 deletions content/Rust-1.26.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ fn foo() {

when compiled, gives this error:

```text
```
error[E0308]: mismatched types
--> src/main.rs:5:5
|
Expand Down Expand Up @@ -241,7 +241,7 @@ fn hello(arg: &Option<String>) {

If you tried to compile this in Rust 1.25, you'd get this error:

```text
```
error[E0658]: non-reference pattern used to match a reference (see issue #42640)
--> src/main.rs:6:9
|
Expand All @@ -268,7 +268,7 @@ fn hello(arg: &Option<String>) {

We added the `&`s the compiler complained about. Let's try to compile again:

```text
```
error[E0507]: cannot move out of borrowed content
--> src/main.rs:6:9
|
Expand Down Expand Up @@ -421,7 +421,7 @@ fn main() {
What does this program do? The answer: nothing. The warning we get when
compiling has a hint:

```text
```
warning: literal out of range for u8
--> src/main.rs:6:17
|
Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.27.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systems programming language focused on safety, speed, and concurrency.
If you have a previous version of Rust installed via rustup, getting Rust
1.27.1 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.29.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systems programming language focused on safety, speed, and concurrency.
If you have a previous version of Rust installed via rustup, getting Rust
1.29.1 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.29.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systems programming language focused on safety, speed, and concurrency.
If you have a previous version of Rust installed via rustup, getting Rust
1.29.2 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
8 changes: 4 additions & 4 deletions content/Rust-1.29.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn main() {
Here, we're calling `do_something` a hundred times. But we never use the variable `i`.
And so Rust warns:

```console
```
$ cargo build
Compiling myprogram v0.1.0 (file:///path/to/myprogram)
warning: unused variable: `i`
Expand All @@ -71,7 +71,7 @@ warning: unused variable: `i`
See how it suggests that we use `_i` as a name instead? We can automatically
apply that suggestion with `cargo fix`:

```console
```
$ cargo fix
Checking myprogram v0.1.0 (file:///C:/Users/steve/tmp/fix)
Fixing src\main.rs (1 fix)
Expand Down Expand Up @@ -122,13 +122,13 @@ a reference is a no-op, and so this is almost certainly a bug.

We can get the preview of Clippy from Rustup:

```console
```
$ rustup component add clippy-preview
```

and then run it:

```console
```
$ cargo clippy
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
--> src\main.rs:5:5
Expand Down
4 changes: 2 additions & 2 deletions content/Rust-1.30.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ struct Demo {

used to give this error:

```text
```
error[E0277]: the trait bound `std::thread::Thread: _IMPL_SERIALIZE_FOR_Demo::_serde::Serialize` is not satisfied
--> src/main.rs:3:10
|
Expand All @@ -173,7 +173,7 @@ error[E0277]: the trait bound `std::thread::Thread: _IMPL_SERIALIZE_FOR_Demo::_s

Now it will give this one:

```text
```
error[E0277]: the trait bound `std::thread::Thread: serde::Serialize` is not satisfied
--> src/main.rs:7:5
|
Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.30.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systems programming language focused on safety, speed, and concurrency.
If you have a previous version of Rust installed via rustup, getting Rust
1.30.1 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
8 changes: 4 additions & 4 deletions content/Rust-1.31-and-rust-2018.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ We'll be covering all of this and more in this post.

Let's create a new project with Cargo:

```console
```
$ cargo new foo
```

Expand Down Expand Up @@ -131,7 +131,7 @@ fn main() {

In older Rust, this is a compile-time error:

```text
```
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> src/main.rs:5:18
|
Expand Down Expand Up @@ -164,7 +164,7 @@ fn main() {

Older Rust will give you this error:

```text
```
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> src/main.rs:5:18
|
Expand All @@ -179,7 +179,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta

With Rust 2018, this error changes for the better:

```text
```
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> src/main.rs:5:13
|
Expand Down
6 changes: 3 additions & 3 deletions content/Rust-1.31.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systems programming language focused on safety, speed, and concurrency.
If you have a previous version of Rust installed via rustup, getting Rust
1.31.1 is as easy as:

```console
```
$ rustup update stable
```

Expand Down Expand Up @@ -46,12 +46,12 @@ pub struct MyStruct { /* ... */ }
[Go to definition was fixed for std types](https://github.com/rust-lang/rls/pull/1171):
Before, using the RLS on `HashMap`, for example, tried to open this file

```text
```
~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/libstd/collections/hash/map.rs
```

and now RLS goes to the correct location (for Rust 1.31, note the extra `src`):

```text
```
~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/collections/hash/map.rs
```
8 changes: 4 additions & 4 deletions content/Rust-1.32.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ efficient software.
If you have a previous version of Rust installed via rustup, getting Rust
1.32.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down Expand Up @@ -67,7 +67,7 @@ fn main() {

If you run this program, you'll see:

```text
```
[src/main.rs:4] x = 5
```

Expand Down Expand Up @@ -111,7 +111,7 @@ fn factorial(n: u32) -> u32 {
We want to log `n` on each iteration, as well as have some kind of context
for each of the branches. We see this output for `factorial(4)`:

```text
```
n: 4
n: 3
n: 2
Expand Down Expand Up @@ -141,7 +141,7 @@ fn factorial(n: u32) -> u32 {
We simply wrap each of the various expressions we want to print with the macro. We
get this output instead:

```text
```
[src/main.rs:3] n <= 1 = false
[src/main.rs:3] n <= 1 = false
[src/main.rs:3] n <= 1 = false
Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.33.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ efficient software.
If you have a previous version of Rust installed via rustup, getting Rust
1.33.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.34.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ efficient software.
If you have a previous version of Rust installed via rustup, getting Rust
1.34.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.34.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Rust is a programming language that is empowering everyone to build reliable and
If you have a previous version of Rust installed via rustup,
getting Rust 1.34.1 and rustup 1.18.1 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.34.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ efficient software.
If you have a previous version of Rust installed via rustup, getting Rust
1.34.2 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.35.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ programming language that is empowering everyone to build reliable and efficient

If you have a previous version of Rust installed via rustup, getting Rust 1.35.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.36.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Rust is a programming language that is empowering everyone to build reliable and

If you have a previous version of Rust installed via rustup, getting Rust 1.36.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
2 changes: 1 addition & 1 deletion content/Rust-1.37.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Rust team is happy to announce a new version of Rust, 1.37.0. Rust is a prog

If you have a previous version of Rust installed via rustup, getting Rust 1.37.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down
4 changes: 2 additions & 2 deletions content/Rust-1.38.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Rust team is happy to announce a new version of Rust, 1.38.0. Rust is a prog

If you have a previous version of Rust installed via rustup, getting Rust 1.38.0 is as easy as:

```console
```
$ rustup update stable
```

Expand Down Expand Up @@ -80,7 +80,7 @@ fn main() {

This prints:

```text
```
Initializing an instance of i32
Initializing an instance of alloc::string::String
```
Expand Down
Loading