Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4a133f6
Hand each function only the facts of its own text
itsfuad Nov 17, 2026
35ebc89
Merge branch 'fix/where-local-facts'
itsfuad Nov 17, 2026
399e00f
Let structs take type parameters
itsfuad Nov 17, 2026
3c3d74b
Let any declared type have functions
itsfuad Nov 17, 2026
4c358bc
Move the phase crates under crates/kernel
itsfuad Nov 17, 2026
d2c367a
Move bools, strings, casts and panic into the kernel
itsfuad Nov 17, 2026
d13e23c
Group the checker's modules by concept
itsfuad Nov 17, 2026
27b80f0
Catch super paths in the feature-boundary check
itsfuad Nov 17, 2026
076c27d
Give a copy being checked its own state
itsfuad Nov 17, 2026
b22fefe
Remove the language type parameter from the phases
itsfuad Nov 17, 2026
0d6605c
Lay the compiler out by phase and concept
itsfuad Nov 18, 2026
bfce421
Stop tracking the vault notes
itsfuad Nov 18, 2026
e41486f
Ignore commented-out mod lines in the module check
itsfuad Nov 19, 2026
f0b3f3d
Check generic bodies with open types instead of syntax walks
itsfuad Nov 19, 2026
2cedc57
Make places.rs a type dispatch over the owning concepts
itsfuad Nov 19, 2026
bf9e75c
Ask the type table in the places dispatch
itsfuad Nov 19, 2026
9d2fe1d
Point the docs at the moved crate paths
itsfuad Nov 19, 2026
acfc56c
Use Expr::UNDECIDED for the undecided value
itsfuad Nov 19, 2026
581cbcf
Report what is wrong for every copy in generic bodies
itsfuad Nov 19, 2026
e3a6829
Keep the type of a const value each copy gives
itsfuad Nov 19, 2026
6be81e6
Keep per-copy const arguments and walk type parts once
itsfuad Nov 20, 2026
9c3100d
Hold an array length as a constant a copy may give
itsfuad Nov 20, 2026
ac42d9b
Let a const value's type name a type parameter
itsfuad Nov 20, 2026
bd4a449
Stop only the copies that grew too deep
itsfuad Nov 20, 2026
7886f2c
Test each operator and spread count in generic copies
itsfuad Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .claude/vault/02-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ stateDiagram-v2

- `compile_module` walks the module's declarations in order: a function goes
through `Checker::build_function` and out as `Output::Function` (THIR, MIR,
facts); a constant through `Checker::constant` as `Output::Constant`; last
the module's remaining `Output::Facts`.
and only its own facts, `Checker::function_facts`); a constant through
`Checker::constant` as `Output::Constant`; last `Output::Facts`, the facts
no function took (`Checker::other_facts`), with no names of locals. The
checker keeps facts by the declaration they were found in, so a fact
naming a local always goes out with the body that declares it.
- A `ModuleResults` keeps only the file, interface hash, diagnostics,
`reused`, `changed` and `ran_modules` between compiles; ids, types, THIR and
MIR are rebuilt every compile.
Expand Down
26 changes: 21 additions & 5 deletions .claude/vault/06-plan.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Plan

`main` is at `2c498440` (2026-11-06): text views (`&str`, `&cstr`) and
slices (`&[]T`) merged. Open branch: `feature/size-of`, holding the
interface, allocator and type parameter work below, in PR #182. Order of work
(owner, 2026-11-06, `allocator.localplan.md` ORDER OF WORK):
`main` is at `35ebc893` (2026-11-17): generic functions and `where`
(PR #191) and the LSP facts fix merged. Open branch: `feature/generic-types`
(item 8). Items 1-7 below are from the order of work of 2026-11-06
(`allocator.localplan.md` ORDER OF WORK) and were not rechecked since:

1. [x] Borrowed interfaces: `&Shape`, `&mut Shape`, method tables
(60a3dbed, then b435b7ff for the `ref` style).
Expand Down Expand Up @@ -70,12 +70,28 @@ interface, allocator and type parameter work below, in PR #182. Order of work
(worklog, "References in arrays and slices").
- [ ] The Website, once the feature is complete.

8. [~] Generics (owner, 2026-11-17: "start the missing generics work").
- [x] Generic functions, `where` constraints, `::<T>` at a call
(PR #191, merged 91982660), with two review fixes: a literal after a
found type is checked as the copy's (48290c82), and a cycle through a
copy's own signature is reported (085a94fe).
- [x] LSP crash from PR #191: facts are handed on with the function
they were found in (4a133f60, merged 35ebc893); a new LSP test opens
every test program (worklog, "Facts go with their own function").
- [~] Generic structs, `struct Box<T>`, on `feature/generic-types`
(plan: `~/.claude/plans/snazzy-swimming-taco.md`). Rework agreed in
principle (owner, 2026-11-17): generics are one shared part used by
functions and types; structs and pointers keep only their own logic.
- [ ] Functions of generic structs, finding `T` from a struct literal,
generic aliases, `where` on a struct.
- [ ] The Website and editor grammars, once the feature is complete.

Later improvement (owner, 2026-11-08): diagnostics as one struct per kind
of error, which owns its words and spans, as rustc's `#[derive(Diagnostic)]`
does; today each is built in place with `Diagnostic::new(code, message)`.

Later: lifetimes of references held in structs; enums and `match` with
`?T` (put off by the owner 2026-10-30); generics.
`?T` (put off by the owner 2026-10-30).

Left for later from methods (`methods.localplan.md`): `Self` written as a
type, functions of types other than structs.
Expand Down
22 changes: 22 additions & 0 deletions .claude/vault/07-worklog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
## Facts go with their own function (2026-11-17, 4a133f60, merged 35ebc893)

- Found in Zed: the LSP died at start. `negative_where_conditions.peep`
(PR #191) panicked it at `lsp/src/checked.rs:175`, and so did valid code
where an earlier function calls one whose `where` names its parameters.
- Cause: the checker kept one fact list per module and the driver handed
"the facts found so far" to the next function built. A `where` is
checked when its signature is first asked for, often inside another
body, so its facts about locals were read against that other body:
a panic, or a wrong hover (`main`'s `const Ratio` shown for `Pick`'s `N`).
- Fix: the checker keeps facts by the declaration they were found in and
owns the rule; `Checker::function_facts` (a function's own, a copy none)
and `Checker::other_facts` (the rest, by declaration, no locals). The
driver only calls them. A first version put the rule in the driver
through a `pub` field; the owner rejected it as scattered responsibility.
- Tests: `checks_every_test_program` (LSP opens every test program, fails
on a panic; ~8 s) and `names_after_where_are_of_their_own_function`;
both fail on the old code. Two driver tests changed to the new pairing,
every fact still present. `check.sh` passes.
- Review lesson: the PR #191 review ran only `check`/`run`/`check.sh`, none
of which records facts; a review now drives `peeper lsp` too.


- Review fixes (Fuad: "fix all"), all from step 11's lowering, found by
the review of the speed work: (1) a constant of the class `Wide` was
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ test_local
!.agents/skills/peeper-code-review/SKILL.md
!.agents/skills/gstack-investigate/
!.agents/skills/gstack-plan-eng-review/
!.claude/
.claude/*
!.claude/vault/
!.gitignore
!.github/
!.github/workflows/
Expand Down
1 change: 0 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@RULES.md
@.claude/vault/README.md
56 changes: 17 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 17 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[workspace]
members = [
"crates/base/*",
"crates/core/*",
"crates/features",
"crates/frontend/*",
"crates/middle/*",
"crates/syntax/*",
"crates/check",
"crates/model",
"crates/lower",
"crates/flow",
"crates/eval",
"crates/backend/*",
"crates/driver/*",
"crates/tools/*",
Expand All @@ -20,24 +22,23 @@ publish = false
[workspace.dependencies]
source = { path = "crates/base/source" }
diagnostics = { path = "crates/base/diagnostics" }
token = { path = "crates/frontend/token" }
lexer = { path = "crates/frontend/lexer" }
token = { path = "crates/syntax/token" }
lexer = { path = "crates/syntax/lexer" }
arena = { path = "crates/base/arena" }
bigint = { path = "crates/base/bigint" }
runtime_abi = { path = "crates/base/runtime_abi" }
parser = { path = "crates/frontend/parser" }
parser = { path = "crates/syntax/parser" }
literal = { path = "crates/base/literal" }
syntax = { path = "crates/core/syntax" }
tree = { path = "crates/syntax/tree" }
test_programs = { path = "crates/driver/test_programs" }
model = { path = "crates/middle/model" }
eval = { path = "crates/middle/eval" }
check = { path = "crates/middle/check" }
lower = { path = "crates/middle/lower" }
flow = { path = "crates/middle/flow" }
model = { path = "crates/model" }
eval = { path = "crates/eval" }
check = { path = "crates/check" }
lower = { path = "crates/lower" }
flow = { path = "crates/flow" }
llvm = { path = "crates/backend/llvm" }
compile = { path = "crates/driver/compile" }
features = { path = "crates/features" }
project = { path = "crates/frontend/project" }
project = { path = "crates/driver/project" }
lsp = { path = "crates/driver/lsp" }
unicode-general-category = "1.1.0"
stacker = "0.1.25"
Expand Down Expand Up @@ -71,7 +72,7 @@ single_match_else = "warn"
uninlined_format_args = "warn"

[profile.release]
# The phases and the features are separate crates that call each other often;
# The phases are separate crates that call each other often;
# this lets those calls be inlined (one compile ran 3% fewer instructions).
lto = "thin"
debug = "line-tables-only"
Expand Down
1 change: 0 additions & 1 deletion crates/backend/llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ toml_edit.workspace = true

[dev-dependencies]
compile.workspace = true
features.workspace = true
project.workspace = true

[lints]
Expand Down
Loading
Loading