diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
commit | 837b550238aa671a591ccf282dddeab29cadb206 (patch) | |
tree | 914b6b8862bace72bd3245ca184d374b08d8a672 /src/doc/rust-by-example | |
parent | Adding debian version 1.70.0+dfsg2-1. (diff) | |
download | rustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz rustc-837b550238aa671a591ccf282dddeab29cadb206.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')
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]); } ``` |