Skip to content

Commit 0ad8ef9

Browse files
Merge remote-tracking branch 'origin/master' into mr/530-rust-essentials-no-you-in-content
2 parents c3d743d + 65bf688 commit 0ad8ef9

110 files changed

Lines changed: 1115 additions & 884 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

courses/ada_essentials/190_exceptions/02-handlers.rst

Lines changed: 36 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -197,53 +197,45 @@ Exception Handler Content
197197
Quiz
198198
------
199199

200-
.. container:: latex_environment scriptsize
201-
202-
.. container:: columns
203-
204-
.. container:: column
205-
206-
.. code:: Ada
207-
:number-lines: 1
208-
209-
procedure Main is
210-
A, B, C, D : Integer range 0 .. 100;
211-
begin
212-
A := 1; B := 2; C := 3; D := 4;
213-
begin
214-
D := A - C + B;
215-
exception
216-
when others => Put_Line ("One");
217-
D := 1;
218-
end;
219-
D := D + 1;
220-
begin
221-
D := D / (A - C + B);
222-
exception
223-
when others => Put_Line ("Two");
224-
D := -1;
225-
end;
226-
exception
227-
when others =>
228-
Put_Line ("Three");
229-
end Main;
230-
231-
.. container:: column
200+
.. code:: Ada
201+
:number-lines: 1
202+
:font-size: footnotesize
232203
233-
What will get printed?
204+
procedure Main is
205+
A, B, C, D : Integer range 0 .. 100;
206+
begin
207+
A := 1; B := 2; C := 3; D := 4;
208+
begin
209+
D := A - C + B;
210+
exception
211+
when others => Put_Line ("One");
212+
D := 1;
213+
end;
214+
D := D + 1;
215+
begin
216+
D := D / (A - C + B);
217+
exception
218+
when others => Put_Line ("Two");
219+
D := -1;
220+
end;
221+
exception
222+
when others =>
223+
Put_Line ("Three");
224+
end Main;
234225
235-
A. One, Two, Three
236-
B. :answer:`Two, Three`
237-
C. Two
238-
D. Three
226+
What will get printed?
239227

240-
.. container:: animate
228+
A. One, Two, Three
229+
B. :answer:`Two, Three`
230+
C. Two
231+
D. Three
241232

242-
Explanations
233+
.. container:: animate
243234

244-
A. :ada:`One` is never printed, as although :ada:`(A - C)` is not in the range of :ada:`0 .. 100`, this is only checked on assignment (so after the addition of :ada:`B`).
245-
B. Line 6 does not raise an exception, (so ``One`` is not printed), but Line 2 does - causing ``Two`` to be printed.
246-
But Line 16 also raises an exception, causing ``Three`` to be printed
247-
C. If we reach :ada:`Two`, the assignment on line 16 will cause :ada:`Three` to be reached
248-
D. Divide by 0 on line 13 causes an exception, so :ada:`Two` must be called
235+
Explanations
249236

237+
A. :ada:`One` is never printed. Although :ada:`(A - C)` is not in range, this is only checked on assignment (after addition of :ada:`B`).
238+
B. No exception on Line 6 (``One`` is not printed), but Line 2 does - so ``Two`` to be printed.
239+
Line 16 also raises an exception, so ``Three`` to be printed.
240+
C. If we reach :ada:`Two`, line 16 will cause :ada:`Three` to be reached
241+
D. Divide by 0 on line 13 causes an exception, so :ada:`Two` must be called

courses/ada_essentials/190_exceptions/06-propagation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Propagation Demo
3636

3737
.. code:: Ada
3838
:number-lines: 1
39+
:font-size: small
3940
4041
procedure Do_Something is
4142
Error : exception;
@@ -56,6 +57,7 @@ Propagation Demo
5657

5758
.. code:: Ada
5859
:number-lines: 16
60+
:font-size: small
5961
6062
begin -- Do_Something
6163
Maybe_Raise (3);

courses/ada_essentials/230_interfacing_with_c/02-import__export.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Import / Export Aspects (1/2)
1111
* :ada:`Import` indicates a subprogram imported into Ada
1212
* :ada:`Export` indicates a subprogram exported from Ada
1313

14-
* Need aspects definining calling convention and external name
14+
* Need aspects defining calling convention and external name
1515

1616
* :ada:`Convention => C` tells linker to use C-style calling convention
1717
* :ada:`External_Name => "<name>"` defines object name for linker

courses/ada_essentials/273_subprogram_contracts/02-preconditions_and_postconditions.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ Preventing Exceptions with ... Exceptions?
201201
202202
function Area (Length : Positive;
203203
Height : Positive)
204-
return Positive is
205-
(Length * Height)
204+
return Positive
206205
with Pre => Length * Height <= Positive'Last;
207206
208207
* But what happens when we verify the precondition?
@@ -215,8 +214,8 @@ Preventing Exceptions with ... Exceptions?
215214
216215
function Area (Length : Positive;
217216
Height : Positive)
218-
return Positive is
219-
with Pre => Positive'Last / Height <= Length;
217+
return Positive
218+
with Pre => Length <= Positive'Last / Height;
220219
221220
------
222221
Quiz

courses/rust_essentials/015_overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ Overview
3737
.. container:: PRELUDE END
3838

3939
.. include:: 015_overview/01_what_is_rust.rst
40-
.. include:: 015_overview/02_benefits.rst
40+
.. include:: 015_overview/02_benefits_of_rust.rst
4141
.. include:: 015_overview/03_tooling.rst

courses/rust_essentials/015_overview/01_what_is_rust.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ What Is Rust?
66
What Is Rust?
77
---------------
88

9-
- Rust is a new(er) programming language
9+
- New(er) programming language
1010

1111
- First stable release in 2015 (1.0)
1212
- Modern design to solve older language problems
@@ -15,7 +15,7 @@ What Is Rust?
1515

1616
- :toolname:`rustc` uses LLVM as its backend
1717

18-
- Rust supports many platforms and architectures
18+
- Supports many platforms and architectures
1919

2020
- Linux, Windows, VxWorks...
2121
- x86, ARM ...
@@ -24,7 +24,7 @@ What Is Rust?
2424
What Kind of Language Is Rust?
2525
--------------------------------
2626

27-
**Rust fits in the same area as other systems languages (Ada, C++, ...)**
27+
**Fits in the same area as other systems languages (Ada, C++, ...)**
2828

2929
- High flexibility
3030
- High level of control

courses/rust_essentials/015_overview/02_benefits.rst renamed to courses/rust_essentials/015_overview/02_benefits_of_rust.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Compile Time Memory Safety
2020
No Undefined Runtime Behavior
2121
-------------------------------
2222

23-
**What a Rust statement does is never left unspecified**
23+
**What a statement does is never left unspecified**
2424

2525
- Array access is bounds checked
2626
- Integer overflow is defined (panic or wrap-around)

courses/rust_essentials/015_overview/03_tooling.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ GNAT Pro for Rust
1515

1616
- AdaCore's Rust Development Toolsuite
1717

18-
- :toolname:`cargo` - Rust package manager
19-
- :toolname:`rustc` - Rust compiler
20-
- :toolname:`gdb` - Rust-aware debugger
21-
- :toolname:`rust-analyzer` - Rust language server/IDE integration tool
22-
- :toolname:`clippy` - Rust linter
23-
- :toolname:`rustfmt` - Rust code formatter
18+
- :toolname:`cargo` - package manager
19+
- :toolname:`rustc` - compiler
20+
- :toolname:`gdb` - debugger
21+
- :toolname:`rust-analyzer` - language server/IDE integration tool
22+
- :toolname:`clippy` - linter
23+
- :toolname:`rustfmt` - code formatter
2424
- :toolname:`gprbuild` - AdaCore’s multi-language build tool
2525

2626
- Tooling pairs seamlessly with :toolname:`VS Code`
2727

2828
.. note::
2929

3030
The :url:`Rust Playground <https://play.rust-lang.org/>` provides an easy
31-
way to run short Rust programs, quickly!
31+
way to run short programs, quickly!

courses/rust_essentials/020_hello_world/01_hello_world.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,16 @@ Hello World
4949
.. container:: animate 6-
5050

5151
* :rust:`println!` - macro for printing a string followed by newline
52+
53+
-------------------------
54+
File Naming Conventions
55+
-------------------------
56+
57+
* File extension is :filename:`.rs`
58+
* File name is the module name in :dfn:`snake case`
59+
60+
* All lower case, spaces replaced with underscore
61+
62+
.. note::
63+
64+
:rust:`fn main()` will be in file :filename:`main.rs`

courses/rust_essentials/030_types_and_values/00_introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ Topics Covered
2020

2121
- **Type Inference**
2222

23-
- How Rust is smart enough to often guess the type of data
23+
- How the compiler is smart enough to often guess the type of data

0 commit comments

Comments
 (0)