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.
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.
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.
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.
- 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.
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(…)`.
An assignment that ends a block without a semicolon (`{ input = c }`) now
makes its alias at the block's close instead of after the next statement.
A `let` inside a move closure, or one of its parameters, now counts as a
local binding: an assignment to it ends the alias as it does outside a
closure. Assignments to outer captures are still skipped.
A closure stored with `let` in `Some`, `Ok`, `Err`, `Box::new`, `Rc::new`
or `Arc::new` and never used again does not run, so its assignments no
longer end an alias. A closure passed to any other call may run and still
ends it.
An async closure called where it is written now runs when the call is
passed straight to `block_on` (a trailing comma included), unless the
`block_on` sits inside another closure.
all-unguarded, only-weak, exit-status-only, no-assertion, early-return,
env-gate-unset, census, mirror, constant-echo, fixture-only and
exact-pixel only listed their hits before. Their hits on changed lines
and tests now fail the check like the other rules. A
`// test-lint: allow <rule> <reason>` comment still exempts a hit, and
hits on unchanged lines still do not fail.
A never-run test that builds on macOS or Windows is still listed
without failing, since it runs locally on that platform.
Docs: docs/development.md.
The census rule leaves out a loop that feeds each entry into a
computation. It now checks that the computation runs, and that it runs
on the entry:
- An alias assigned another value no longer holds the entry, and one
assigned the entry holds it. Assignments in an empty loop, an async
block, a move closure or a closure the loop never calls do not change
the alias, and one that may be skipped does not make one.
- A nested for body counts only when its source is a literal range or
array that is not empty.
- A block in an earlier argument keeps the enclosing || or && that can
skip the call.
- Calling an async closure counts only when the future is awaited or
passed to block_on.
- A closure that is not bound with let counts only when it is called
where it is written; a parenthesized initializer binds the closure.
- A closure call resolves to the binding in scope at the call, so a
later let of the same name takes it.
- A conjunction inside a parenthesized operand of an asserted && is
required, unless an || at its level can bypass it.
With test selection, a pull request that moves a crate between shards in
GROUPS without changing ci.yml could skip the shard holding the test
that compared the two. `shards::check`, which every shard and warm leg
runs, now compares them and fails with both lists.
The served-faces test passes CRAFT_FONTS_REQUIRED=0 explicitly, so a job
that sets it to 1 does not fail its background-only case, and two runs in
one process (parallel tests) no longer share the folder for the table
they throw away.
The web interface font stack fetches its craft-fonts faces from the
`fonts/ui/` URLs in SERVED_FONTS, but only crates/text/build.rs's
OUT_DIR held those files: the Trunk hook copied the `fonts/<sha16>/`
faces alone. On a built site every served interface face (Noto Sans
Arabic, Thai and Georgian, NanumGothic, Noto Sans Devanagari) failed to
load, and the interface drew those scripts as missing-glyph boxes.
`cargo xtask web-fonts` now also publishes the `startup` and `demand`
faces of crates/text/web-fonts.txt under `fonts/ui/`, licence beside
each, with the same craft-fonts-build `Embed::serve` that build.rs
uses, so the files match the table's URLs and integrity values.
Test: publishes_the_interface_faces_at_their_served_urls.
Fixes#10567.
A path string that continues on the next line with a backslash now
decodes to the joined file name, so the conditional route is kept.
A range argument with two fixed bounds (1..4, 1..=4) no longer counts
as an input, so the round-trip census diagnostic stays; a range with a
variable bound still suppresses it. Adds a test for a bracket in a
cfg_attr path filename keeping its sibling cfg gate.
- An entry name after `::` (`defaults::c`) is a path segment, not a read of the loop binding.
- A `let` initializer scans to the end of its statement, so a block initializer binds its tail
(`{ prepare(); c }`) and not the earlier statements in the block; `if let` and `while let`
end at their block.
- A call keeps its name when masked comment whitespace sits before `(`, except after a keyword
(`if (a)`).
- The argument-guard and alias tests now depend on the logic they cover.
- A renamed import (`use super::other::near as comparison;`) no longer
counts as a call with a path; an import that keeps the name still does.
- A bare call to a helper's name checks for a local binding in scope
(`let near = || {}; near();`), skipping type annotations, field labels
and path segments in patterns.
- Helpers passed in assertion failure messages no longer count as checks.
- A match-arm binding covers the arm's guard, and the arm's pattern stops
at the block of the arm before it.
- `#[ ignore = "..."]` with whitespace is read as an ignore attribute,
both for diagnostic tests and for ignore-without-reason.
- Literal ranges read `0x`, `0o` and `0b` bounds.
- A pin compares literal arguments (`r.items("active")` against
`r.items("archived")`), and does not count when a clone or borrow of the
source made before the snapshot is still alive.
- A function parameter named like a constant table is not the table.
The changed-lines mode read each base file with `git show` and only then
compared the length of the trimmed, lossily decoded text with the 16 MiB
limit, so a large blob was loaded in full before it was skipped, and
trailing whitespace and invalid UTF-8 changed the length it was judged
by. The base reads now take each blob's size from one `git ls-tree -l`
listing of `crates`, `apps` and `xtask` (or `git cat-file -s` for a path
the listing does not hold) and run `git show` only for blobs within the
limit.
A plain #[path = "\x63hild.rs"] after #[cfg_attr(windows, path = "child.rs")]
loads child.rs on Linux and FreeBSD, but test-lint compared the undecoded
spelling with the file name, dropped that route and reported a test in
child.rs as never-run. The plain attribute and the path argument of
cfg_attr now decode the escapes of an ordinary string literal with the
same unescape the cfg values use. Raw string literals are read as written.
An expression closure such as `|body: fn()| forward::<u8, u16>(body)`
ended at the comma inside the turbofish, so a parameter named like an
asserting helper stopped shadowing it at that comma. The closure body
now skips a turbofish whole.
A count or emptiness getter on a pinned snapshot (`let _ = got.len();`)
keeps the pin; only a read of the receiver itself that is bound or
passed to a call may hand out an alias.
no-assertion:
- A call in a top-level test reaches the helper its own file defines. A
non-asserting helper of the same name in another file of the crate no
longer hides it. Names the file also calls with a path, and
definitions below the file's top level, keep the crate's verdict.
- An `#[ignore = "reason"]` test that prints is a diagnostic and needs
no assertion.
- An asserting function passed by name as a value
(`keeping_settings(the_body)`, `run(&[body])`) counts as the test's
check, also through a helper that passes it, unless a local binding,
loop pattern, match arm or parameter shadows the name in scope, or the
value is dropped (`drop(body)`, `let _ = Some(body)`, `(body,);`).
all-unguarded:
- A parenthesized range of literals or constants, `(0..3).all(...)`.
- A receiver whose source an earlier `assert_eq!` compares with a
non-empty literal: a local collected from the receiver, or the call
the receiver is bound to, when nothing changes the source in between.
A shared borrow passed to a call outside an assertion may change it.
- A call to a function of the file that lists every row of a non-empty
constant table without filtering it; every function of that name in
the file has to do so.
A loop over a whole table whose body passes the entry to a call together
with other state (a command run, a file written, a render, a parse of
other input) checks behavior for each entry, so the census rule no
longer reports it. A lookup, a call on the entry alone, literal
arguments and calls in a failure message still count as a census.
The call counts only where it runs whenever the loop's assertions pass:
not after an `||`, not on the right of an `&&` whose result is not
asserted, not inside an `if`, `else`, `match` arm, `while` or async
body, and not inside a closure the loop never calls. A name counts as
the entry from the `let` that binds it from the entry to the end of its
block, and not where a nested loop, a closure parameter or another
`let` rebinds it or where it names a field. An asserting helper keeps a
loop out of the census only where it runs the same way, and a round trip
can read the entry as its receiver (`k.parse()`).
- never-run: in changed mode, a file that a crate target loaded at the
base and no target loads now counts as compiled out, so removing the
last `mod` or `#[path]` declaration on the way to it, or deleting the
only target root that loads it, fails the check for its tests.
- reads-source: an `ends_with(".rs")` check counts only when it picks
entries from a file listing (an iterator filter or a `for` loop over
one), or when the function around it reads a file or calls a function
in the file that does. A suffix check on a generated name in a test
that reads nothing is not reported.
- census: a helper on the left of an `||` hides the whole-table check on
the right only when it always runs: not behind an `&&`, and not inside
one arm of an `if` or `match`.
- docs: unchanged-line `never-run` hits fail the command when the change
takes away a test's last CI route.
main replaced the hit's per-file `also` ranges with `gates`, a list of
lines in the hit's own file. The sleep rule's loop and spawn spans now
add their lines to `gates`. The `last_literal` and `path_literal`
helpers that main replaced are left out.