Skip to content

Commit 93f1980

Browse files
Use a more coincise symbol to signal compilation errors in slides
1 parent 14deb7e commit 93f1980

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/idiomatic/leveraging-the-type-system/newtype-pattern.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ fn double(n: u64) -> u64 {
1919
n * 2
2020
}
2121
22-
// This doesn't compile ❌
23-
double(UserId(1));
22+
double(UserId(1)); // 🛠️❌
2423
```
2524

2625
The Rust compiler won't implicitly convert to (or from) the underlying type.\
2726
It won't let you use methods or operators defined on the underlying type either:
2827

2928
```rust,compile_fail
3029
# pub struct UserId(u64);
31-
// This doesn't compile ❌
32-
assert_ne!(UserId(1), UserId(2));
30+
assert_ne!(UserId(1), UserId(2)); // 🛠️❌
3331
```
3432

3533
<details>

src/idiomatic/leveraging-the-type-system/newtype-pattern/semantic-confusion.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ pub fn login(username: &Username, password: &Password) -> Result<(), LoginError>
3535

3636
# let password = Password("password".into());
3737
# let username = Username("username".into());
38-
// Compiler error 🎉
39-
login(password, username);
38+
login(password, username); // 🛠️❌
4039
```
4140

4241
<details>

0 commit comments

Comments
 (0)