Commit Graph
296 Commits
Author SHA1 Message Date
dotCooCoo b117e7fa90 DXF export: Always Export Group as Block Reference
DXF Options gets the check box Always Export Group as Block Reference,
and document.exportDxf and document.export take groupBlocks. It is off
by default, and the CNC / CAM preset does not set it. When it is on,
each group is written as a block definition holding its contents,
placed by one INSERT on the group's layer at the origin, unscaled, so
its entities keep their coordinates. A group inside it becomes a block
placed inside that block, and a group that writes no entity writes no
block. Block names come from the group names ("Group" for an unnamed
group), made unique with _2, _3 and so on, and follow each version's
naming rules. It works in every version from R12 to 2018.

The craft-libs revs move to 35709fdb (storytold/craft-libs#5381 on top
of the current pin 77ade517), whose drawing writer writes block
definitions and INSERT entities. A drawing without groups, or with the
option off, is written as before.

Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md.
2026-12-04 14:23:44 -08:00
.CooCoo 63f68d0a7f Merge pull request #10618 from dotCooCoo/fix/test-lint-census-closure-writes
xtask: test-lint census rule follows closure writes, async blocks and nested guards
2026-12-04 10:35:21 -08:00
dotCooCoo 3451c7a0a8 xtask: test-lint takes a saved bound only from a saved length
A local saved from `xs.len()` or `xs.iter().count()` gives the number
compared with it as the item count. One saved from an item or a flag
(`xs.first().copied().unwrap_or(0)`) shows at least one item, whatever
it is compared with.
2026-12-04 06:51:26 -08:00
dotCooCoo 31f86b52b5 xtask: test-lint follows redirects, closure uses and saved counts exactly
Workflow environment scan:
- A command whose standard output is redirected
  (`echo "N=x" >/dev/null |& tee -a "$GITHUB_ENV"`) does not set the
  variable; the same pipeline without the redirect still does.
- `env` reads assignments only before its child command, so
  `env printf '%s' "N=x"` passes the word to `printf`.
- A line break after `|` or `|&` continues the pipeline.
- A line continuation inside a name (`MY_\` and `SAMPLES=x` on the
  next line) is removed before names are read; single-quoted text is
  kept as it is.

Test reads:
- Closure names are read past the 1 KiB decode window and with
  combining marks.
- A unary `-` or `!` stays inside a cast's operand (`-Kind::A as i8`).
- A closure called only from a closure that never runs is not run;
  statements are judged last first against the code kept so far.
- An async closure's future passed to `drop` or `std::mem::drop` is not
  polled.
- `fallback(xs).len()` is a size check of the call's result, not of
  `xs`; `(xs).len() == 2` keeps its exact bound.
- An index shows `k + 1` items (`xs[0]` does not guard
  `xs.windows(2)`), and an index after the assertion counts only while
  nothing in between changes the collection.
- Turbofish arguments neither end a selector closure nor count as
  selector locals.
- A count through `by_ref()` consumes its source.
- A saved count (`let n = xs.len()`) guards only `xs`, with its compared
  bound.
- `(status.success() && dest.exists()) == true` is not status-only.
- Brackets inside const arguments are skipped when tracking open
  generic lists, so a shift after them stays visible.
- Every grouping layer around a constructor is unwrapped before a field
  is read.
- A raw identifier (`r#loop`) does not open an iterator block.
2026-12-04 06:37:21 -08:00
dotCooCoo 781daaf0fe Merge main into fix/test-lint-scope-and-status-parens
The conflicts in xtask/src/test_lint.rs keep main's shell command
reader (shell_command, command_word, writes_env_file with its later
redirection check), main's first-item roots, indexed_local and
name_byte/local_name, and this branch's grouped receivers, unused
closure check, status_condition and tuple-literal fields.

The merged scanner also closes these gaps:
- A quoted NAME=value counts only when the setter is the command
  itself, not an argument (`cargo test -- env "NAME=x"`);
  `/usr/bin/env "NAME=x" cargo test` still counts.
- Bash `|&` continues the pipeline, and the environment-file writer is
  the command after the last pipe outside quotes, so
  `tee 'backup|copy' "$GITHUB_ENV"` is found. `>|` redirects like `>`.
- A backslash-newline continuation leaves the word state as it was, so
  a `#` after `true; \` and a line break starts a comment.
- name_at reads past whitespace longer than 1 KiB, such as a long
  masked comment before a binding or nested fn name.
- An indexed item, or an iterator taken from it (`rows[1].by_ref()`),
  that is the `.all()` receiver in the assertion does not guard it.
- A selector after a closure (`r.items(|i| i > 0, i)`) is tracked:
  closure parameters are hidden only inside the closure's body.
  Non-ASCII selector locals (`café`) are tracked through the mutation
  check.
- A count produced by draining its source (`xs.drain(..).count()`)
  guards nothing.
- The type of a qualified path in a loop iterator
  (`<Producer as Make<{ 1 + 1 }>>::items()`) is not taken as the loop
  body.
2026-12-04 05:59:34 -08:00
dotCooCoo f98e03427a Merge main into fix/test-lint-census-closure-writes 2026-12-04 05:47:43 -08:00
dotCooCoo 5c09bd17ca xtask: test-lint keeps changed lines, redirects and guards to their own construct
- Only a hunk that removes blank lines and line comments reaches past
  the next line to the code after it, so deleting an import before an
  unchanged test no longer marks that test as changed.
- A replacement hunk that removes a skip comment inside a test also
  marks the code after it, so the `return` the comment explained counts
  as changed.
- A folded `run: >2-` block uses its indentation indicator as the
  content indentation.
- An assignment right after `&&`, `|`, `;` or `(` with no space before
  it (`true&&NAME=x cargo test`) is read as one.
- Only a redirection of standard output (`>>`, `1>>`, `&>>`) to
  `$GITHUB_ENV` writes the printed assignment; `2>>` does not.
- A redirection after `;`, `&&`, `&` or a line break belongs to the next
  command and does not replace the write to the environment file.
- A size check joined to an `.all(...)` by `||` does not guard it.
- A numeric index or a first-item unwrap guards only an `.all(...)` over
  the local it reads (`expected[1]` does not guard `actual.iter()`).
- A field of a tuple literal (`let pair = (5, Kind::A); pair.1`) resolves
  to its element, as a field of a tuple struct does.
2026-12-04 04:33:59 -08:00
dotCooCoo 5b1c3577f1 Merge main into fix/test-lint-port-review-fixes 2026-12-04 02:59:06 -08:00
dotCooCoo c0568c15e7 xtask: test-lint reads folded run blocks, later redirects and indexed clones exactly
- A deletion's changed range runs past lines that hold only a block
  comment, so a return after `/* spacer */` still counts as changed.
- A `run: >` block is folded as YAML folds it before its assignments are
  read, and a `run:` block ends at the first line indented no deeper than
  the `run` key, so a sibling `env:` key is read as a mapping.
- A later redirection of standard output (`>> "$GITHUB_ENV" > setup.log`)
  replaces the write to the environment file.
- A strict length bound past `usize::MAX` guards no `.all(...)` and no
  longer overflows.
- An element indexed out of a local with a non-ASCII name, or out of a
  nested container, holds the element's user value for `.clone()`.
2026-12-04 02:59:06 -08:00
dotCooCoo cc13d6abee xtask: test-lint closes thirteen scanner gaps in workflow and test reads
Workflow environment scan:
- A quoted `NAME=value` counts as an assignment only after a command
  that sets variables (`export`, `declare`, `env`, `/usr/bin/env` and
  similar) or in a pipeline that writes `$GITHUB_ENV`, not as an
  argument such as `cargo test -- "NAME=x"`.
- Bash `|&` is one pipe, so `echo "NAME=x" |& tee -a "$GITHUB_ENV"`
  writes the environment file.
- A `#` after an escaped space (`a\ #b`) stays in its word and does not
  start a comment.

Test reads:
- `split_args` does not close generic arguments at a `->` arrow.
- Binding names and nested `fn` names read non-ASCII letters
  (`_vérifier`), so an uncalled closure or nested function is excluded.
- A grouped size receiver (`(xs).len()`) is checked for later shrinking.
- An indexed item that is the direct `.all()` receiver
  (`rows[1].all(..)`) does not guard that assertion; an earlier access
  still shows the collection has items.
- Selector locals before a bitwise `|` are tracked; closure parameters
  are excluded by their parameter list and scope, and the scan no
  longer slices inside a non-ASCII character.
- A count whose initializer shrinks its source after the size read
  (`xs.len() + { xs.clear(); 0 }`) guards nothing.
- `&&status.success()` is a double borrow, not a conjunction.
- Generic tuple constructors (`Pair::<Input>(..)`) resolve their fields.
- A braced const argument in a loop iterator's turbofish is not taken as
  the loop body.
2026-12-04 02:55:02 -08:00
dotCooCoo 53c7350eb4 xtask: test-lint reads run blocks, command names and guarded views more exactly
- A deleted line that can change a test also marks the blank lines after
  it up to the next line of code, so a `return` that a deleted skip
  comment leaves after blank lines counts as changed.
- A literal `run: |` block is read as one script, so a `{ ... }` group
  that spans lines keeps its redirection to `$GITHUB_ENV`.
- An unquoted `NAME=value` word counts only before the command name or
  for a command that reads it as an assignment, so
  `grep NAME=value file` sets nothing.
- The print exemption reads the command name (`echo`, `printf`) instead
  of any earlier word, and a write to `$GITHUB_ENV` needs a redirection
  or a `tee`, `Out-File`, `Add-Content` or `Set-Content` that takes it as
  its output file. `echo "NAME=x" "$GITHUB_ENV"` only prints.
- A discarded tuple (`let _ = (|| (), { ... });`) is not unwrapped like
  grouping parentheses, so its evaluated elements still count.
- A size check guards only the `.all(...)` views over the same local,
  and inside one assertion only while nothing between the read and the
  `.all(...)` changes the local.
- An index no longer guards full chunks of the indexed item
  (`rows[1].as_chunks::<2>().0`): the chain walk follows turbofish
  arguments.
- Selector locals and indexed locals may have names with no ASCII
  letters (`选`, `数`).
- `all_needs_a_non_empty_guard` is split in two and the size-check tuple
  has a type alias, so clippy passes.
2026-12-04 01:51:40 -08:00
FredApps 44ffd596e8 Merge branch 'main' into feat/gujarati-web-ui 2026-12-04 10:28:06 +01:00
dotCooCoo 9c8f31344a xtask: test-lint reads grouped values, later checks and non-ASCII names more exactly
- A closure or async block bound to `_` inside parentheses
  (`let _ = (|| { … });`) is dropped unrun; `(|| { … })()` still runs.
- A length check after an `.all(…)` assertion guards it only when no code
  between them changes the local's item count (`xs.push(1)` included).
- A strict bound (`xs.len() > 1`, `1 < xs.len()`) gives one item more
  than its count, so `.windows(2)` after `> 1` is guarded.
- An index into the outer collection no longer guards `.all(…)` over an
  item read through `.iter_mut()`, `.windows(…)`, `.chunks(…)` or
  `.chunks_exact(…)`.
- A grouped argument (`std::mem::take((xs))`) is found as a call that can
  change a `&mut` local; `(xs).len()` stays a read.
- A nested `fn` with a non-ASCII name is skipped by the polling scan.
- A non-ASCII container local is followed to its initializer when deciding
  whether a conversion can test a user value.
- A `cfg` attribute covers a function whose return type holds `;`
  (`-> Result<(), [u8; 2]>`), so `never-run` reports it.
- The test repository directory comes from `tempfile`, created for the
  test alone.
2026-12-04 01:07:44 -08:00
dotCooCoo 1302127d9a xtask: test-lint reads fields of tuple literals
A field read on a plain tuple literal, such as `pair.0` after
`let pair = (Input { n: 5 },);`, now resolves to the element, so a
conversion of a user value read from it is no longer reported as
fixture-only. Parentheses without a top-level comma group the value
inside them, so `(Pair(5)).0` still resolves to `5`. Primitive tuple
elements stay inert.

The merge of main also kept the `!path_tail` guard on capitalized
calls that this branch had removed; qualified constructors such as
`model::Input(5)` again count as fixture construction, with main's
turbofish-aware path check kept.
2026-12-04 00:55:05 -08:00
dotCooCoo 3ed585be35 Merge main into fix/test-lint-scope-and-status-parens 2026-12-04 00:38:27 -08:00
dotCooCoo fe8cdbf220 Merge main into fix/test-lint-port-review-fixes
# Conflicts:
#	xtask/src/test_lint.rs
2026-12-04 00:29:40 -08:00
dotCooCoo 4e2581f63d Doc tests: treat cfg_attr lints by what they could do, and skip raw C strings
The check did not read lint attributes inside cfg_attr at all, and it
does not evaluate cfg conditions. Two roots passed although the
condition all() is always true:

- #![cfg_attr(all(), forbid(unsafe_code))] with doc-test deny: the
  library forbids unsafe code, so its doc tests need forbid.
- #![doc(test(attr(deny(unsafe_code), cfg_attr(all(), allow(unsafe_code)))))]:
  the allow lowers the deny.

A cfg_attr now counts only in the direction that is never too lenient:
a forbid inside one asks the doc tests for forbid, and an allow, warn
or expect inside one lowers the doc tests' level. A deny or forbid
inside cfg_attr in the doc-test list still does not count.

The comment and literal scanner also skips raw C strings (cr"..."), so
text such as #![forbid(unsafe_code)] inside one is not read as an
attribute. Tests cover each case.
2026-12-03 21:17:30 -08:00
dotCooCoo fb0bce30e6 Doc tests: read the unsafe-code level that the doc-test attributes leave in force
The check accepted a library root when deny(unsafe_code) or
forbid(unsafe_code) appeared anywhere inside #![doc(test(...))]. Two
roots passed although their doc tests still allow unsafe code:

- #![doc(test(attr(cfg_attr(any(), forbid(unsafe_code)))))]: the lint
  sits inside a cfg_attr whose condition is false, so rustdoc adds no
  lint to the doc tests.
- #![doc(test(attr(deny(unsafe_code), allow(unsafe_code))))]: rustdoc
  adds both attributes in order, and the later allow overrides the deny.

The check now reads only the lint attributes that are direct members of
attr(...), in order, and keeps the last level for unsafe_code. A later
allow, warn or expect lowers deny, and nothing lowers forbid. Tests
cover each case.
2026-12-03 20:06:43 -08:00
dotCooCoo 20a5b6eb50 Merge main into fix/doc-tests-unsafe-code 2026-12-03 19:53:53 -08:00
dotCooCoo 8387f54b97 Doc tests: count only crate-level attributes in the unsafe-code check
The check read every #![...] attribute in a library root, including
ones inside a module's braces. A root with
mod tests { #![doc(test(attr(deny(unsafe_code))))] } and no crate-level
attribute passed, although an attribute inside a module does not apply
to the crate's other doc tests. A #![forbid(unsafe_code)] inside a
module was also read as the library forbidding unsafe code.

Attributes inside braces are now skipped, with a test for each case.
2026-12-03 12:05:15 -08:00
dotCooCoo ebafe0b102 xtask: test-lint normalizes only the current callee path
inert() passed the whole operand before a call to without_turbofish, so an
assertion with many Box::new elements copied every earlier element again at
each call. It now tracks where the current path starts and normalizes only
that path. A test covers a builder path that follows other elements.
2026-12-03 11:58:36 -08:00
dotCooCoo a520deb991 Doc tests: assert the exact report in the unsafe-code check's tests
CI's test-lint step failed with only-weak at xtask/src/doc_tests.rs:250:
every assertion in comments_other_lints_and_allow_do_not_count checked
only that problem() returned Some. Such a test still passes when the
check reports the wrong problem, for example when a commented-out
#![forbid(unsafe_code)] is counted and the forbid message is returned
instead of the deny message.

The tests now compare problem() with the exact message for each case,
and two cases cover a commented-out forbid on either side. The other
tests in the file that checked only is_some, is_none or a substring
compare the full result too.
2026-12-03 11:55:35 -08:00
dotCooCoo 3072440389 Tests: census reads more closure, guard and macro forms
- A block behind `if false` or `while false` never runs, so a closure
  call inside it does not replace a binding that held the entry.
- A parenthesized literal (`(false) && …`) decides `&&` and `||` like
  the bare literal; `(ready && true)` stays a compound operand.
- Closure parameters accept nested struct patterns
  (`|Outer { row: Row { c } }|`).
- A closure parameter's shadow lasts through an explicit return type to
  the end of the body, and brackets in the return type are skipped.
- An uncalled closure with a return type (`|| -> () { … }`) is
  recognized, and a later block is not taken for its body.
- Whitespace or a masked comment may separate a macro name from its `!`
  (`stringify /* note */ !(…)`) and `.` from `await`.
- A raw identifier `r#return`, `r#break` or `r#continue` is not an exit.
2026-12-03 11:25:26 -08:00
dotCooCoo a0cfe8d923 xtask: test-lint reads shell commands, signatures and guards more exactly
- A quoted NAME=value counts as a workflow variable only in a command
  that reads it as an assignment (export, env, declare, local, readonly,
  typeset) or in a pipeline that writes to $GITHUB_ENV, so a grep pattern
  sets nothing.
- The command around a printed assignment is found with quotes taken
  into account, so a ; or | inside a printf format does not hide the
  printf, and only that command's own pipeline or group can write it to
  $GITHUB_ENV.
- A # starts a shell comment only at the start of a word, and a YAML
  comment only at the start of the line or after whitespace, so
  note=one#two keeps the rest of the line.
- let _ = async || ... is dropped unrun like a plain closure.
- A size check through the local's iterator (xs.iter().count()) is a
  direct guard, so a later xs.clear() invalidates it.
- A direct length guard covers windows(k), chunks_exact(k) and the full
  chunks of as_chunks::<k>() only when the compared count is at least k.
- A grouped && or || operand of an exit-status assertion is classified
  operand by operand.
- A nested fn with an array return type (-> [u8; 1]) is found, both for
  polling loops and for unrun functions in a test.
- A method on an element indexed out of a local (xs[0].len()) is
  classified by the element, so a user type's method is not a fixture
  read.
2026-12-03 11:22:18 -08:00
dotCooCoo d632bd0761 xtask: test-lint reads redirects, grouped calls, casts and dropped futures exactly
- A workflow line sets a variable only when `$GITHUB_ENV` is the target of an
  unquoted `>`, `>>` or `>|` redirect or of a file-writing command (`tee`,
  `Out-File`, `Add-Content`); a printed word `GITHUB_ENV` does not count.
- `split_args` tracks generic argument lists per delimiter depth, so a shift
  inside a const argument (`N::<{1 << 2}>`) no longer hides the next comma.
- `norm_values` finds `as` at a word boundary, so `(Kind::A) as u8` is a
  primitive value.
- A grouped argument (`reset((xs))`) passes a mutable reference on, and
  `(xs).len()` still only reads it.
- An async closure whose futures are only made and dropped (`run();`,
  `let _future = run();`) runs no assertion.
- A numeric index guards an `.all` assertion only until code before that
  assertion may shrink the indexed local.
- A pinned snapshot compares its selector locals from the initializer as
  written, so `i` in `r.items(i as usize)` is checked for changes.
- A saved count guards only when its collection is known; grouping
  parentheses (`(xs.len())`) still name it.
- A `for` loop over `if … { … } else { … }` or `match` finds its body after
  the iterator's own blocks.
2026-12-03 11:21:08 -08:00
dotCooCoo b209455e12 xtask: test-lint reads through turbofish arguments in constant-echo and fixture-only
The inert-operand check matched builder paths against the raw text, so
`Vec::<Amount>::new()` was taken for a call of code under test and
`assert_eq!(Vec::<Amount>::new(), EXPECTED)` was not reported as a
constant echo. Names inside the turbofish, such as the `_` in
`Ok::<_, String>(1)`, were also read as locals.

The check now skips `::<...>` arguments and decides whether a name is
called from the token after them. Builder paths are compared with the
turbofish removed. A generic function or method called with a turbofish
(`parse::<u8>("1")`, `s.parse::<u8>()`) now counts as a call, so it no
longer makes a test look like a constant echo or a fixture-only check.
2026-12-03 10:47:13 -08:00
dotCooCoo e6ca6ed1a9 Doc tests: read whole attributes and skip comments in the unsafe-code check
The check read crate-root attributes one physical line at a time and
compared whole attribute strings. It accepted a doc-test attribute that
sat inside a block comment or a string literal, rejected a valid
attribute split over several lines, and did not see `unsafe_code` in a
grouped list such as `#![forbid(unsafe_code, unused_must_use)]`, so it
accepted `deny` in the doc tests of such a library.

The check now removes comments and literal contents, reads each
`#![...]` attribute up to its matching bracket, and reads lint lists
item by item, in the library's own attribute and in the doc-test one.
2026-12-03 10:20:43 -08:00
dotCooCoo bed27c3291 xtask: test-lint follows scopes, quoted shell text and casts more exactly
- all-unguarded: a count bound inside a block that has closed no longer
  guards a later `.all` on a local of the same name.
- exit-status-only: a parenthesized operand is judged by its own `&&`
  and `||` operands, so `status.success() && (status.success() && x)`
  reads `x`.
- no-assertion: an assertion in a closure that is never called counts
  for nothing: `let _ = async || { ... }`, `async move |x|`, and a
  closure or async block bound to a name the test never mentions again.
- A `for` pattern shadows a passed helper only in the loop body, not in
  a block expression that is the loop's source.
- A helper with a non-ASCII name counts when passed as a callback.
- Workflow variables: a `;`, `&` or `|` inside quotes does not end the
  command that prints an assignment, only the pipeline that prints it
  has to write `$GITHUB_ENV`, and a `#` inside a word (`build#1`) does
  not start a comment in a run script or a workflow line.
- fixture-only and constant-echo: a cast to a primitive type
  (`Kind::A as u8 + 1`) is not arithmetic on a user value, `>>` that
  closes a turbofish (`None::<Vec<Amount>>`) is not a shift, and an
  element indexed twice (`rows[0][1]`) out of a user-value array is a
  user value.
2026-12-03 10:20:33 -08:00
dotCooCoo 9c11c47f75 Doc tests: unsafe code is denied in doc tests too
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.

- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
  or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
  attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
2026-12-03 09:51:28 -08:00
dotCooCoo 3f5fe6a521 xtask: test-lint reads paths, fields, run scripts and user values more exactly
all-unguarded:
- A numeric index (`xs[1]`, `xs[12]`) shows that a collection has items,
  as `xs[0]` did, except an item whose own `.iter()` runs the `.all`.
- A size check of a plain local (`xs.len()`) guards an `.all(…)` only when
  nothing between them may shrink or replace the local, and an operand
  that shrinks it after reading its size (`{ let n = xs.len(); xs.clear();
  n }`) guards nothing.
- A pinned snapshot stops guarding when a local it passes as a selector
  (`r.items(active)`) changes after it.
- An equality assertion pins a length only where it always runs before
  the `.all`: at the level of the test body, or earlier in its block.
- A field or path segment with a local's name (`other.xs.clear()`,
  `settings.active = false`) is not that local; a range (`0..n`) is not a
  field access.
- Passing a `&mut` local to a call, `(xs).clear()`, `(xs) = …` and a
  destructuring assignment (`(xs, _) = …`) count as changes.
- `as_chunks` and `as_rchunks` keep every item.

constant-echo and fixture-only:
- `into` is not a fixture read; `clone`, `to_string`, `to_owned` and
  `to_vec` are not when the receiver is a value of a type the test names,
  or a container holding one.
- An arithmetic or bitwise operator on such a value runs that type's code.
- Non-ASCII local names (`数`) are names, not constants.
- A `for` with a block as its iterator binds inside the loop body.

Test discovery and helpers:
- A test whose signature holds an array type or a braced const argument
  is found.
- A qualified path (`<T as Trait<A, B>>::VALUE`) is one operand.
- Helper names with non-ASCII letters (`vérifier`) are read whole.
- A closure or async block bound to `_` does not run, so its assertions do
  not count.
- A closure call shadowed by a `for` pattern, a closure parameter or a
  match arm, or called through a path (`other::run()`), is not a call of
  the outer closure.
- Calls inside a nested `fn` in a wait loop do not count as polling.
- `exit-status-only` reports an assertion only when the exit status alone
  can pass it (`status.success() && out.exists()` checks more).

Changed lines:
- `mirror` and `exact-pixel` hits run through the second compared
  operand, so a change to it on its own line counts.
- Deleting only blank lines or comments outside every test and literal
  marks no test as changed; a deleted comment inside a test, an allow
  marker or a block-comment edge still does. The base file is read
  untrimmed so its line numbers match the diff.
- The diff runs with `--text`, so a Rust file git takes for binary still
  reports its changed lines.
- A `never-run` test whose gate moves from report-only to failing counts.
- A nested `cfg_attr` path is followed under both conditions.

Workflow variables:
- A quoted `run:` value is decoded before its shell quotes are read, a
  comment in it ends at its line break, and a line break ends an `echo`
  unless a backslash continues it.
- Assignment text inside a quoted value (`message="MY_SAMPLES=x"`) sets
  no variable.

The tests that build a temporary repository remove it when an assertion
fails.
2026-12-03 09:40:41 -08:00
dotCooCoo 5529b9a30f Merge main into fix/test-lint-census-closure-writes 2026-12-03 09:16:18 -08:00
BFlat 9daf4163eb Merge pull request #10568 from ruchirguitar/fix/web-served-fonts
Web: the site publishes the interface's served fonts under fonts/ui/
2026-12-03 23:14:15 +07:00
ruchirguitar 2ec410834b xtask: the packaged-site test requires the Gujarati face only when craft-fonts has it 2026-12-03 21:37:52 +05:30
ruchirguitar 4fd3d9f22d xtask: a test packages the real web-font list and checks every served face, Gujarati included
With a craft-fonts checkout in CRAFT_FONTS_DIR, the Trunk hook runs on crates/text/web-fonts.txt
into a temporary site, and every startup and demand face must be under fonts/ui/ with the bytes
the craft-fonts manifest hashes. It skips without a checkout unless CRAFT_FONTS_REQUIRED=1.
2026-12-03 21:32:54 +05:30
.CooCoo b9c37e2586 Merge pull request #10606 from dotCooCoo/fix/census-lint-labels-and-closure-names
xtask: test-lint census rule reads loop labels, radix bounds and closure names
2026-12-03 07:28:56 -08:00
dotCooCoo cb837fa47a xtask: test-lint census skips stringified helpers and reads struct closure params
An asserting helper inside `stringify!` is not evaluated, so it no longer
counts as a check that runs for each entry. Closure parameter lists may now
hold struct patterns (`|Row { c }|`), so a parameter that shadows the entry
is seen. A path segment in a pattern (`entry::Row { .. }`) does not bind a
name.
2026-12-03 07:10:52 -08:00
dotCooCoo 6ec484819a xtask: test-lint census guards apply only to the operand they control
- An `&&` left of an `||` alternative belongs to the `||`'s left
  operand, so `false && ready || { reset(); true }` now counts the
  reset. A group that holds the alternative (`false && (a || b)`) is
  still guarded by the outer `&&`.
- A `?` after a block expression (`{ prepare() }?`) can leave a polled
  async block. A block that is the body of an expression closure
  (`|| { ... }?`) leaves only that closure.
- `return`, `break` and `continue` inside `stringify!` are not
  evaluated, and a call inside `stringify!` does not feed the entry.
2026-12-03 06:08:23 -08:00
dotCooCoo 0613c48c50 xtask: test-lint census exits read match alternatives and skip stringify!
A single pipe now ends a closure's parameter list only when an opening
pipe stands in a closure position, so the `|` of a match arm such as
`0 | 1 => return` no longer hides that return from the census rule. A
closure that a match arm yields (`_ => |_: ()| return`) still keeps its
return to itself.

A `?` inside the arguments of `stringify!` is not evaluated and no longer
counts as an exit from the enclosing async block.
2026-12-03 05:09:30 -08:00
dotCooCoo 45388081a8 xtask: test-lint census exits ignore closure bodies and return operands
When the census rule asks whether a write can run at all, a return statement
directly before it in the closure or async block now rules it out, while a
return inside a condition still leaves it possibly executed.

A return or ? in an expression-bodied closure (`let _f = || return;`) leaves
only that closure, not the enclosing async block. The operand of a return
(`return app.run(c);`) runs before the return, and a call after a bare return
in a tuple element does not. A ? after whitespace or a comment
(`prepare() ?;`) is still an exit.
2026-12-03 04:40:25 -08:00
dotCooCoo cfebc3e61b xtask: test-lint census rule follows early exits and captured writes
A polled async block, a called closure or a nested for body can be left
before the call: a return or ? leaves a closure or async block, and a
break or continue leaves a nested for body. The census exemption no
longer counts a call after such an exit. Exits inside a nested closure,
async block or inner loop leave only that one, and a closure with a
return type is recognized as nested.

A write to a capture inside an async move block or a move closure now
changes the block's own copy until the block ends, instead of being
skipped. A later call in the block that receives the replaced value no
longer counts as feeding the entry, while the outer binding keeps it.
2026-12-03 04:10:32 -08:00
dotCooCoo 4bb9f7dc92 xtask: test-lint census rule skips writes that cannot run
- An async block whose `async` and `move` are separated by a comment or
  extra spaces is found with `async_block_keyword`.
- A write inside an `async move` block to a local the block declares
  counts as a write; only writes to captures are skipped.
- A literal `false` left of `&&` or `true` left of `||` keeps the right
  side from running, also when the lint asks whether a write may run.
  `a && true || ...` is not a literal left operand.
- A closure passed to `drop` (or `mem::drop`, `std::mem::drop`,
  `core::mem::drop`) is not called.
2026-12-03 03:09:51 -08:00
ruchirguitar e2e4b3b917 xtask: web-fonts writes its scratch table in a private tempfile folder 2026-12-03 14:25:33 +05:30
dotCooCoo 0b40292b5a xtask: census rule reads loops and continues used as expressions
The nested-loop scan now strips an initializer, a return or break
operand, and grouping parentheses before the loop keyword, so a
labeled continue inside `let _ = for _ in 0..0 { ... };` is known to
never run, and a continue inside a grouped nested loop targets that
loop. A continue after `=`, `(`, `,`, `return` or `break` now starts
an expression, so `let _: () = continue;` before the call is seen as
skipping it. Macro tokens and `r#continue` stay excluded.
2026-12-02 19:36:11 -08:00
dotCooCoo f83b121a46 xtask: census rule ignores a continue in a nested loop that never runs
A labeled continue inside a nested `for` over a literal source that
yields nothing (`for _ in 0..0`) never executes, so it does not skip the
rest of the outer iteration, and the command call after that loop always
runs. A nested loop that runs (`0..1`) still makes the continue skip the
call.
2026-12-02 18:11:49 -08:00
dotCooCoo af8405e4b0 xtask: census rule counts a continue at the start of a loop body
A continue that opens the loop body had no byte before it, so the
expression-start check failed and the call after it was treated as run.
It now counts. A continue inside the tokens of a macro that does not run
them (stringify!({ continue; })) no longer counts as skipping the call;
one inside a macro that may run its arguments (vec![{ continue; }])
still does.
2026-12-02 16:15:27 -08:00
dotCooCoo e324706fae xtask: census rule reads continue before a call and grouped inline block_on closures
A call in a nested for body no longer counts as run when an earlier
continue that targets that loop can skip it. A continue inside a nested
loop, one whose label names a nearer loop, and a continue token inside a
macro or a raw identifier do not skip the call.

An inline async closure call wrapped in grouping parentheses and passed
as block_on's whole argument (block_on(((async || app.run(c))()))) now
counts as run; a callee that only ends in block_on still does not.
2026-12-02 15:16:57 -08:00
dotCooCoo c9ef0845a5 xtask: test-lint census rule follows closure writes, async blocks and nested guards
The census rule leaves out a loop that feeds each entry into a
computation, so it needs to know which calls and assignments in the loop
body run. It misjudged these shapes:

- A parameter of an async closure (`async |mut c: Command| { ... }`) or
  one whose type contains `->` did not shadow the entry.
- An async block awaited where it is written (`async { ... }.await`,
  `(async { ... }).await`) or passed straight to `block_on` counted as
  never run, for both calls and assignments. An `||` before it still
  guards it, and an `async move` block still writes only its own copies.
- An inner binding assigned the entry stayed hidden by a shadow of an
  outer binding of the same name.
- `ready || accept({ 0 }, wrap(app.run(c)))` lost the `||` guard.
- A closure with parameters stored in `Some(...)` counted as called.
- A closure call was found past the end of the block that binds the
  closure.
- An assignment in a closure dropped with `let _` or stored in
  parentheses (`let _saved = (|| { ... });`) ended the entry alias.
- An assignment in a closure that is called only conditionally kept the
  alias. Assignments now use a "may run" mode of the same check that
  finds calls, so a call that may be skipped still counts and a call
  that can never run does not.
2026-12-02 14:04:50 -08:00
dotCooCoo 38f198bb22 xtask: test-lint census rule reads let( bindings, non-ASCII labels and grouped block_on futures
- A `let` followed directly by `(`, `[` or `&` (`let(_run) = || { ... };`)
  now binds the closure, and Unicode whitespace after `let` separates the
  pattern.
- A loop label with non-ASCII letters (`'été: for _ in 0..0`) is stripped,
  so an empty range still skips the body.
- `block_on((run()))` counts the future as run: grouping parentheses
  around it are skipped. A callee whose name only ends in `block_on`
  (`déblock_on`) still does not count, and Unicode whitespace before
  `block_on` does not join it to the name before.
2026-12-02 12:55:32 -08:00
dotCooCoo 8cea13d8a4 xtask: test-lint census rule reads a loop label with a space before its colon
Rust allows whitespace between a loop label and its colon ('inner : for), so the label is stripped from the loop head in that form too.
2026-12-02 11:57:17 -08:00
dotCooCoo 2e1b575fdc xtask: test-lint census rule reads loop labels, radix bounds and closure names
Follow-up to #10585. The census rule now:

- treats a labeled `for` (`'inner: for _ in 0..0`) like an unlabeled one
  when deciding whether its body runs;
- reads hex, octal and binary range bounds (`0x0..0x1`) and borrowed or
  parenthesized array literals (`&[1]`, `(&[1])`) as loop sources;
- does not count a path call (`other::run()`) as a call to a local closure;
- counts an async closure's future as run by `block_on` only when it is
  the whole argument of `block_on` itself, not of `discard_block_on` or of
  a longer expression, and allows a space before the parenthesis;
- finds the `let` keyword without splitting a name such as `inlet_fn`;
- accepts a trailing comma after a closure stored in `Some(…)`.
2026-12-02 11:09:12 -08:00