Skip to content

Scratch/riel/cpp qualified uses - #153

Merged
rikvanriel merged 3 commits into
facebookexperimental:mainfrom
rikvanriel:scratch/riel/cpp-qualified-uses
Nov 26, 2026
Merged

rikvanriel merged 3 commits into
facebookexperimental:mainfrom
rikvanriel:scratch/riel/cpp-qualified-uses

Conversation

@rikvanriel

Copy link
Copy Markdown
Contributor

Show bare function names for C++ and Rust, getting closer to fully functional call chain tracing in C++ and Rust code bases.

A qualified spelling at a use-site is never recorded:
`register_dev(ns::my_read)` records no row, so the handover never
links to `my_read`.

The stored target is the bare leaf. `ns::my_read` records `my_read`,
which meets the bare definition by equality; a lone `::my_read`
names no owner and records nothing. The name is shortened where the
use-site is read; the lookup that matches rows to definitions is
unchanged.

Held tables (`{ ns::a, ns::b }`) and templated leaves
(`ns::my_read<int>`) still record nothing.

The shared extractor version moves 8 to 9: no per-language version
exists, so every language re-indexes for this C++-only change.

New tests: 9 falsifiable cases fail on the base tree with "no row"
and pass with the fix; 4 guards pass on both trees, and a helper
test pins the lone `::` drop.

| case | base | fixed |
| handover, qualified | no row | (register_dev, my_read, false) |
| handover, shadowed local | no row | (register_dev, my_read, false) |
| handover, spaced spelling | no row | (register_dev, my_read, false) |
| designated init, qualified | no row | DesignatedInit my_read |
| assignment, qualified | no row | Assignment impl_fn on ops |
| assignment, &qualified | no row | Assignment impl_fn on ops |
| handover, &qualified | no row | (register_dev, my_read, true) |
| designated init, &qualified | no row | DesignatedInit my_read |
| reduced meets definition | no row | handover row, my_read defined |
A qualified spelling at a Rust handover use-site is never recorded:
`register(m::handler)` records no row, so the handover never
links to `handler`.

The stored target is the bare leaf. `m::handler` records `handler`,
which meets the bare definition by equality; a lone `::handler`
names no owner and records nothing. A scoped leading `::` still
has an owner path, so `::m::handler` records `handler` through
the same shared cut as the C++ path. The name is shortened where
the use-site is read; the lookup that matches rows to definitions
is unchanged.

Only the handover site reads scoped spellings; initcall, table,
designated-init, and assignment sites stay silent on Rust as
before. A reference (`&handler`, `&m::handler`) still records
nothing. An alias records the name at the use-site: `register(h)`
after `use m::handler as h` records `h`.

The shared extractor version moves 9 to 10: no per-language
version exists, so every language re-indexes for this Rust-only
change.

New tests: 2 falsifiable cases fail on the parent commit with
"no row" and pass with the fix; 1 guard passes on both trees.

| case | base | fixed |
| handover, qualified | no row | (register, handler, false) |
| handover, scoped leading `::` | no row | (register, handler, false) |
| alias, use-site name | (register, h, false) | (register, h, false) |
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 26, 2026
@rikvanriel
rikvanriel merged commit ce73321 into facebookexperimental:main Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant