diff options
| author | Josef Brandl <mail@josefbrandl.de> | 2017-02-28 11:28:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-28 11:28:54 +0100 |
| commit | 3c5001f0dd14c3d0afa539eaed9c9109de2aae59 (patch) | |
| tree | cd6f988c3b078210e6ed3036660950f12f4a7ece /src/doc/book | |
| parent | e1cb9ba221e5cb0070ac82c6a234af11e4240680 (diff) | |
| download | rust-3c5001f0dd14c3d0afa539eaed9c9109de2aae59.tar.gz rust-3c5001f0dd14c3d0afa539eaed9c9109de2aae59.zip | |
Unit-like structs doc: Improve code sample
Diffstat (limited to 'src/doc/book')
| -rw-r--r-- | src/doc/book/src/structs.md | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/doc/book/src/structs.md b/src/doc/book/src/structs.md index 6b2a145c85e..b5fe99d0486 100644 --- a/src/doc/book/src/structs.md +++ b/src/doc/book/src/structs.md @@ -259,9 +259,10 @@ You can define a `struct` with no members at all: struct Electron {} // Use empty braces... struct Proton; // ...or just a semicolon. -// Whether you declared the struct with braces or not, do the same when creating one. +// Use the same notation when creating an instance. let x = Electron {}; let y = Proton; +let z = Electron; // Error ``` Such a `struct` is called ‘unit-like’ because it resembles the empty |
