repowise-dev / repowise-dev/repowise

[Bug] Rust type_use misses &Foo, Box<Foo> and std::io::Error, though the extractor already handles them

Closed
#2,298 3 comments 0 reactions 1 assignee View on GitHub

@Aman-goel-04 is already working on this.

Since Sep 18, 2026.

bug help wanted
Dominant language
Python
Stars
6.7k
Forks
711
Avg merge
1d 13h
Merged PRs (30d)
439

Description

Summary

queries/rust.scm feeds only a bare type_identifier into @param.type, with one narrow special case for &dyn Trait. A parameter or return type written &Foo, Box<Foo> or std::io::Error produces no type_use edge.

packages/core/src/repowise/core/ingestion/queries/rust.scm:329-373

The head extractor already handles all three.

Mechanism

_rust_head_type_identifier (packages/core/src/repowise/core/ingestion/parser_helpers.py:1341-1403) unwraps reference_type/pointer_type, generic_type, scoped_type_identifier (taking the rightmost segment), and dynamic_type/abstract_type. It is registered in TYPE_HEAD_EXTRACTORS["rust"] and unit-tested on exactly these shapes in tests/unit/ingestion/test_rust_type_use.py (test_reference_and_mut_are_unwrapped, test_scoped_type_takes_rightmost_component, test_generic_head_is_the_constructor).

So the machinery exists and is proven. Only the query is narrow, which makes this a query-only change.

Repro

fn takes(x: &MyType) {}
fn boxed(y: Box<MyType>) {}
fn io() -> std::io::Error { unimplemented!() }

None of the three produces a type_use edge to MyType/Error.

Impact

Under-reporting on a common Rust shape: a borrowed or boxed parameter is the normal way to pass a type. type_use is in REACHABILITY_USE_EDGE_TYPES, so a type used only this way can read as unreachable.

Unsized. The affected shapes are not counted today.

Done looks like

The @param.type positions accept the wrapper shapes the extractor already unwraps, rather than only a bare type_identifier.

This cannot mint a wrong edge: the extractor returns the head type or nothing, and a type name that resolves to no repository symbol is dropped. The change is additive by construction.

Worth checking in the same pass whether the return-type position at :357-359 needs the same widening; it is bare-only today for the same reason.

Tests: extend tests/unit/ingestion/test_rust_type_use.py from the extractor level to the query level, asserting &Foo, Box<Foo> and std::io::Error in parameter and return position each produce a type_use edge.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.