-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Optionally add type names to TypeId
s.
#136148
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,14 @@ fn any_unsized() { | |
is_any::<[i32]>(); | ||
} | ||
|
||
#[cfg(feature = "debug_typeid")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The coretests crate doesn't have this feature, so this test will never actually run. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened #140155 to remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for not getting back to this sooner — to give some context, this PR was probably originally written before the coretests split occurred (#135937), so the error was introduced by rebasing. |
||
#[test] | ||
fn debug_typeid_includes_name() { | ||
let type_id = TypeId::of::<[usize; 2]>(); | ||
let debug_str = format!("{type_id:?}"); | ||
assert!(debug_str.ends_with("= [usize; 2])"), "{debug_str:?} did not match"); | ||
} | ||
|
||
#[test] | ||
fn distinct_type_names() { | ||
// https://github.com/rust-lang/rust/issues/84666 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: not a libs reviewer, but, is this1 documented anywhere? Feels like only 3 people will ever know if these features exists otherwise lol.
Footnotes
or rather, I guess the core/std options in general. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I entirely agree that that’s a problem, and I’m not aware of any documentation for
std
features. I expect the main way people will discover this feature is by looking at the source code ofTypeId
(which is linked from rustdocs, so is trivial to find).On the other hand, maybe there is documentation for
std
features, in which case this PR certainly should add to it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe std-dev-guide but I think that's a submodule of a repo somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, better documentation would be nice. But as it's missing for the other features as well, I don't think this should be done in this PR.