Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 12 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,34 @@
# NOTICE ABOUT STATUS

The second edition of The Rust Programming Language is getting ever closer to being printed!
This means we're not able to make large changes to chapters that are in any column to the
right of, and including, the "Frozen" column [on our Project board][proj]. Issues or pull
requests submitted for frozen chapters are welcome but will be closed until we start work
on a third edition. Thank you!

[proj]: https://github.com/rust-lang/book/projects/1
> **This is a fork of [rust-lang/book](https://github.com/rust-lang/book) in order to translate the English (second-edition) book in French.**
>
> Please read the help [TRANSLATE.md](https://github.com/quadrifoglio/rust-book-fr/blob/master/second-edition/TRANSLATING.md) !

# The Rust Programming Language

[![Build Status](https://travis-ci.org/rust-lang/book.svg?branch=master)](https://travis-ci.org/rust-lang/book)

This repo contains two editions of “The Rust Programming Language”; we
recommend starting with the second edition.
This repo contains two editions of “The Rust Programming Language”.

The second edition is a rewrite that will be printed by No Starch Press,
available around May 2018. Check [the No Starch Page][nostarch] for the latest
information on the release date and how to order.
The second edition is a rewrite that will be printed by NoStarch Press,
available around October 2017.

[nostarch]: https://nostarch.com/rust
[You can read it online][html]; the last few chapters aren't completed yet, but
the first half of the book is much improved from the first edition. We recommend
starting with the second edition.

You can read the book for free online! Please see the book as shipped with the
latest [stable], [beta], or [nightly] Rust releases. Be aware that issues in
those versions may have been fixed in this repository already.

[stable]: https://doc.rust-lang.org/stable/book/second-edition/
[beta]: https://doc.rust-lang.org/beta/book/second-edition/
[nightly]: https://doc.rust-lang.org/nightly/book/second-edition/
[html]: http://rust-lang.github.io/book/

[The first edition is still available to read online][first].

[first]: https://doc.rust-lang.org/book/


## Requirements

Building the book requires [mdBook], ideally the same version that
[rust-lang/rust uses in this file][rust-mdbook]. To get it:
Building the book requires [mdBook] >= v0.0.13. To get it:

[mdBook]: https://github.com/azerupi/mdBook
[rust-mdbook]: https://github.com/rust-lang/rust/blob/master/src/tools/rustbook/Cargo.toml

```bash
$ cargo install mdbook --vers [version-num]
$ cargo install mdbook
```

## Building
Expand Down
16 changes: 16 additions & 0 deletions second-edition/TRANSLATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Translation process

1. Ask for the access rights to the french fork on the [initial issue](https://github.com/rust-lang/book/issues/808).
2. Choose a chapter to work on, from the ["french translations" board](https://github.com/quadrifoglio/rust-book-fr/projects/1). Make sure that the original writers marked it as "frozen", and
that the source is is up to date with the [original version](https://github.com/rust-lang/book).
3. Please create a [branch](https://github.com/quadrifoglio/rust-book-fr/branches) in order to work on your translation.
4. Translate the chapter.
5. When you are satisfied with your translation, and want feedback/help on your work, please open a [PR](https://github.com/quadrifoglio/rust-book-fr/pulls).

When the PR is created, you can ask for a review from the other contributors.
You can also help by taking a look at the opened PRs, do not hesitate to comment or provide corrections.

## Tool suggestions

- [BonPatron](http://bonpatron.com/)
- [DeepL Translator](https://www.deepl.com/translator)
46 changes: 25 additions & 21 deletions second-edition/src/ch09-00-error-handling.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# Error Handling
# Gestion des Erreurs

Rust’s commitment to reliability extends to error handling. Errors are a fact
of life in software, so Rust has a number of features for handling situations
in which something goes wrong. In many cases, Rust requires you to acknowledge
the possibility of an error occurring and take some action before your code
will compile. This requirement makes your program more robust by ensuring that
you’ll discover errors and handle them appropriately before you’ve deployed
your code to production!
L'engagement de Rust envers la fiabilité concerne aussi la gestion des erreurs.
Les erreurs font partie de la vie des programmes informatiques, c'est pourquoi
Rust a des dispositifs pour gérer les situations où les choses se passent mal.
Dans de nombreux cas, Rust exige que vous anticipiez les erreurs possibles et
que vous preniez des dispositions avant de compiler votre code. Cette exigence
rends votre programme plus résiliant en s'assurant que vous détectiez et gérez
les erreurs correctement avant même que vous déployez votre code en production
!

Rust groups errors into two major categories: *recoverable* and *unrecoverable*
errors. Recoverable errors are situations in which it’s reasonable to report
the problem to the user and retry the operation, like a file not found error.
Unrecoverable errors are always symptoms of bugs, like trying to access a
location beyond the end of an array.
Rust classe les erreurs dans deux catégories principales : les erreurs
*récupérables* et *irrécupérables*. Les erreurs récupérables se produisent
dans des situations dans lesquelles il est utile de signaler l'erreur à
l'utilisateur et de relancer l'opération, comme par exemple une erreur lorsque
un fichier n'a pas été trouvé.
Les erreurs irrécupérables sont toujours liées à des bogues, comme essayer
d'accéder à un caractère au-delà de la fin d'un tableau.

Most languages don’t distinguish between these two kinds of errors and handle
both in the same way using mechanisms like exceptions. Rust doesn’t have
exceptions. Instead, it has the type `Result<T, E>` for recoverable errors and
the `panic!` macro that stops execution when it encounters unrecoverable
errors. This chapter covers calling `panic!` first and then talks about
returning `Result<T, E>` values. Additionally, we’ll explore considerations to
take into account when deciding whether to try to recover from an error or to
stop execution.
La plupart des langages de programmation ne font pas de distinction entre ces
deux types d'erreurs et les gèrent de la même manière, comme les exceptions.
Rust n'a pas d'exceptions. À la place, il a les valeurs `Result<T, E>` pour les
erreurs récupérables, et la macro `panic!` qui arrête l'exécution quand il
se heurte à des erreurs irrécupérables. Nous allons commencer ce chapitre par
expliquer l'utilisation de `panic!`, puis ensuite les valeurs de retour
`Result<T, E>`. De plus, nous allons voir les arguments à prendre en compte
pour choisir si nous devons essayer de récupérer une erreur ou d'arrêter
l'exécution.
Loading