The type_name
of tuple-structs and their ZST function item are the same
#84666
Labels
C-bug
Category: This is a bug.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
I tried this code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f6fa0a5aa4d0a3d422c2db601a77c304
I expected to see this happen:
The two names would be different, so that in logging I'd be able to notice I passed the wrong thing.
Instead, this happened:
Context:
This came up in the bevy discord server: https://discord.com/channels/691052431525675048/742884593551802431/836883497578397706
It allows you to put an instance of anything as a component on an entity, and get it back again later by type. So passing in a
struct Marker;
instance is fine -- and useful for filtering -- but it can't tell the difference between useful ZSTs like that and accidental ZSTs likeVelocity
where they meant to passVelocity::new()
. It would be nice for that to be at least available in debug logging, as a way to see what's available, but if that shows"Velocity"
then it'd be particularly confusing when the "give me a::<Velocity>()
" doesn't work.I'm not proposing any concrete string that this should return; it'd just be nice for it to be better distinguished.
The text was updated successfully, but these errors were encountered: