Skip to content

Commit 95c9e5a

Browse files
committed
docs: repoint the cross-references the split invalidated, and put chapter 17 back in order
Moving six sections out of 05 left references behind that pointed at section numbers which had moved with them. Fourteen in the two languages: `§2.8.1` from inside the chapter that now contains it, `§2.13` from the chapter that now IS it, `§2.14` from the chapter it moved to, `§2.7.1` from the chapter it left. Each is repointed at the chapter that holds the content now, or at the section of the same chapter when the reference became local. Chapter 17's 'Related chapters' had ended up in the middle, and its own bullet for 05 said 'every manifest key, including [xlings]' -- the one claim the move made false. It is last again, renumbered, and 05 is described as the rest of the manifest. This is what the review pass is for: a mechanical move keeps every heading structure valid and leaves the prose pointing at the old shape.
1 parent 9463bfe commit 95c9e5a

8 files changed

Lines changed: 43 additions & 43 deletions

docs/07-build-mcpp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ mcpp builds that `kind = "bin"` target **for the build machine** (even under
376376
`--target`), caches it globally, and returns the path. The request lives in
377377
`mcpp.toml` rather than here for the same reason a dependency does: asking the
378378
graph for an extra artifact is a graph-level request, and the graph stays
379-
statically analysable. See [05 §2.14](05-mcpp-toml.md) for the full contract,
379+
statically analysable. See *Host tools from a dependency* in this chapter for the full contract,
380380
including `[tools.overrides]` and `reexport = true` (which is how a library
381381
provides the whole toolchain, so a project declares **one** dependency instead of
382382
four).
@@ -1079,7 +1079,7 @@ plugins = { version = "0.3.0", features = ["rules-spirv"], host-module = true }
10791079
```
10801080

10811081
**`[build-dependencies]`, not `[dependencies]`** — a rule package is the case
1082-
§2.6.1 describes exactly: its library must never reach the target while its
1082+
[05 §2.6.1](05-mcpp-toml.md) describes exactly: its library must never reach the target while its
10831083
rule is still wanted. The two axes are separate, so `host-module = true` says
10841084
*which build-time product* is wanted and the section says *whether the package
10851085
reaches the target*; a rule package answers "no" on the second axis, and the
@@ -1213,6 +1213,6 @@ unsupported platform into an error its user cannot edit away. Scope it:
12131213
```
12141214

12151215
`[target.<sel>.feature-deps.<feature>]` (2026.8.6.2+) follows the same rules as
1216-
the other conditional dependency tables (§2.7.1). The **feature itself is
1216+
the other conditional dependency tables ([14 — The Target Side](14-target-side.md)). The **feature itself is
12171217
registered on every platform** — only what it pulls in is conditional — so
12181218
requesting it where no predicate matches is not an unknown-feature error.

docs/14-target-side.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ The selector `<sel>` has three forms:
342342
|---|---|---|
343343
| **bare OS alias** | a single OS / family — the concise, common form | `[target.windows]`, `[target.unix]` |
344344
| **`cfg(...)` predicate** | a compound condition (arch / env / combinators) | `[target.'cfg(all(linux, not(arch = "aarch64")))']` |
345-
| **exact triple** | one specific target (also carries `toolchain` / `linkage` / `sysroot` / `runner`; see §2.7.3) | `[target.x86_64-linux-musl]` |
345+
| **exact triple** | one specific target (also carries `toolchain` / `linkage` / `sysroot` / `runner`; see [05 §2.7.3](05-mcpp-toml.md)) | `[target.x86_64-linux-musl]` |
346346

347347
A selector may carry platform-conditional **dependencies** and **build flags**:
348348

@@ -365,7 +365,7 @@ there is no ambiguity. Use the bare form for a single OS/family; use `cfg(...)`
365365
for arch/env conditions and combinators.
366366

367367
- **Keys**: `dependencies` / `dev-dependencies` / `build-dependencies` /
368-
`feature-deps.<feature>` (mcpp 2026.8.6.2+ — see §2.14; the feature is
368+
`feature-deps.<feature>` (mcpp 2026.8.6.2+ — see [07 — build.mcpp](07-build-mcpp.md); the feature is
369369
registered unconditionally, only its dependency set is scoped), and
370370
`build` with `cflags` / `cxxflags` / `ldflags` / `sources` (mcpp 0.0.95+ —
371371
conditional source globs, e.g. gating `src/x86/**/*.asm` behind

docs/17-the-project-environment.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ package the host cannot install is an error, not a skipped entry. A tool that
166166
exists for one host platform only is therefore declared for that platform
167167
(2026.9.2.1): `deps = [{ linux = "qemu-user-aarch64" }]` declares the emulator
168168
on Linux and nothing elsewhere. The keys and the resolution rule are in
169-
chapter 5, §2.13.
169+
this chapter.
170170

171171
**Which verbs install it.** An entry may name a tier —
172172
`{ version = "0.24.0", when = "run" }` — and a `[feature-xlings.<feature>]`
173173
table gates one on a feature. A tool the project will not use is then not
174-
downloaded: chapter 5, §2.13. Omitting the tier is the historical behaviour.
174+
downloaded: this chapter. Omitting the tier is the historical behaviour.
175175

176176
**The runner.** A program under `[xlings.workspace]` is also where
177177
`[target.<triple>].runner` looks first for its first element, before `PATH`
178-
(chapter 5, §2.7.3). The two keys together provision a user-mode emulator on a
178+
([05 §2.7.3](05-mcpp-toml.md)). The two keys together provision a user-mode emulator on a
179179
CI host and execute a cross-built artifact through it, without the manifest
180180
naming the payload's path.
181181

@@ -190,15 +190,7 @@ naming the payload's path.
190190
| a tool only one verb or one feature needs | `when = "run"`, `[feature-xlings.<f>]` |
191191
| which environment | `[xlings] subos` |
192192

193-
## 7. Related chapters
194-
195-
- [7 - build.mcpp](07-build-mcpp.md) — the contract a build program receives,
196-
including the `PATH` it runs with.
197-
- [8 - Toolchain Internals](08-toolchain-internals.md) — runtime selection,
198-
the `RuntimeBinding` snapshot, and the degradation rules.
199-
- [5 - mcpp.toml](05-mcpp-toml.md) — every manifest key, including `[xlings]`.
200-
201-
## `[xlings]` — the project's environment
193+
## 7. `[xlings]` — the manifest keys
202194

203195
```toml
204196
[xlings.workspace] # what this project's environment contains
@@ -514,3 +506,11 @@ exact version of that package cannot edit.
514506
program's environment is declared by its own package, and an environment's by
515507
that environment. The key is now an error naming both. Nothing in the index
516508
used it.
509+
510+
## 8. Related chapters
511+
512+
- [7 - build.mcpp](07-build-mcpp.md) — the contract a build program receives,
513+
including the `PATH` it runs with.
514+
- [8 - Toolchain Internals](08-toolchain-internals.md) — runtime selection,
515+
the `RuntimeBinding` snapshot, and the degradation rules.
516+
- [5 - mcpp.toml](05-mcpp-toml.md) — the rest of the manifest.

docs/22-features-and-capabilities.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ feature carry package-owned preprocessor `defines`, feature-gated source globs
3838
the feature is active, exactly like an index descriptor's `features.<f>.sources`;
3939
the highest-frequency shape for vendored libraries: *feature = a source set + a
4040
define*), feature-gated per-glob compile flags (`flags`, mcpp 0.0.101+), and/or
41-
capability `requires` / `provides` (see §2.8.1) alongside its implied features:
41+
capability `requires` / `provides` (see *`provides` / `requires`* below) alongside its implied features:
4242

4343
```toml
4444
[features]
@@ -67,11 +67,11 @@ simd = { sources = ["src/simd/**"], flags = [
6767
defines`. They are restricted by convention to the package's **own** namespaced
6868
macros: a feature does **not** inject free-form package-wide `cflags`/`ldflags`,
6969
which would break the additive feature-union model. Link flags come from a
70-
provider dependency (§2.8.1), not from a feature.
70+
provider dependency (see *`provides` / `requires`* below), not from a feature.
7171
- The automatic `-DMCPP_FEATURE_<NAME>` is still defined for every active feature,
7272
so `defines` are additive to it.
7373
- `flags` (mcpp 0.0.101+) is the same ordered array-of-inline-tables grammar as
74-
`[build].flags` (§2.3: `glob` required, plus `cflags`/`cxxflags`/`asmflags`/
74+
`[build].flags` ([05 §2.3](05-mcpp-toml.md): `glob` required, plus `cflags`/`cxxflags`/`asmflags`/
7575
`defines`; the `[[features.<name>.flags]]` array-of-tables spelling is accepted
7676
too, like `[[build.flags]]`). When the feature is active the entries
7777
are appended **after** the base `[build].flags`, features in name order, so a
@@ -348,7 +348,7 @@ implementation cannot be fetched is a feature that does not exist, and a project
348348
using a **path** dependency during development never consults the index — so the
349349
failure appears only after publication, to somebody else.
350350

351-
This composes with capabilities (§2.8.1): a single `backend-openblas` feature
351+
This composes with capabilities (*`provides` / `requires`* above): a single `backend-openblas` feature
352352
both **pulls** the provider (`compat.openblas`, which `provides = ["blas"]`) and
353353
**turns on** the consumer switch (`implies = ["use_blas"]`, which
354354
`requires = ["blas"]`). With one provider in the graph the capability binds
@@ -398,7 +398,7 @@ Two properties make this preferable to shipping the implementation
398398
unconditionally. A library that ships one takes a decision belonging to the
399399
program, and it cannot be undone: features are **additive**, so there is no way
400400
for a consumer to switch a default *off*. And because a dependency package's
401-
objects link unconditionally (§2.8.1), a shipped default plus a program-supplied
401+
objects link unconditionally (*`provides` / `requires`* above), a shipped default plus a program-supplied
402402
one is a duplicate definition rather than a replacement — the archive semantics
403403
that let a C++ standard library offer a replaceable `operator new` do not apply
404404
to a package dependency. Keeping the implementation behind a switch means the

docs/zh/07-build-mcpp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ mcpp 会**为构建机器**构建那个 `kind = "bin"` target(即使在 `--targe
324324
全局缓存,并把路径交回。这个请求写在 `mcpp.toml` 而不是这里,理由和依赖本身
325325
一样:向依赖图索取一个额外产物是**图级别**的请求,而图必须保持可静态分析。
326326
完整契约(含 `[tools.overrides]``reexport = true` —— 库据此把整条工具链交给
327-
调用方,因此只需写**一条**依赖而不是四条)[05 §2.14](05-mcpp-toml.md)
327+
调用方,因此只需写**一条**依赖而不是四条)见本章*依赖产出的 host 工具*
328328

329329
### 用通配符声明输入:`rerun_if_changed_glob`(2026.8.6.2+)
330330

@@ -907,7 +907,7 @@ rules-spirv = { sources = ["rules/spirv.cppm"] } # export module mcpp.rules.spir
907907
plugins = { version = "0.3.0", features = ["rules-spirv"], host-module = true }
908908
```
909909

910-
**`[build-dependencies]` 而不是 `[dependencies]`** —— 规则包正是 §2.6.1 描述的那种
910+
**`[build-dependencies]` 而不是 `[dependencies]`** —— 规则包正是 [05 §2.6.1](05-mcpp-toml.md) 描述的那种
911911
情形:它的库绝不该到达目标,而它的规则仍然被需要。两条轴是分开的:
912912
`host-module = true` 说的是**要哪一种构建期产物**,而 section 说的是**这个包是否到达
913913
目标**;规则包在第二条轴上的答案是"否",而 section 就是说这件事的地方。写在

docs/zh/14-target-side.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ mcpp 不认识的键 —— 打错的字,或来自更新版本 mcpp 的谓词
290290
|---|---|---|
291291
| **裸 OS 别名** | 单个 OS / 族 —— 简洁且常用的形式 | `[target.windows]``[target.unix]` |
292292
| **`cfg(...)` 谓词** | 复合条件(arch / env / 组合子) | `[target.'cfg(all(linux, not(arch = "aarch64")))']` |
293-
| **精确三元组** | 某个具体目标(同时承载 `toolchain` / `linkage` / `sysroot` / `runner`,见 §2.7.3) | `[target.x86_64-linux-musl]` |
293+
| **精确三元组** | 某个具体目标(同时承载 `toolchain` / `linkage` / `sysroot` / `runner`,见 [05 §2.7.3](05-mcpp-toml.md)) | `[target.x86_64-linux-musl]` |
294294

295295
一个选择器可以承载平台条件的**依赖****构建 flag**:
296296

@@ -312,7 +312,7 @@ cxxflags = ["-march=x86-64-v2"]
312312
单个 OS/族用裸形式,arch/env 条件与组合子用 `cfg(...)`
313313

314314
- **可用键**:`dependencies` / `dev-dependencies` / `build-dependencies` /
315-
`feature-deps.<feature>`(mcpp 2026.8.6.2+ —— 见 §2.14;feature 本身无条件注册,
315+
`feature-deps.<feature>`(mcpp 2026.8.6.2+ —— 见 [07 —— build.mcpp](07-build-mcpp.md);feature 本身无条件注册,
316316
只有它的依赖集合受限定),以及带 `cflags` / `cxxflags` / `ldflags` / `sources`
317317
`build`(mcpp 0.0.95+ —— 条件源码 glob,例如把 `src/x86/**/*.asm` 收在
318318
`cfg(arch = "x86_64")` 之后;`!` 排除 glob 在此同样有效),再加 `flags`

docs/zh/17-the-project-environment.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ create/bootstrap that environment instead of falling back to active/default
131131
这份声明在每台构建本工程的宿主上都会供给,宿主装不了的包是错误,不是被跳过的条目。
132132
只存在于某一个宿主平台的工具因此按平台声明(2026.9.2.1):
133133
`deps = [{ linux = "qemu-user-aarch64" }]` 在 Linux 上声明这个模拟器,在别处什么都不声明。
134-
键与解析规则见第 5 章 §2.13
134+
键与解析规则见本章
135135

136136
**哪些命令会安装它。** 一条条目可以带档位 —— `{ version = "0.24.0", when = "run" }` ——
137137
`[feature-xlings.<feature>]` 则把工具挂在某个 feature 上。用不到的工具因此不会被下载:
138-
见第 5 章 §2.13。不写档位就是从前的行为。
138+
见本章。不写档位就是从前的行为。
139139

140140
**runner。** `[xlings.workspace]` 下的程序也是 `[target.<triple>].runner` 查找其第一个元素
141-
的首选位置,在 `PATH` 之前(第 5 章 §2.7.3)。两个键合起来,在 CI 宿主上供给用户态模拟器,
141+
的首选位置,在 `PATH` 之前([05 §2.7.3](05-mcpp-toml.md))。两个键合起来,在 CI 宿主上供给用户态模拟器,
142142
并通过它执行交叉构建的产物,而清单不必写出载荷的路径。
143143

144144
## 6. 什么该写在别处
@@ -152,15 +152,7 @@ create/bootstrap that environment instead of falling back to active/default
152152
| 只有某个命令或某个 feature 需要的工具 | `when = "run"``[feature-xlings.<f>]` |
153153
| 用哪个环境 | `[xlings] subos` |
154154

155-
## 7. 相关章节
156-
157-
- [7 - build.mcpp](07-build-mcpp.md) —— 构建程序收到的契约,含它运行时的
158-
`PATH`
159-
- [8 - 工具链内部](08-toolchain-internals.md) —— 运行时选择、`RuntimeBinding`
160-
快照与降级规则。
161-
- [5 - mcpp.toml](05-mcpp-toml.md) —— 全部清单键,含 `[xlings]`
162-
163-
## `[xlings]` — 工程的环境
155+
## 7. `[xlings]` —— manifest 键
164156

165157
```toml
166158
[xlings.workspace] # 这个工程的环境里有什么
@@ -428,3 +420,11 @@ error: `xim:cuda-nvcc` is pinned to 12.0.0 by this project, and mcpp:plugins
428420
`[xlings.envs]` 曾被物化进 `.xlings.json`,而没有任何东西读它:程序的环境由它自己
429421
的包声明,环境的环境由那个环境声明。现在这个键是错误,并同时点名这两者。索引里没有
430422
任何包用过它。
423+
424+
## 8. 相关章节
425+
426+
- [7 - build.mcpp](07-build-mcpp.md) —— 构建程序收到的契约,含它运行时的
427+
`PATH`
428+
- [8 - 工具链内部](08-toolchain-internals.md) —— 运行时选择、`RuntimeBinding`
429+
快照与降级规则。
430+
- [5 - mcpp.toml](05-mcpp-toml.md) —— manifest 的其余部分。

docs/zh/22-features-and-capabilities.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Feature 是一个包提供可选内容的方式:一个编译宏、一份额外
1717
0.0.95+——列出的 glob 离开默认构建,仅当 feature 激活时才编译,与 index 描述符的
1818
`features.<f>.sources` 完全对等;这正是 vendored 大库最高频的形态:*feature =
1919
一组源文件 + 一个 define*)、feature 门控的 per-glob 编译旗标(`flags`,mcpp
20-
0.0.101+),以及 capability 的 `requires` / `provides`(见 §2.8.1):
20+
0.0.101+),以及 capability 的 `requires` / `provides`(见下文*`provides` / `requires`*):
2121

2222
```toml
2323
[features]
@@ -42,9 +42,9 @@ simd = { sources = ["src/simd/**"], flags = [
4242
- `defines`****宏名(不带 `-D`);feature 激活时每个脱糖为 `-D<x>`,加到该包
4343
自己的编译上——与 `[targets.*] defines` 完全一致。按约定仅限包**自有**的带命名
4444
空间宏:feature ****注入自由的包级 `cflags`/`ldflags`,否则会破坏加性的 feature
45-
并集模型。链接旗标来自 provider 依赖(§2.8.1),而非 feature。
45+
并集模型。链接旗标来自 provider 依赖(见下文*`provides` / `requires`*),而非 feature。
4646
- 每个激活的 feature 仍会得到自动的 `-DMCPP_FEATURE_<NAME>`,`defines` 与之叠加。
47-
- `flags`(mcpp 0.0.101+)与 `[build].flags`(§2.3)共用同一有序 inline-table 数组
47+
- `flags`(mcpp 0.0.101+)与 `[build].flags`([05 §2.3](05-mcpp-toml.md))共用同一有序 inline-table 数组
4848
文法(`glob` 必填,加 `cflags`/`cxxflags`/`asmflags`/`defines`;与
4949
`[[build.flags]]` 一样也接受 `[[features.<name>.flags]]` 拼写)。feature 激活时
5050
条目追加在 base `[build].flags` **之后**(feature 按名
@@ -284,7 +284,7 @@ compat.openblas = "0.3"
284284
feature**,而开发期使用 **path** 依赖的工程根本不查索引 —— 该失败只在发布之后才出现,
285285
而且是出现在别人身上。
286286

287-
该机制与能力(§2.8.1)组合:单个 `backend-openblas` feature 既**拉取** provider
287+
该机制与能力(上文*`provides` / `requires`*)组合:单个 `backend-openblas` feature 既**拉取** provider
288288
(`compat.openblas`,其 `provides = ["blas"]`),又**开启**消费方开关
289289
(`implies = ["use_blas"]`,其 `requires = ["blas"]`)。当图中只有一个 provider 时,
290290
能力自动绑定——消费方只需写 `features = ["backend-openblas"]`
@@ -329,6 +329,6 @@ std-freestanding-alloc-kal = "0.1.x"
329329

330330
有两条性质使该形状优于无条件随包提供实现。随包提供实现的库替程序做了本属程序的决定,
331331
而且**撤销不掉**:feature**加性**的,消费方没有把某个默认**关掉**的手段。以及,由于
332-
依赖包的目标文件无条件参与链接(§2.8.1),随包的默认加上程序自备的那份是**重复定义**
332+
依赖包的目标文件无条件参与链接(上文*`provides` / `requires`*),随包的默认加上程序自备的那份是**重复定义**
333333
而非替换 —— 让 C++ 标准库能提供可替换 `operator new` 的那套归档语义,对包依赖并不适用。
334334
把实现放在开关之后,意味着两者**从不共存**

0 commit comments

Comments
 (0)