bevyengine / bevyengine/bevy

TypePath of types inside functions do not include the function name.

Open
#21,544 1 comment 0 reactions 0 assignees View on GitHub
A-Reflection C-Bug D-Modest S-Needs-Design
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.