From 1bf264c47ef90d76b55c2a72a2c8854c9526c411 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Mon, 10 Jul 2023 11:35:24 +0200 Subject: [PATCH] ko: refresh translation for unsafe Part of #925. --- po/ko.po | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/po/ko.po b/po/ko.po index 62ed7b5e402..edbdbdcc89e 100644 --- a/po/ko.po +++ b/po/ko.po @@ -9435,6 +9435,19 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"static mut COUNTER: u32 = 0;\n" +"\n" +"fn add_to_counter(inc: u32) {\n" +" unsafe { COUNTER += inc; } // 잠재적 데이터 경합!\n" +"}\n" +"\n" +"fn main() {\n" +" add_to_counter(42);\n" +"\n" +" unsafe { println!(\"COUNTER: {COUNTER}\"); } // 잠재적 데이터 경합!\n" +"}\n" +"```" #: src/unsafe/mutable-static-variables.md:32 msgid "" @@ -9529,6 +9542,32 @@ msgid "" "}\n" "```" msgstr "" +"```rust,editable\n" +"fn main() {\n" +" let emojis = \"🗻∈🌏\";\n" +"\n" +" // Safe because the indices are in the correct order, within the bounds " +"of\n" +" // the string slice, and lie on UTF-8 sequence boundaries.\n" +" unsafe {\n" +" println!(\"emoji: {}\", emojis.get_unchecked(0..4));\n" +" println!(\"emoji: {}\", emojis.get_unchecked(4..7));\n" +" println!(\"emoji: {}\", emojis.get_unchecked(7..11));\n" +" }\n" +"\n" +" println!(\"char count: {}\", count_chars(unsafe { emojis." +"get_unchecked(0..7) }));\n" +"\n" +" // Not upholding the UTF-8 encoding requirement breaks memory safety!\n" +" // println!(\"emoji: {}\", unsafe { emojis.get_unchecked(0..3) });\n" +" // println!(\"char count: {}\", count_chars(unsafe { emojis." +"get_unchecked(0..3) }));\n" +"}\n" +"\n" +"fn count_chars(s: &str) -> usize {\n" +" s.chars().map(|_| 1).sum()\n" +"}\n" +"```" #: src/unsafe/writing-unsafe-functions.md:1 msgid "# Writing Unsafe Functions"