1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-07-12 17:20:14 +02:00

Use a more coincise symbol to signal compilation errors in slides

This commit is contained in:
LukeMathWalker
2025-07-07 13:33:25 +02:00
parent 14deb7ec4c
commit 93f198051e
2 changed files with 3 additions and 6 deletions

View File

@ -19,8 +19,7 @@ fn double(n: u64) -> u64 {
n * 2
}
// This doesn't compile
double(UserId(1));
double(UserId(1)); // 🛠️
```
The Rust compiler won't implicitly convert to (or from) the underlying type.\
@ -28,8 +27,7 @@ It won't let you use methods or operators defined on the underlying type either:
```rust,compile_fail
# pub struct UserId(u64);
// This doesn't compile
assert_ne!(UserId(1), UserId(2));
assert_ne!(UserId(1), UserId(2)); // 🛠️
```
<details>

View File

@ -35,8 +35,7 @@ pub fn login(username: &Username, password: &Password) -> Result<(), LoginError>
# let password = Password("password".into());
# let username = Username("username".into());
// Compiler error 🎉
login(password, username);
login(password, username); // 🛠️❌
```
<details>