-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeID of Box<Fn() -> ()>
inconsistent across crates
#33703
Comments
I don't think typeid is supposed to be consistent across compilations |
It looks like this is part of the same compilation, which would make it a bug. |
Oh, my bad. |
Yup, I should've made that a little clearer--I'm getting two different ids during the same run. |
On IRC @willcrichton pointed out that |
Sounds simple enough to fix then, @willcrichton are you working on this or should I pick it up? |
@Manishearth I'll take a stab at it and post any troubles here. |
Rewrite TypeId computation to not miss anything and work cross-crate. Fixes #33703 and also some soundness holes in `Any` due to `TypeId` ignoring most lifetimes.
The TypeID of
Box<Fn() -> ()>
seems to be inconsistent across crates in both nightly and stable, I found a similar closed issue from a couple years ago and wasn't sure whether I should comment on that or file a new bug. I can recreate it consistently as follows:typeid_issue/lib.rs:
typeid_issue/examples/example.rs:
On my machine,
cargo run --example example
with the above project outputs two differentTypeId
s. The same thing doesn't happen for all types, e.g.Box<i32>
s seem to work fine, andBox<Fn() -> ()>
wrapped in a struct seems to work fine giving me a nice work around for now.The text was updated successfully, but these errors were encountered: