100-exercises-to-learn-rust icon indicating copy to clipboard operation
100-exercises-to-learn-rust copied to clipboard

05_ticket_v2/05_nullability code example does not compile/run

Open michaelkebe opened this issue 1 year ago • 2 comments

Chapter 5.5 Nullability

https://rust-exercises.com/100-exercises/05_ticket_v2/05_nullability#tuples

Clicking the run icon produces:

   Compiling playground v0.0.1 (/playground)
error[E0425]: cannot find value `second` in this scope
 --> src/main.rs:3:12
  |
3 | assert_eq!(second.0, -42);
  |            ^^^^^^ not found in this scope

error[E0425]: cannot find value `second` in this scope
 --> src/main.rs:4:12
  |
4 | assert_eq!(second.1, 3);
  |            ^^^^^^ not found in this scope

error[E0425]: cannot find value `second` in this scope
 --> src/main.rs:5:12
  |
5 | assert_eq!(second.2, 8);
  |            ^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground` (bin "playground") due to 3 previous errors

The code right above is not included in the snippet. It should be included, but hidden.

michaelkebe avatar Aug 15 '24 12:08 michaelkebe

This is an issue with multiple other code snippets, too. For now, I'd suggest disabling running the incomplete code examples. In a later stage, I agree it would be good to include and hide the setup code in the examples

hdoordt avatar Aug 16 '24 09:08 hdoordt

It was never the intention for code samples to be runnable as-is, that's a side-effect of using mdbook and failing to annotate all snippets 😅 I agree the solution is to mark them as no-run.

LukeMathWalker avatar Aug 16 '24 10:08 LukeMathWalker