jevsnes.git / third-party / rust / top / README.md

Chapter 21: top, an empty file with a job

This is the shortest chapter, about the shortest file in the repository. lib.rs in here is empty, and it has to exist.

Chapter 19's Cargo.toml is a list of dependencies, but cargo and reindeer only accept a list of dependencies if it belongs to a package, and a package must have something to build. So the manifest declares one:

[package]
name = "rust-third-party"

[lib]
path = "top/lib.rs"

and this is that something. Nothing compiles it into anything that runs, and nothing depends on it. It is a doorstop: the door is the whole third-party graph, and it stays open because this is wedged under it.

Aside. The same trick turns up wherever Rust is built by something other than cargo: a stand-in top-level crate whose only purpose is to hold the dependency list. reindeer's own examples name theirs top too.

Try it. wc -c third-party/rust/top/lib.rs prints 0, and grep -n top third-party/rust/Cargo.toml shows the one line that needs it.

For the people who maintain it

In this folder

PathWhat
lib.rsEmpty, on purpose.
README.mdThis chapter.
CLAUDE.mdLeave it alone, for agents.

← Previous: Chapter 20, fixups/ · Up: rust · Next: Chapter 22, research/ →