summaryrefslogtreecommitdiffstats
path: root/src/doc/rust-by-example
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /src/doc/rust-by-example
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/doc/rust-by-example')
-rw-r--r--src/doc/rust-by-example/README.md10
-rw-r--r--src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md2
-rw-r--r--src/doc/rust-by-example/src/hello/print.md5
-rw-r--r--src/doc/rust-by-example/src/primitives/array.md4
4 files changed, 12 insertions, 9 deletions
diff --git a/src/doc/rust-by-example/README.md b/src/doc/rust-by-example/README.md
index 462f733e5..e43b044c8 100644
--- a/src/doc/rust-by-example/README.md
+++ b/src/doc/rust-by-example/README.md
@@ -15,11 +15,11 @@ to read it online.
If you'd like to read it locally, [install Rust], and then:
```bash
-$ git clone https://github.com/rust-lang/rust-by-example
-$ cd rust-by-example
-$ cargo install mdbook
-$ mdbook build
-$ mdbook serve
+git clone https://github.com/rust-lang/rust-by-example
+cd rust-by-example
+cargo install mdbook
+mdbook build
+mdbook serve
```
[install Rust]: https://www.rust-lang.org/tools/install
diff --git a/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md b/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md
index 61f80fc3e..998b741e7 100644
--- a/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md
+++ b/src/doc/rust-by-example/src/error/multiple_error_types/reenter_question_mark.md
@@ -5,7 +5,7 @@ Notice in the previous example that our immediate reaction to calling
error:
```rust,ignore
-.and_then(|s| s.parse::<i32>()
+.and_then(|s| s.parse::<i32>())
.map_err(|e| e.into())
```
diff --git a/src/doc/rust-by-example/src/hello/print.md b/src/doc/rust-by-example/src/hello/print.md
index d578337ad..bf23a9023 100644
--- a/src/doc/rust-by-example/src/hello/print.md
+++ b/src/doc/rust-by-example/src/hello/print.md
@@ -44,8 +44,9 @@ fn main() {
println!("{number:>5}", number=1);
// You can pad numbers with extra zeroes,
+ println!("{number:0>5}", number=1); // 00001
// and left-adjust by flipping the sign. This will output "10000".
- println!("{number:0<5}", number=1);
+ println!("{number:0<5}", number=1); // 10000
// You can use named arguments in the format specifier by appending a `$`.
println!("{number:0>width$}", number=1, width=5);
@@ -62,7 +63,7 @@ fn main() {
// This will not compile because `Structure` does not implement
// fmt::Display.
- //println!("This struct `{}` won't print...", Structure(3));
+ // println!("This struct `{}` won't print...", Structure(3));
// TODO ^ Try uncommenting this line
// For Rust 1.58 and above, you can directly capture the argument from a
diff --git a/src/doc/rust-by-example/src/primitives/array.md b/src/doc/rust-by-example/src/primitives/array.md
index 9cec24d69..5f5e69944 100644
--- a/src/doc/rust-by-example/src/primitives/array.md
+++ b/src/doc/rust-by-example/src/primitives/array.md
@@ -63,7 +63,9 @@ fn main() {
}
}
- // Out of bound indexing causes compile time error.
+ // Out of bound indexing on array causes compile time error.
//println!("{}", xs[5]);
+ // Out of bound indexing on slice causes runtime error.
+ //println!("{}", xs[..][5]);
}
```