Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/core/src/mem/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Type {
#[unstable(feature = "type_info", issue = "146922")]
#[rustc_const_unstable(feature = "type_info", issue = "146922")]
// FIXME(reflection): don't require the 'static bound
pub const fn of<T: 'static>() -> Self {
pub const fn of<T: ?Sized + 'static>() -> Self {
const { TypeId::of::<T>().info() }
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/reflection/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ fn main() {
println!("{:#?}", const { Type::of::<&Unsized>() }.kind);
println!("{:#?}", const { Type::of::<&str>() }.kind);
println!("{:#?}", const { Type::of::<&[u8]>() }.kind);
println!("{:#?}", const { Type::of::<str>() }.kind);
println!("{:#?}", const { Type::of::<[u8]>() }.kind);
}
2 changes: 2 additions & 0 deletions tests/ui/reflection/dump.run.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ Other
Other
Other
Other
Other
Other
Loading