Skip to content

solutions: chapter intro exercises - #102

Open
memark wants to merge 5 commits into
solutionsfrom
fix/chapter-intro-exercises-solutions
Open

memark wants to merge 5 commits into
solutionsfrom
fix/chapter-intro-exercises-solutions

Conversation

@memark

@memark memark commented Nov 10, 2026

Copy link
Copy Markdown
Member

Companion to #101, for the solutions branch.

The chapter 1 and 2 intros are setup checks with nothing to solve, so they're unchanged.

This PR's verify-solutions run is also the first CI run of the new "Install cheadergen and its nightly" step from #101.

Merge after #101.

The exercise linker appends an exercise link to every numbered page,
including the chapter `00_README` pages. Those had no matching exercise
directory, so the appended link 404'd, and it also duplicated the
hand-written "Exercises" section at the end of each page.

Rename the chapter pages to `00_intro.md`, drop the hand-written
sections, and back each one with an exercise that earns its place:

- Chapter 1 checks the C toolchain: `build.rs` compiles a tiny C file
  with `cc` and a test calls into it.
- Chapter 2 checks the two code generators the chapter introduces:
  `bindgen` (and therefore libclang) from `build.rs`, and the
  `cheadergen` CLI from an integration test. `cheadergen` can't run from
  `build.rs` (it deadlocks on Cargo's target-dir lock), but by the time
  test binaries run, Cargo has released the lock.
- Chapter 3 gets the "Take `bm` for a spin" section, moved from
  `01_rewrite_a_module.md`, and asks two questions only running `bm`
  can answer. The tests build `bm` and compare against its output.

`cheadergen` drives its pinned nightly through `rustup`, which the nix
shell doesn't provide, so `verify-solutions` installs both with the
runner's `rustup`, the same way the welcome page tells attendees to.

The existing short-link aliases now point at the new exercise
directories.

Fixes #66
Nix on Linux defines _FORTIFY_SOURCE, which glibc rejects with a
#warning at -O0, and the Makefile's -Werror turns it into an error.
Fix it in the Makefile so every toolchain that defines it is covered.
…tify"

The nix cc wrapper sets _FORTIFY_SOURCE after user flags, so -U in the
Makefile has no effect. Go back to hardeningDisable in the flake.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant