TypePath of types inside functions do not include the function name.
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
Deriving `TypePath` on a type does not include functions it is nested within. This could result in unexpected type paths, and even matching type paths for two distinct types.
Here is a test that demonstrates the issue.
```rust
#[test]
fn types_in_functions_dont_overlap() {
#[derive(TypePath)]
struct MyType;
fn nested(super_type_path: &str) {
#[derive(TypePath)]
struct MyType;
assert_ne!(::type_path(), super_type_path);
}
nested(::type_path());
}
```
Contributor guide
Research direction
Start by running the supplied Rust test and tracing the TypePath derive implementation. Check how paths are generated for the outer and nested MyType definitions; done means the two type_path() values are distinct and the nested path includes its enclosing function name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100