From e2038b489742bb5fa45a66190003469edfc70aec Mon Sep 17 00:00:00 2001 From: Henri Fontana Date: Fri, 21 Jul 2023 01:39:37 -0700 Subject: [PATCH] pt-BR: Catches up with latest PRs on the original EN text (#1008) pt-BR: Catches up with latest PRs on the original EN material --- po/pt-BR.po | 369 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 235 insertions(+), 134 deletions(-) diff --git a/po/pt-BR.po b/po/pt-BR.po index 8b7bc274..d2898600 100644 --- a/po/pt-BR.po +++ b/po/pt-BR.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Comprehensive Rust 🦀\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2023-07-17 12:30-0700\n" +"PO-Revision-Date: 2023-07-18 10:33-0700\n" "Last-Translator: \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1190,19 +1190,19 @@ msgstr "" "Se você sabe programar em uma linguagem de tipagem dinâmica, como Python ou\n" "JavaScript, então você também será capaz de acompanhar." -#: src/welcome.md:50 src/cargo/rust-ecosystem.md:19 +#: src/welcome.md:50 src/cargo.md:16 src/cargo/rust-ecosystem.md:19 #: src/cargo/code-samples.md:22 src/cargo/running-locally.md:68 #: src/welcome-day-1.md:14 src/welcome-day-1/what-is-rust.md:19 #: src/hello-world.md:20 src/hello-world/small-example.md:21 src/why-rust.md:9 #: src/why-rust/compile-time.md:14 src/why-rust/runtime.md:8 #: src/why-rust/modern.md:19 src/basic-syntax/scalar-types.md:19 #: src/basic-syntax/compound-types.md:28 src/basic-syntax/references.md:21 -#: src/basic-syntax/slices.md:18 src/basic-syntax/string-slices.md:25 +#: src/basic-syntax/slices.md:19 src/basic-syntax/string-slices.md:25 #: src/basic-syntax/functions.md:33 src/basic-syntax/rustdoc.md:22 #: src/basic-syntax/methods.md:32 src/basic-syntax/functions-interlude.md:25 #: src/exercises/day-1/morning.md:9 src/exercises/day-1/for-loops.md:90 #: src/basic-syntax/variables.md:15 src/basic-syntax/type-inference.md:24 -#: src/basic-syntax/static-and-const.md:48 +#: src/basic-syntax/static-and-const.md:47 #: src/basic-syntax/scopes-shadowing.md:23 src/memory-management/stack.md:26 #: src/memory-management/rust.md:12 src/ownership/move-semantics.md:20 #: src/ownership/moves-function-calls.md:18 src/ownership/copy-clone.md:33 @@ -1305,19 +1305,19 @@ msgstr "" "o instrutor deve\n" "cobrir quanto respostas a perguntas típicas que surgem em sala de aula." -#: src/welcome.md:56 src/cargo/rust-ecosystem.md:67 +#: src/welcome.md:56 src/cargo.md:28 src/cargo/rust-ecosystem.md:71 #: src/cargo/code-samples.md:35 src/cargo/running-locally.md:74 #: src/welcome-day-1.md:42 src/welcome-day-1/what-is-rust.md:29 -#: src/hello-world.md:40 src/hello-world/small-example.md:46 src/why-rust.md:24 +#: src/hello-world.md:43 src/hello-world/small-example.md:46 src/why-rust.md:24 #: src/why-rust/compile-time.md:35 src/why-rust/runtime.md:23 -#: src/why-rust/modern.md:66 src/basic-syntax/scalar-types.md:43 +#: src/why-rust/modern.md:66 src/basic-syntax/scalar-types.md:46 #: src/basic-syntax/compound-types.md:62 src/basic-syntax/references.md:29 #: src/basic-syntax/slices.md:36 src/basic-syntax/string-slices.md:44 -#: src/basic-syntax/functions.md:41 src/basic-syntax/rustdoc.md:33 -#: src/basic-syntax/methods.md:45 src/basic-syntax/functions-interlude.md:30 +#: src/basic-syntax/functions.md:41 src/basic-syntax/rustdoc.md:36 +#: src/basic-syntax/methods.md:47 src/basic-syntax/functions-interlude.md:30 #: src/exercises/day-1/morning.md:28 src/exercises/day-1/for-loops.md:95 #: src/basic-syntax/variables.md:20 src/basic-syntax/type-inference.md:48 -#: src/basic-syntax/static-and-const.md:55 +#: src/basic-syntax/static-and-const.md:54 #: src/basic-syntax/scopes-shadowing.md:39 src/memory-management/stack.md:49 #: src/memory-management/rust.md:18 src/ownership/move-semantics.md:26 #: src/ownership/moves-function-calls.md:26 src/ownership/copy-clone.md:51 @@ -1755,10 +1755,12 @@ msgstr "" #: src/running-the-course/translations.md:6 msgid "" -"* [Brazilian Portuguese][pt-BR] by [@rastringer] and [@hugojacob].\n" +"* [Brazilian Portuguese][pt-BR] by [@rastringer], [@hugojacob], " +"[@joaovicmendes] and [@henrif75].\n" "* [Korean][ko] by [@keispace], [@jiyongp] and [@jooyunghan]." msgstr "" -"* [Português do Brasil][pt-BR] por [@rastringer] e [@hugojacob].\n" +"* [Português do Brasil][pt-BR] por [@rastringer], [@hugojacob], " +"[@joaovicmendes] e [@henrif75].\n" "* [Coreano][ko] por [@keispace], [@jiyongp] e [@jooyunghan]." #: src/running-the-course/translations.md:9 @@ -1829,18 +1831,18 @@ msgid "## Installation" msgstr "## Instalação" #: src/cargo.md:10 -msgid "### Rustup (Recommended)" -msgstr "### Rustup (Recomendado)" +msgid "> TL;DR: Visit [rustup.rs][1]." +msgstr "> TL;DR: Veja [rustup.rs][1]." #: src/cargo.md:12 msgid "" "You can follow the instructions to install cargo and rust compiler, among " -"other standard ecosystem tools with the [rustup][3] tool, which is " +"other standard ecosystem tools with the [rustup][1] tool, which is " "maintained by the Rust Foundation." msgstr "" -"Você pode seguir as instruções para instalar o cargo e o compilador de Rust, " -"entre outras ferramentas padrão do ecossistema com a ferramenta [rustup][3], " -"que é mantida pela Rust Foundation." +"Você pode seguir as instruções para instalar o cargo e o compilador do Rust, " +"entre outras ferramentas padrão do ecossistema, com a ferramenta [rustup]" +"[1], que é mantida pela Rust Foundation." #: src/cargo.md:14 msgid "" @@ -1852,53 +1854,44 @@ msgstr "" "linha de comando que você pode usar para instalar/alternar ferramentas, " "configurar compilação cruzada, etc." -#: src/cargo.md:16 -msgid "### Package Managers" -msgstr "### Gerenciadores de pacotes" - #: src/cargo.md:18 -msgid "#### Debian" -msgstr "#### Debian" +msgid "" +"* On Debian/Ubuntu, you can also install Cargo, the Rust source and the " +"[Rust formatter][6] via `apt`. However, this gets you an outdated rust " +"version and may lead to unexpected behavior. The command would be:" +msgstr "" +"* No Debian/Ubuntu, você também pode instalar o Cargo, o código-fonte do " +"Rust e o [formatador Rust][6] com `apt`. Entretanto, isto lhe fornece uma " +"versão desatualizada do Rust e pode levar a comportamentos inesperados. O " +"comando seria:" #: src/cargo.md:20 msgid "" -"On Debian/Ubuntu, you can install Cargo, the Rust source and the [Rust " -"formatter][6] with" -msgstr "" -"No Debian/Ubuntu, você pode instalar o Cargo, o código-fonte Rust e o " -"[formatador Rust][6] com" - -#: src/cargo.md:22 -msgid "" "```shell\n" -"sudo apt install cargo rust-src rustfmt\n" +" sudo apt install cargo rust-src rustfmt\n" "```" msgstr "" "```shell\n" "sudo apt install cargo rust-src rustfmt\n" "```" -#: src/cargo.md:26 +#: src/cargo.md:24 msgid "" -"This will allow [rust-analyzer][1] to jump to the definitions. We suggest " -"using\n" -"[VS Code][2] to edit the code (but any LSP compatible editor works)." -msgstr "" -"Isso permitirá que o [rust-analyzer][1] localize as definições. Sugerimos " -"usar o\n" -"[VS Code][2] para editar o código (mas qualquer editor compatível com LSP " -"funciona)." - -#: src/cargo.md:29 -msgid "" -"Some folks also like to use the [JetBrains][4] family of IDEs, which do " +"* We suggest using [VS Code][2] to edit the code (but any LSP compatible " +"editor works with rust-analyzer[3]).\n" +"\n" +"* Some folks also like to use the [JetBrains][4] family of IDEs, which do " "their own analysis but have their own tradeoffs. If you prefer them, you can " "install the [Rust Plugin][5]. Please take note that as of January 2023 " "debugging only works on the CLion version of the JetBrains IDEA suite." msgstr "" -"Algumas pessoas também gostam de usar a família de IDEs [JetBrains][4], que " -"fazem suas próprias análises, mas têm suas próprias vantagens e " -"desvantagens. Se você preferir, pode instalar o [Plugin Rust][5]. Observe " +"* Nós sugerimos a utilização do [VS Code][2] para editar o código (mas " +"qualquer editor LSP - _Language Server Protocol_ - funciona com o rust-" +"analyzer[3]).\n" +"\n" +"* Algumas pessoas também gostam de usar a família de IDEs [JetBrains][4], " +"que fazem suas próprias análises, mas têm suas próprias vantagens e " +"desvantagens. Se você preferi-las, pode instalar o [Plugin Rust][5]. Observe " "que, a partir de Janeiro de 2023, a depuração funciona apenas na versão " "CLion do pacote JetBrains IDEA." @@ -1920,8 +1913,8 @@ msgid "" " intermediate formats.\n" "\n" "* `cargo`: the Rust dependency manager and build tool. Cargo knows how to\n" -" download dependencies hosted on and it will pass them " -"to\n" +" download dependencies, usually hosted on , and it will " +"pass them to\n" " `rustc` when building your project. Cargo also comes with a built-in test\n" " runner which is used to execute unit tests.\n" "\n" @@ -1939,8 +1932,8 @@ msgstr "" "\n" "* `cargo`: o gerenciador de dependências e ferramenta de compilação do Rust. " "O Cargo sabe como\n" -" baixar dependências hospedadas em e ele as passará para " -"o \n" +" baixar dependências, normalmente hospedadas em , e as " +"passará para o \n" " `rustc` quando compilar o seu projeto. O Cargo também vem com um " "gerenciador de\n" " testes embutido que é utilizado para a execução de testes unitários.\n" @@ -1976,6 +1969,9 @@ msgid "" "* New features are being tested on \"nightly\", \"beta\" is what becomes\n" " \"stable\" every six weeks.\n" "\n" +"* Dependencies can also be resolved from alternative [registries], git, " +"folders, and more.\n" +"\n" "* Rust also has [editions]: the current edition is Rust 2021. Previous\n" " editions were Rust 2015 and Rust 2018.\n" "\n" @@ -2015,6 +2011,9 @@ msgstr "" "torna\n" " \"stable\" a cada seis semanas.\n" "\n" +"* Dependências também podem ser resolvidas a partir de [registros]" +"[registries] alternativos, git, pastas, e outros mais.\n" +"\n" "* O Rust também tem [edições][editions]: a edição atual é o Rust 2021. As " "edições\n" " anteriores foram o Rust 2015 e o Rust 2018.\n" @@ -2467,15 +2466,15 @@ msgstr "Rust se encaixa na mesma área que C++:" msgid "" "* High flexibility.\n" "* High level of control.\n" -"* Can be scaled down to very constrained devices like mobile phones.\n" +"* Can be scaled down to very constrained devices such as microcontrollers.\n" "* Has no runtime or garbage collection.\n" "* Focuses on reliability and safety without sacrificing performance." msgstr "" "* Alta flexibilidade.\n" "* Alto nível de controle.\n" -"* Pode ser reduzido para dispositivos com menor poder computacional, como " -"telefones celulares.\n" -"* Não tem _runtime_ ou _garbage collection_.\n" +"* Pode ser reduzido para dispositivos com menor poder computacional, tais " +"como microcontroladores.\n" +"* Não possui _runtime_ ou coletor de lixo (_garbage collection_).\n" "* Concentra-se em confiabilidade e segurança sem sacrificar o desempenho." #: src/hello-world.md:1 @@ -2538,7 +2537,7 @@ msgstr "" #: src/hello-world.md:27 msgid "" "* Rust is very much like other languages in the C/C++/Java tradition. It is\n" -" imperative (not functional) and it doesn't try to reinvent things unless\n" +" imperative and it doesn't try to reinvent things unless\n" " absolutely necessary.\n" "\n" "* Rust is modern with full support for things like Unicode.\n" @@ -2552,23 +2551,36 @@ msgid "" "from\n" " the scope they are used in. Rust macros are actually only\n" " [partially hygienic](https://veykril.github.io/tlborm/decl-macros/minutiae/" -"hygiene.html)." +"hygiene.html).\n" +"\n" +"* Rust is multi-paradigm. For example, it has powerful [object-oriented " +"programming features](https://doc.rust-lang.org/book/ch17-00-oop.html),\n" +" and, while it is not a functional language, it includes a range of " +"[functional concepts](https://doc.rust-lang.org/book/ch13-00-functional-" +"features.html)." msgstr "" "* Rust é muito parecido com outras linguagens na tradição C/C++/Java. É\n" -"imperativo (não funcional) e não tenta reinventar as coisas, a menos que\n" -"seja absolutamente necessário.\n" +" imperativo (não funcional) e não tenta reinventar as coisas, a menos que\n" +" seja absolutamente necessário.\n" "\n" "* Rust é moderno com suporte total para coisas como Unicode.\n" "\n" "* Rust usa macros para situações em que você deseja ter um número variável\n" -"de argumentos (sem [sobrecarga de função](basic-syntax/functions-interlude." +" de argumentos (sem [sobrecarga de função](basic-syntax/functions-interlude." "md)).\n" "\n" "* Macros \"higiênicas\" significam que elas não capturam acidentalmente\n" -"identificadores do escopo em que são usadas. As macros em Rust são, na " +" identificadores do escopo em que são usadas. As macros em Rust são, na " "verdade,\n" -"apenas [parcialmente higiênicas](https://veykril.github.io/tlborm/decl-" -"macros/minutiae/hygiene.html)." +" apenas [parcialmente \"higiênicas\"](https://veykril.github.io/tlborm/decl-" +"macros/minutiae/hygiene.html).\n" +"\n" +"* Rust é multi-paradigma. Por exemplo, ele possui [funcionalidades de " +"programação orientada à objetos](https://doc.rust-lang.org/book/ch17-00-oop." +"html) poderosas,\n" +" e, embora não seja uma linguagem _funcional_, inclui uma série de " +"[conceitos _funcionais_](https://doc.rust-lang.org/book/ch13-00-functional-" +"features.html)." #: src/hello-world/small-example.md:1 msgid "# Small Example" @@ -2858,9 +2870,9 @@ msgid "# Modern Features" msgstr "# Recursos Modernos" #: src/why-rust/modern.md:3 -msgid "Rust is built with all the experience gained in the last 40 years." +msgid "Rust is built with all the experience gained in the last decades." msgstr "" -"O Rust é construído com toda a experiência adquirida nos últimos 40 anos." +"O Rust é construído com toda a experiência adquirida nas últimas décadas." #: src/why-rust/modern.md:5 msgid "## Language Features" @@ -3030,37 +3042,37 @@ msgstr "# Tipos Escalares" #: src/basic-syntax/scalar-types.md:3 msgid "" "| | Types | " -"Literals |\n" -"|------------------------|--------------------------------------------|-------------------------------|\n" +"Literals |\n" +"|------------------------|--------------------------------------------|--------------------------------|\n" "| Signed integers | `i8`, `i16`, `i32`, `i64`, `i128`, `isize` | " -"`-10`, `0`, `1_000`, `123i64` |\n" +"`-10`, `0`, `1_000`, `123_i64` |\n" "| Unsigned integers | `u8`, `u16`, `u32`, `u64`, `u128`, `usize` | `0`, " -"`123`, `10u16` |\n" +"`123`, `10_u16` |\n" "| Floating point numbers | `f32`, `f64` | " -"`3.14`, `-10.0e20`, `2f32` |\n" +"`3.14`, `-10.0e20`, `2_f32` |\n" "| Strings | `&str` | " -"`\"foo\"`, `\"two\\nlines\"` |\n" +"`\"foo\"`, `\"two\\nlines\"` |\n" "| Unicode scalar values | `char` | " -"`'a'`, `'α'`, `'∞'` |\n" +"`'a'`, `'α'`, `'∞'` |\n" "| Booleans | `bool` | " -"`true`, `false` |" +"`true`, `false` |" msgstr "" "| | Tipos | " -"Literais |\n" -"|---------------------------|--------------------------------------------|------------------------------ " +"Literais |\n" +"|---------------------------|--------------------------------------------|------------------------------- " "|\n" "| Inteiros com sinal | `i8`, `i16`, `i32`, `i64`, `i128`, `isize` | " -"`-10`, `0`, `1_000`, `123i64` |\n" +"`-10`, `0`, `1_000`, `123_i64` |\n" "| Inteiros sem sinal | `u8`, `u16`, `u32`, `u64`, `u128`, `usize` | " -"`0`, `123`, `10u16` |\n" +"`0`, `123`, `10_u16` |\n" "| Números de ponto flutuante| `f32`, `f64` | " -"`3.14`, `-10.0e20`, `2f32` |\n" +"`3.14`, `-10.0e20`, `2_f32` |\n" "| Strings | `&str` | " "`\"foo\"`, `\"two\\nlines\"` |\n" "| Valores escalares Unicode | `char` | " -"`'a'`, `'α'`, `'∞'` |\n" +"`'a'`, `'α'`, `'∞'` |\n" "| Booleanos | `bool` | " -"`true`, `false` |" +"`true`, `false` |" #: src/basic-syntax/scalar-types.md:12 msgid "The types have widths as follows:" @@ -3104,7 +3116,11 @@ msgid "" " println!(\"{:?}\", b\"abc\");\n" " println!(\"{:?}\", &[97, 98, 99]);\n" " }\n" -" ```" +" ```\n" +"\n" +"- All underscores in numbers can be left out, they are for legibility only.\n" +" So `1_000` can be written as `1000` (or `10_00`), and `123_i64` can be " +"written as `123i64`." msgstr "" "- Strings brutas permitem que você crie um valor `&str` com caracteres de " "escape desabilitados: `r\"\\n\"\n" @@ -3126,7 +3142,12 @@ msgstr "" " println!(\"{:?}\", b\"abc\");\n" " println!(\"{:?}\", &[97, 98, 99]);\n" " }\n" -" ```" +" ```\n" +"\n" +"- Todos os sublinhados em números podem ser omitidos, eles são apenas para " +"legibilidade.\n" +" Por exemplo, `1_000` pode ser escrito como `1000` (ou `10_00`), e " +"`123_i64` pode ser escrito como `123i64`." #: src/basic-syntax/compound-types.md:1 msgid "# Compound Types" @@ -3386,6 +3407,7 @@ msgid "" " println!(\"a: {a:?}\");\n" "\n" " let s: &[i32] = &a[2..4];\n" +"\n" " println!(\"s: {s:?}\");\n" "}\n" "```" @@ -3396,19 +3418,21 @@ msgstr "" " println!(\"a: {a:?}\");\n" "\n" " let s: &[i32] = &a[2..4];\n" +"\n" " println!(\"s: {s:?}\");\n" "}\n" "```" -#: src/basic-syntax/slices.md:15 +#: src/basic-syntax/slices.md:16 msgid "" "* Slices borrow data from the sliced type.\n" -"* Question: What happens if you modify `a[3]`?" +"* Question: What happens if you modify `a[3]` right before printing `s`?" msgstr "" -"* As slices pegam dados emprestados do tipo original.\n" -"* Pergunta: O que acontece se você modificar `a[3]`?" +"* Slices pegam dados emprestados do tipo original.\n" +"* Pergunta: O que acontece se você modificar `a[3]` imediatamente antes de " +"imprimir `s`?" -#: src/basic-syntax/slices.md:20 +#: src/basic-syntax/slices.md:21 msgid "" "* We create a slice by borrowing `a` and specifying the starting and ending " "indexes in brackets.\n" @@ -3432,9 +3456,11 @@ msgid "" " \n" "* The question about modifying `a[3]` can spark an interesting discussion, " "but the answer is that for memory safety reasons\n" -" you cannot do it through `a` after you created a slice, but you can read " -"the data from both `a` and `s` safely. \n" -" More details will be explained in the borrow checker section." +" you cannot do it through `a` at this point in the execution, but you can " +"read the data from both `a` and `s` safely.\n" +" It works before you created the slice, and again after the `println`, when " +"the slice is no longer used. More details will be explained in the borrow " +"checker section." msgstr "" "* Nós criamos uma _slice_ emprestando `a` e especificando os índices de " "início e fim entre colchetes.\n" @@ -3459,9 +3485,11 @@ msgstr "" " \n" "* A questão sobre a modificação de `a[3]` pode gerar uma discussão " "interessante, mas a resposta é que por motivos de segurança de memória\n" -" você não pode fazer isso por meio de `a` depois de criar uma _slice_, mas " -"você pode ler os dados de `a` e `s` com segurança.\n" -" Mais detalhes serão explicados na seção do verificador de empréstimos." +" você não pode fazer isso por meio de `a` neste ponto durante a execução, " +"mas você pode ler os dados de `a` e `s` com segurança.\n" +" Isto funciona antes da criação do _slice_, e novamente depois de " +"`println`, quando o _slice_ não é mais necessário. Mais detalhes serão " +"explicados na seção do verificador de empréstimos." #: src/basic-syntax/string-slices.md:1 msgid "# `String` vs `str`" @@ -3733,7 +3761,12 @@ msgid "" "\n" "* Inner doc comments are discussed later (in the page on modules) and need " "not\n" -" be addressed here." +" be addressed here.\n" +"\n" +"* Rustdoc comments can contain code snippets that we can run and test using " +"`cargo test`.\n" +" We will discuss these tests in the [Testing section](../testing/doc-tests." +"html)." msgstr "" "* Mostre aos alunos os documentos gerados para o crate `rand` em\n" " [`docs.rs/rand`](https://docs.rs/rand).\n" @@ -3744,7 +3777,12 @@ msgstr "" "\n" "* Os comentários internos do documento são discutidos posteriormente (na " "página sobre módulos) e não precisam ser\n" -" ser abordados aqui." +" ser abordados aqui.\n" +"\n" +"* Os comentários do Rustdoc podem conter trechos de código-fonte, que podem " +"ser executados e testados por meio de `cargo test`.\n" +" Nós discutiremos estes testes na [seção de Testes](../testing/doc-tests." +"html)." #: src/basic-syntax/methods.md:1 src/methods.md:1 msgid "# Methods" @@ -3819,7 +3857,7 @@ msgstr "" #: src/basic-syntax/methods.md:34 msgid "" -"- Add a `Rectangle::new` constructor and call this from `main`:\n" +"- Add a static method called `Rectangle::new` and call this from `main`:\n" "\n" " ```rust,editable,compile_fail\n" " fn new(width: u32, height: u32) -> Rectangle {\n" @@ -3827,10 +3865,17 @@ msgid "" " }\n" " ```\n" "\n" -"- Add a `Rectangle::new_square(width: u32)` constructor to illustrate that\n" -" constructors can take arbitrary parameters." +"- While _technically_, rust does not have custom constructors, static " +"methods are commonly used to initialize structs (but don't have to).\n" +" The actual constructor, `Rectangle { width, height }`, could be called " +"directly. See the [Rustnomicon](https://doc.rust-lang.org/nomicon/" +"constructors.html).\n" +"\n" +"- Add a `Rectangle::new_square(width: u32)` constructor to illustrate that " +"such static methods can take arbitrary parameters." msgstr "" -"- Adicione um construtor `Retangulo::new` e o chame a partir de `main`:\n" +"- Adicione um método estático chamado `Retangulo::new` e o chame a partir de " +"`main`:\n" "\n" " ```rust,editable,compile_fail\n" " fn new(largura: u32, altura: u32) -> Retangulo {\n" @@ -3838,9 +3883,15 @@ msgstr "" " }\n" " ```\n" "\n" +"- Enquanto _tecnicamente_, o Rust não possui construtores customizados, " +"métodos estáticos são normalmente usados para inicializar _structs_ (embora " +"não sejam necessários).\n" +"The construtor propriamente dito, `Retangulo { largura, altura }`, poderia " +"ser chamado diretamente. Veja o [Rustnomicon](https://doc.rust-lang.org/" +"nomicon/constructors.html).\n" +"\n" "- Adicione um construtor `Rectangle::novo_quadrado(largura: u32)` para " -"ilustrar que\n" -" construtores podem ter parâmetros arbitrários." +"demonstrar que tais métodos estáticos podem ter parâmetros arbitrários." #: src/basic-syntax/functions-interlude.md:1 msgid "# Function Overloading" @@ -4440,12 +4491,16 @@ msgstr "" #: src/basic-syntax/type-inference.md:46 msgid "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." -"html#method.collect) relies on `FromIterator`, which [`HashSet`](https://doc." -"rust-lang.org/std/iter/trait.FromIterator.html) implements." +"html#method.collect) relies on [`FromIterator`](https://doc.rust-lang.org/" +"std/iter/trait.FromIterator.html), which [`HashSet`](https://doc.rust-lang." +"org/std/collections/struct.HashSet.html#impl-FromIterator%3CT%3E-for-" +"HashSet%3CT,+S%3E) implements." msgstr "" "[`collect`](https://doc.rust-lang.org/stable/std/iter/trait.Iterator." -"html#method.collect) depende de `FromIterator`, que [`HashSet`](https://doc." -"rust-lang.org/std/iter/trait.FromIterator.html) implementa." +"html#method.collect) depende de [`FromIterator`](https://doc.rust-lang.org/" +"std/iter/trait.FromIterator.html), que [`HashSet`](https://doc.rust-lang.org/" +"std/collections/struct.HashSet.html#impl-FromIterator%3CT%3E-for-HashSet%3CT," +"+S%3E) implementa." #: src/basic-syntax/static-and-const.md:1 msgid "# Static and Constant Variables" @@ -4555,19 +4610,22 @@ msgstr "" "Quando um valor de escopo global não tem uma razão para precisar identidade " "de objeto, geralmente `const` é preferido." -#: src/basic-syntax/static-and-const.md:45 +#: src/basic-syntax/static-and-const.md:44 msgid "" +"Because `static` variables are accessible from any thread, they need to be " +"guarded, for example by a [`Mutex`](https://doc.rust-lang.org/std/sync/" +"struct.Mutex.html), or accessed using `unsafe` code.\n" "We will look at [mutating static data](../unsafe/mutable-static-variables." -"md) in the chapter on Unsafe Rust.\n" -"Because `static` variables are accessible from any thread, mutable static " -"variables require manual, unsafe, synchronization of accesses." +"md) in the chapter on Unsafe Rust." msgstr "" +"Como variáveis estáticas (`static`) são acessíveis a partir que qualquer " +"_thread_, elas precisam ser guardadas, por exemplo, por um [`Mutex`](https://" +"doc.rust-lang.org/std/sync/struct.Mutex.html), ou acessadas por meio de " +"código inseguro (`unsafe`).\n" "Nós iremos ver [dados estáticos mutáveis](../unsafe/mutable-static-variables." -"md) no capítulo sobre Rust _inseguro_.\n" -"Variáveis estáticas mutáveis são acessíveis por qualquer _thread_ e por isso " -"necessitam de sincronização de acessos manual e insegura (_unsafe_)." +"md) no capítulo sobre Rust inseguro (\"_Unsafe Rust_\")." -#: src/basic-syntax/static-and-const.md:50 +#: src/basic-syntax/static-and-const.md:49 msgid "" "* Mention that `const` behaves semantically similar to C++'s `constexpr`.\n" "* `static`, on the other hand, is much more similar to a `const` or mutable " @@ -4738,18 +4796,17 @@ msgstr "" " * Sem garantias de localidade de memória." #: src/memory-management/stack.md:1 -msgid "# Stack Memory" -msgstr "# Memória de Pilha (_Stack Memory_)" +msgid "# Stack and Heap Example" +msgstr "# Exemplo de Pilha e _Heap_" #: src/memory-management/stack.md:3 msgid "" -"Creating a `String` puts fixed-sized data on the stack and dynamically " +"Creating a `String` puts fixed-sized metadata on the stack and dynamically " "sized\n" -"data on the heap:" +"data, the actual string, on the heap:" msgstr "" -"A criação de uma `String` coloca dados de tamanho fixo na pilha e dados " -"dimensionados dinamicamente\n" -"no heap:" +"A criação de uma `String` coloca metadados de tamanho fixo na pilha e dados " +"dinamicamente dimensionados - a string propriamente dita - no _heap_:" #: src/memory-management/stack.md:6 msgid "" @@ -4817,7 +4874,7 @@ msgid "" "lead to\n" " // undefined behavior.\n" " unsafe {\n" -" let (capacity, ptr, len): (usize, usize, usize) = std::mem::" +" let (ptr, capacity, len): (usize, usize, usize) = std::mem::" "transmute(s1);\n" " println!(\"ptr = {ptr:#x}, len = {len}, capacity = " "{capacity}\");\n" @@ -4844,10 +4901,10 @@ msgstr "" " s1.push_str(\"mundo\");\n" " // NÃO FAÇA ISSO EM CASA! Somente com propósito educacional.\n" " // String não fornece nenhuma garantia sobre o seu layout, então isso " -"pode levar\n" -" // a um comportamento indefinido.\n" +"pode causar\n" +" // um comportamento indefinido.\n" " unsafe {\n" -" let (capacity, ptr, len): (usize, usize, usize) = std::mem::" +" let (ptr, capacity, len): (usize, usize, usize) = std::mem::" "transmute(s1);\n" " println!(\"Ponteiro = {ptr:#x}, tamanho = {len}, capacidade = " "{capacity}\");\n" @@ -4905,10 +4962,14 @@ msgstr "" msgid "" "Memory is leaked if the function returns early between `malloc` and `free`: " "the\n" -"pointer is lost and we cannot deallocate the memory." +"pointer is lost and we cannot deallocate the memory.\n" +"Worse, freeing the pointer twice, or accessing a freed pointer can lead to " +"exploitable security vulnerabilities." msgstr "" "Memória é vazada se a função retornar mais cedo entre `malloc` e `free`: o\n" -"ponteiro é perdido e não podemos desalocar a memória." +"ponteiro é perdido e não podemos liberar a memória.\n" +"Pior ainda, liberando o ponteiro duas vezes, ou acessando um ponteiro já " +"liberado pode levar a vulnerabilidades de segurança." #: src/memory-management/scope-based.md:1 msgid "# Scope-Based Memory Management" @@ -5372,8 +5433,8 @@ msgstr "" "```" #: src/ownership/double-free-modern-cpp.md:1 -msgid "# Double Frees in Modern C++" -msgstr "# Liberações Duplas (_Double Frees_) em C++ Moderno" +msgid "# Extra Work in Modern C++ " +msgstr "# Trabalho Extra em C++ Moderno" #: src/ownership/double-free-modern-cpp.md:3 msgid "Modern C++ solves this differently:" @@ -6965,11 +7026,11 @@ msgid "" " }\n" " fn create_default() {\n" " let tmp = Person {\n" -" ..Default::default()\n" +" ..Person::default()\n" " };\n" " let tmp = Person {\n" " name: \"Sam\".to_string(),\n" -" ..Default::default()\n" +" ..Person::default()\n" " };\n" " }\n" " ```\n" @@ -7013,11 +7074,11 @@ msgstr "" " }\n" " fn create_default() {\n" " let tmp = Pessoa {\n" -" ..Default::default()\n" +" ..Pessoa::default()\n" " };\n" " let tmp = Pessoa {\n" " nome: \"Sam\".to_string(),\n" -" ..Default::default()\n" +" ..Pessoa::default()\n" " };\n" " }\n" " ```\n" @@ -25226,6 +25287,46 @@ msgid "" "```" msgstr "" +#~ msgid "### Rustup (Recommended)" +#~ msgstr "### Rustup (Recomendado)" + +#~ msgid "### Package Managers" +#~ msgstr "### Gerenciadores de pacotes" + +#~ msgid "#### Debian" +#~ msgstr "#### Debian" + +#~ msgid "" +#~ "On Debian/Ubuntu, you can install Cargo, the Rust source and the [Rust " +#~ "formatter][6] with" +#~ msgstr "" +#~ "No Debian/Ubuntu, você pode instalar o Cargo, o código-fonte Rust e o " +#~ "[formatador Rust][6] com" + +#~ msgid "" +#~ "This will allow [rust-analyzer][1] to jump to the definitions. We suggest " +#~ "using\n" +#~ "[VS Code][2] to edit the code (but any LSP compatible editor works)." +#~ msgstr "" +#~ "Isso permitirá que o [rust-analyzer][1] localize as definições. Sugerimos " +#~ "usar o\n" +#~ "[VS Code][2] para editar o código (mas qualquer editor compatível com LSP " +#~ "funciona)." + +#~ msgid "" +#~ "We will look at [mutating static data](../unsafe/mutable-static-variables." +#~ "md) in the chapter on Unsafe Rust.\n" +#~ "Because `static` variables are accessible from any thread, mutable static " +#~ "variables require manual, unsafe, synchronization of accesses." +#~ msgstr "" +#~ "Nós iremos ver [dados estáticos mutáveis](../unsafe/mutable-static-" +#~ "variables.md) no capítulo sobre Rust _inseguro_.\n" +#~ "Variáveis estáticas mutáveis são acessíveis por qualquer _thread_ e por " +#~ "isso necessitam de sincronização de acessos manual e insegura (_unsafe_)." + +#~ msgid "# Stack Memory" +#~ msgstr "# Memória de Pilha (_Stack Memory_)" + #~ msgid "Global state is managed with static and constant variables." #~ msgstr "O estado global é gerenciado com variáveis estáticas e constantes."