From f33865732264835eb0605bd9cb8f9029e4145b12 Mon Sep 17 00:00:00 2001 From: SaberAlter Date: Sun, 21 May 2023 00:05:14 +0800 Subject: [PATCH 1/2] Update problem 2 TIPS in slice.md --- solutions/compound-types/slice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/compound-types/slice.md b/solutions/compound-types/slice.md index 9abb7b9..6825779 100644 --- a/solutions/compound-types/slice.md +++ b/solutions/compound-types/slice.md @@ -17,7 +17,7 @@ fn main() { let slice = &arr[..2]; - // TIPS: slice( reference ) IS NOT an array, if it is an array, then `assert!` will passed: each of the two UTF-8 chars '中' and '国' occupies 3 bytes, 2 * 3 = 6 + // TIPS: slice( reference ) IS NOT an array, if it is an array, then `assert!` will passed: each of the two UTF-8 chars '中' and '国' occupies 4 bytes, 2 * 4 = 8 assert!(std::mem::size_of_val(&slice) == 16); } ``` From 538d809296df26c6561170882f7474f7a091dfe6 Mon Sep 17 00:00:00 2001 From: Sunface Date: Wed, 14 Jun 2023 08:45:06 +0800 Subject: [PATCH 2/2] Update solutions/compound-types/slice.md --- solutions/compound-types/slice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/compound-types/slice.md b/solutions/compound-types/slice.md index 6825779..32e84cb 100644 --- a/solutions/compound-types/slice.md +++ b/solutions/compound-types/slice.md @@ -17,7 +17,7 @@ fn main() { let slice = &arr[..2]; - // TIPS: slice( reference ) IS NOT an array, if it is an array, then `assert!` will passed: each of the two UTF-8 chars '中' and '国' occupies 4 bytes, 2 * 4 = 8 + // TIPS: slice( reference ) IS NOT an array, because if it is, then `assert!` will passed: each of the two UTF-8 chars '中' and '国' occupies 4 bytes, 2 * 4 = 8 assert!(std::mem::size_of_val(&slice) == 16); } ```