From 4ac14d640b57a347b3e78f66604a8e62dead2903 Mon Sep 17 00:00:00 2001 From: Richard Woodbury Date: Sat, 22 Apr 2023 23:38:16 -0700 Subject: [PATCH] Update array.md The example says that out-of-bound indexing causes a runtime error, but 1) doesn't specify array or slice, then 2) proceeds to demonstrate with an array, which is a _compile_ error. Add both cases and clarify the prose. --- src/primitives/array.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/primitives/array.md b/src/primitives/array.md index 9cec24d699..5f5e699445 100644 --- a/src/primitives/array.md +++ b/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]); } ```