Skip to content

Commit

Permalink
Deploying to gh-pages from @ daafd0f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
damoasda committed Mar 9, 2024
1 parent 298566d commit 44d601b
Show file tree
Hide file tree
Showing 48 changed files with 656 additions and 534 deletions.
19 changes: 11 additions & 8 deletions ch02-00-guessing-game-tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,16 @@ <h3 id="behandeln-potentieller-fehler-mit-result"><a class="header" href="#behan
--&gt; src/main.rs:10:5
|
10 | io::stdin().read_line(&amp;mut guess);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
= note: this `Result` may be an `Err` variant, which should be handled
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
10 | let _ = io::stdin().read_line(&amp;mut guess);
| +++++++

warning: `guessing_game` (bin "guessing_game") generated 1 warning

Finished dev [unoptimized + debuginfo] target(s) in 0.59s
</code></pre>
<p>Rust warnt, dass du den von <code>read_line</code> zurückgegebenen <code>Result</code>-Wert nicht
Expand Down Expand Up @@ -842,17 +845,17 @@ <h2 id="vergleichen-der-schätzung-mit-der-geheimzahl"><a class="header" href="#
--&gt; src/main.rs:22:21
|
22 | match guess.cmp(&amp;secret_number) {
| --- ^^^^^^^^^^^^^^ expected struct `String`, found integer
| --- ^^^^^^^^^^^^^^ expected `&amp;String`, found `&amp;{integer}`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected reference `&amp;String`
found reference `&amp;{integer}`
note: associated function defined here
--&gt; /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/cmp.rs:783:8
note: method defined here
--&gt; /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/cmp.rs:814:8

For more information about this error, try `rustc --explain E0308`.
error: could not compile `guessing_game` due to previous error
error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error
</code></pre>
<p>Die Kernbotschaft des Fehlers besagt, dass es <em>nicht übereinstimmende Typen</em>
(mismatched types) gibt. Rust hat ein starkes, statisches Typsystem. Es hat jedoch
Expand Down
10 changes: 8 additions & 2 deletions ch03-01-variables-and-mutability.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h2 id="variablen-und-veränderbarkeit"><a class="header" href="#variablen-und-v
| ^^^^^ cannot assign twice to immutable variable

For more information about this error, try `rustc --explain E0384`.
error: could not compile `variables` due to previous error
error: could not compile `variables` (bin "variables") due to 1 previous error
</code></pre>
<p>Dieses Beispiel zeigt, wie der Compiler dir hilft, Fehler in deinen Programmen
zu finden. Kompilierfehler können frustrierend sein, aber eigentlich bedeuten
Expand Down Expand Up @@ -378,9 +378,15 @@ <h3 id="verschatten-shadowing"><a class="header" href="#verschatten-shadowing">V
| ----- expected due to this value
3 | spaces = spaces.len();
| ^^^^^^^^^^^^ expected `&amp;str`, found `usize`
|
help: try removing the method call
|
3 - spaces = spaces.len();
3 + spaces = spaces;
|

For more information about this error, try `rustc --explain E0308`.
error: could not compile `variables` due to previous error
error: could not compile `variables` (bin "variables") due to 1 previous error
</code></pre>
<p>Nachdem wir nun untersucht haben, wie Variablen funktionieren, wollen wir uns
weitere Datentypen ansehen, die sie haben können.</p>
Expand Down
16 changes: 9 additions & 7 deletions ch03-02-data-types.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,20 @@ <h2 id="datentypen"><a class="header" href="#datentypen">Datentypen</a></h2>
zu wissen welchen Typ wir verwenden wollen:</p>
<pre><code class="language-console">$ cargo build
Compiling no_type_annotations v0.1.0 (file:///projects/no_type_annotations)
error[E0282]: type annotations needed
error[E0284]: type annotations needed
--&gt; src/main.rs:2:9
|
2 | let guess = "42".parse().expect("Keine Zahl!");
| ^^^^^
| ^^^^^ ----- type must be known at this point
|
= note: cannot satisfy `&lt;_ as FromStr&gt;::Err == _`
help: consider giving `guess` an explicit type
|
2 | let guess: _ = "42".parse().expect("Keine Zahl!");
| +++
2 | let guess: /* Type */ = "42".parse().expect("Keine Zahl!");
| ++++++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `no_type_annotations` due to previous error
For more information about this error, try `rustc --explain E0284`.
error: could not compile `no_type_annotations` (bin "no_type_annotations") due to 1 previous error
</code></pre>
<p>Für andere Datentypen wirst du andere Typ-Annotationen sehen.</p>
<h3 id="skalare-typen"><a class="header" href="#skalare-typen">Skalare Typen</a></h3>
Expand Down Expand Up @@ -529,7 +530,8 @@ <h5 id="ungültiger-array-element-zugriff"><a class="header" href="#ungültiger-
entsprechenden Wert an diesem Index im Array ausgeben. Wenn du stattdessen eine
Zahl hinter dem Ende des Arrays eingibst, z.B. <code>10</code>, erhältst du eine Ausgabe
wie diese:</p>
<pre><code class="language-text">thread 'main' panicked at 'index out of bounds: the len is 5 but the index is 10', src/main.rs:19:19
<pre><code class="language-text">thread 'main' panicked at src/main.rs:19:19:
index out of bounds: the len is 5 but the index is 10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
</code></pre>
<p>Das Programm führte zu einem <em>Laufzeitfehler</em> an der Stelle, an der ein
Expand Down
27 changes: 5 additions & 22 deletions ch03-03-how-functions-work.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ <h4 id="anweisungen-und-ausdrücke"><a class="header" href="#anweisungen-und-aus
<p><span class="filename">Dateiname: src/main.rs</span></p>
<pre><pre class="playground"><code class="language-rust does_not_compile">fn main() {
let x = (let y = 6);
}
</code></pre></pre>
}</code></pre></pre>
<p>Wenn du dieses Programm ausführst, wirst du in etwa folgenden Fehler erhalten:</p>
<pre><code class="language-console">$ cargo run
Compiling functions v0.1.0 (file:///projects/functions)
Expand All @@ -311,22 +310,8 @@ <h4 id="anweisungen-und-ausdrücke"><a class="header" href="#anweisungen-und-aus
|
2 | let x = (let y = 6);
| ^^^

error: expected expression, found statement (`let`)
--&gt; src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: variable declaration using `let` is a statement

error[E0658]: `let` expressions in this position are unstable
--&gt; src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: see issue #53667 &lt;https://github.com/rust-lang/rust/issues/53667&gt; for more information
= note: only supported directly in conditions of `if` and `while` expressions

warning: unnecessary parentheses around assigned value
--&gt; src/main.rs:2:13
Expand All @@ -341,9 +326,8 @@ <h4 id="anweisungen-und-ausdrücke"><a class="header" href="#anweisungen-und-aus
2 + let x = let y = 6;
|

For more information about this error, try `rustc --explain E0658`.
warning: `functions` (bin "functions") generated 1 warning
error: could not compile `functions` due to 3 previous errors; 1 warning emitted
error: could not compile `functions` (bin "functions") due to 1 previous error; 1 warning emitted
</code></pre>
<p>Die Anweisung <code>let y = 6</code> gibt keinen Wert zurück, also gibt es für <code>x</code> nichts,
woran <code>x</code> gebunden werden kann. Dies unterscheidet sich von dem, was in anderen
Expand Down Expand Up @@ -456,11 +440,10 @@ <h3 id="funktionen-mit-rückgabewerten"><a class="header" href="#funktionen-mit-
| |
| implicitly returns `()` as its body has no tail or `return` expression
8 | x + 1;
| - help: consider removing this semicolon
| - help: remove this semicolon to return this value

For more information about this error, try `rustc --explain E0308`.
warning: `functions` (bin "functions") generated 1 warning
error: could not compile `functions` due to 2 previous errors; 1 warning emitted
error: could not compile `functions` (bin "functions") due to 1 previous error
</code></pre>
<p>Die Hauptfehlermeldung <code>mismatched types</code> offenbart das Kernproblem dieses
Codes. Die Definition der Funktion <code>plus_one</code> besagt, dass sie ein <code>i32</code>
Expand Down
4 changes: 2 additions & 2 deletions ch03-05-control-flow.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ <h3 id="if-ausdrücke"><a class="header" href="#if-ausdrücke"><code>if</code>-A
| ^^^^^^ expected `bool`, found integer

For more information about this error, try `rustc --explain E0308`.
error: could not compile `branches` due to previous error
error: could not compile `branches` (bin "branches") due to 1 previous error
</code></pre>
<p>Der Fehler gibt an, dass Rust ein <code>bool</code> erwartet, aber eine ganze Zahl
erhalten hat. Im Gegensatz zu Sprachen wie Ruby und JavaScript wird Rust nicht
Expand Down Expand Up @@ -355,7 +355,7 @@ <h4 id="verwenden-von-if-in-einer-let-anweisung"><a class="header" href="#verwen
| expected because of this

For more information about this error, try `rustc --explain E0308`.
error: could not compile `branches` due to previous error
error: could not compile `branches` (bin "branches") due to 1 previous error
</code></pre>
<p>Der Ausdruck im <code>if</code>-Block wird zu einer ganzen Zahl und der Ausdruck im
<code>else</code>-Block zu einer Zeichenkette ausgewertet. Dies wird nicht funktionieren,
Expand Down
2 changes: 1 addition & 1 deletion ch04-01-what-is-ownership.html
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ <h4 id="variablen-und-daten-im-zusammenspiel-mit-move"><a class="header" href="#
| ++++++++

For more information about this error, try `rustc --explain E0382`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
</code></pre>
<p>Wenn du beim Arbeiten mit anderen Sprachen schon mal die Begriffe <em>flache
Kopie</em> (shallow copy) und <em>tiefe Kopie</em> (deep copy) gehört hast, hört sich das
Expand Down
24 changes: 16 additions & 8 deletions ch04-02-references-and-borrowing.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,16 @@ <h2 id="referenzen-und-ausleihen-borrowing"><a class="header" href="#referenzen-
error[E0596]: cannot borrow `*some_string` as mutable, as it is behind a `&amp;` reference
--&gt; src/main.rs:8:5
|
7 | fn change(some_string: &amp;String) {
| ------- help: consider changing this to be a mutable reference: `&amp;mut String`
8 | some_string.push_str(" Welt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `some_string` is a `&amp;` reference, so the data it refers to cannot be borrowed as mutable
| ^^^^^^^^^^^ `some_string` is a `&amp;` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
7 | fn change(some_string: &amp;mut String) {
| +++

For more information about this error, try `rustc --explain E0596`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
</code></pre>
<p>So wie Variablen standardmäßig unveränderbar sind, so sind auch Referenzen
unveränderbar. Es ist uns nicht erlaubt, etwas zu verändern, auf das wir eine
Expand Down Expand Up @@ -328,7 +331,7 @@ <h3 id="veränderbare-referenzen"><a class="header" href="#veränderbare-referen
| -- first borrow later used here

For more information about this error, try `rustc --explain E0499`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
</code></pre>
<p>Dieser Fehler besagt, dass dieser Code ungültig ist, weil wir <code>s</code> nicht mehr
als einmal zur gleichen Zeit als veränderbar ausleihen können. Die erste
Expand Down Expand Up @@ -395,7 +398,7 @@ <h3 id="veränderbare-referenzen"><a class="header" href="#veränderbare-referen
| -- immutable borrow later used here

For more information about this error, try `rustc --explain E0502`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
</code></pre>
<p>Puh! Wir können auch keine veränderbaren Referenzen verwenden, solange wir eine
unveränderbare Referenz auf denselben Wert haben.</p>
Expand Down Expand Up @@ -462,13 +465,18 @@ <h3 id="hängende-referenzen"><a class="header" href="#hängende-referenzen">Hä
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
|
5 | fn dangle() -&gt; &amp;'static String {
| +++++++
help: instead, you are more likely to want to return an owned value
|
5 - fn dangle() -&gt; &amp;String {
5 + fn dangle() -&gt; String {
|

For more information about this error, try `rustc --explain E0106`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
</code></pre>
<p>Diese Fehlermeldung bezieht sich auf eine Funktionalität, die wir noch nicht
behandelt haben: Die Lebensdauer. Wir werden die Lebensdauer in Kapitel 10 im
Expand Down
2 changes: 1 addition & 1 deletion ch04-03-slices.html
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ <h3 id="zeichenkettenanteilstypen-string-slices"><a class="header" href="#zeiche
| ---- immutable borrow later used here

For more information about this error, try `rustc --explain E0502`.
error: could not compile `ownership` due to previous error
error: could not compile `ownership` (bin "ownership") due to 1 previous error
</code></pre>
<p>Erinnere dich an die Ausleihregeln, durch die wir, wenn wir eine
unveränderbare Referenz auf etwas haben, nicht noch eine veränderbare
Expand Down
2 changes: 1 addition & 1 deletion ch05-01-defining-structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ <h3 id="eigentümerschaft-von-strukturdaten"><a class="header" href="#eigentüme
|

For more information about this error, try `rustc --explain E0106`.
error: could not compile `structs` due to 2 previous errors
error: could not compile `structs` (bin "structs") due to 2 previous errors
</code></pre>
<p>In Kapitel 10 werden wir klären, wie man diese Fehler behebt und Referenzen
in Strukturen speichern kann. Aber für den Moment werden wir Fehler wie diese
Expand Down
4 changes: 2 additions & 2 deletions ch05-02-example-structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ <h3 id="hilfreiche-funktionalität-mit-abgeleiteten-merkmalen-derived-traits"><a
Compiling rectangles v0.1.0 (file:///projects/rectangles)
Finished dev [unoptimized + debuginfo] target(s) in 0.61s
Running `target/debug/rectangles`
[src/main.rs:10] 30 * scale = 60
[src/main.rs:14] &amp;rect1 = Rectangle {
[src/main.rs:10:16] 30 * scale = 60
[src/main.rs:14:5] &amp;rect1 = Rectangle {
width: 60,
height: 50,
}
Expand Down
6 changes: 3 additions & 3 deletions ch06-01-defining-an-enum.html
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,13 @@ <h3 id="die-aufzählung-option-und-ihre-vorteile-gegenüber-nullwerten"><a class
|
= help: the trait `Add&lt;Option&lt;i8&gt;&gt;` is not implemented for `i8`
= help: the following other types implement trait `Add&lt;Rhs&gt;`:
&lt;i8 as Add&gt;
&lt;i8 as Add&lt;&amp;i8&gt;&gt;
&lt;&amp;'a i8 as Add&lt;i8&gt;&gt;
&lt;&amp;i8 as Add&lt;&amp;i8&gt;&gt;
&lt;i8 as Add&lt;&amp;i8&gt;&gt;
&lt;i8 as Add&gt;

For more information about this error, try `rustc --explain E0277`.
error: could not compile `enums` due to previous error
error: could not compile `enums` (bin "enums") due to 1 previous error
</code></pre>
<p>Stark! Tatsächlich bedeutet diese Fehlermeldung, dass Rust nicht versteht, wie
man ein <code>i8</code> und eine <code>Option&lt;i8&gt;</code> addiert, da es sich um unterschiedliche Typen
Expand Down
8 changes: 4 additions & 4 deletions ch06-02-match.html
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ <h3 id="abgleiche-sind-vollständig"><a class="header" href="#abgleiche-sind-vol
| ^ pattern `None` not covered
|
note: `Option&lt;i32&gt;` defined here
--&gt; /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/option.rs:518:1
--&gt; /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:570:1
::: /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:574:5
|
= note:
/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/option.rs:522:5: not covered
= note: not covered
= note: the matched value is of type `Option&lt;i32&gt;`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
Expand All @@ -420,7 +420,7 @@ <h3 id="abgleiche-sind-vollständig"><a class="header" href="#abgleiche-sind-vol
|

For more information about this error, try `rustc --explain E0004`.
error: could not compile `enums` due to previous error
error: could not compile `enums` (bin "enums") due to 1 previous error
</code></pre>
<p>Rust weiß, dass wir nicht alle möglichen Fälle abgedeckt haben, und es weiß
sogar, welches Muster wir vergessen haben! Abgleiche in Rust sind
Expand Down
12 changes: 8 additions & 4 deletions ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ <h2 id="mit-pfaden-auf-ein-element-im-modulbaum-verweisen"><a class="header" hre
--&gt; src/lib.rs:9:28
|
9 | crate::front_of_house::hosting::add_to_waitlist();
| ^^^^^^^ private module
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
| |
| private module
|
note: the module `hosting` is defined here
--&gt; src/lib.rs:2:5
Expand All @@ -262,7 +264,9 @@ <h2 id="mit-pfaden-auf-ein-element-im-modulbaum-verweisen"><a class="header" hre
--&gt; src/lib.rs:12:21
|
12 | front_of_house::hosting::add_to_waitlist();
| ^^^^^^^ private module
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
| |
| private module
|
note: the module `hosting` is defined here
--&gt; src/lib.rs:2:5
Expand All @@ -271,7 +275,7 @@ <h2 id="mit-pfaden-auf-ein-element-im-modulbaum-verweisen"><a class="header" hre
| ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `restaurant` due to 2 previous errors
error: could not compile `restaurant` (lib) due to 2 previous errors
</code></pre>
<p><span class="caption">Codeblock 7-4: Kompilierfehler im Code in Codeblock
7-3</span></p>
Expand Down Expand Up @@ -351,7 +355,7 @@ <h3 id="pfade-mit-dem-schlüsselwort-pub-öffentlich-machen"><a class="header" h
| ^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `restaurant` due to 2 previous errors
error: could not compile `restaurant` (lib) due to 2 previous errors
</code></pre>
<p><span class="caption">Codeblock 7-6: Kompilierfehler im Code in Codeblock
7-5</span></p>
Expand Down
19 changes: 12 additions & 7 deletions ch07-04-bringing-paths-into-scope-with-the-use-keyword.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,17 @@ <h2 id="pfade-in-den-gültigkeitsbereich-bringen-mit-dem-schlüsselwort-use"><a
nicht mehr gilt:</p>
<pre><code class="language-console">$ cargo build
Compiling restaurant v0.1.0 (file:///projects/restaurant)
error[E0433]: failed to resolve: use of undeclared crate or module `hosting`
--&gt; src/lib.rs:11:9
|
11 | hosting::add_to_waitlist();
| ^^^^^^^ use of undeclared crate or module `hosting`
|
help: consider importing this module through its public re-export
|
10 + use crate::hosting;
|

warning: unused import: `crate::front_of_house::hosting`
--&gt; src/lib.rs:7:5
|
Expand All @@ -232,15 +243,9 @@ <h2 id="pfade-in-den-gültigkeitsbereich-bringen-mit-dem-schlüsselwort-use"><a
|
= note: `#[warn(unused_imports)]` on by default

error[E0433]: failed to resolve: use of undeclared crate or module `hosting`
--&gt; src/lib.rs:11:9
|
11 | hosting::add_to_waitlist();
| ^^^^^^^ use of undeclared crate or module `hosting`

For more information about this error, try `rustc --explain E0433`.
warning: `restaurant` (lib) generated 1 warning
error: could not compile `restaurant` due to previous error; 1 warning emitted
error: could not compile `restaurant` (lib) due to 1 previous error; 1 warning emitted
</code></pre>
<p>Beachte, dass es auch eine Warnung gibt, dass <code>use</code> nicht mehr in seinem
Gültigkeitsbereich verwendet wird! Um dieses Problem zu beheben, verschiebe
Expand Down
Loading

0 comments on commit 44d601b

Please sign in to comment.