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
5 changes: 3 additions & 2 deletions compiler/rustc_const_eval/src/util/type_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ impl<'tcx> PrettyPrinter<'tcx> for TypeNamePrinter<'tcx> {
// Bound regions are always printed (as `'_`), which gives some idea that they are special,
// even though the `for` is omitted by the pretty printer.
// E.g. `for<'a, 'b> fn(&'a u32, &'b u32)` is printed as "fn(&'_ u32, &'_ u32)".
let kind = region.kind();
match region.kind() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since kind now exists, maybe

Suggested change
match region.kind() {
match kind {

could be good?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, yes, it was meant to be like that.

ty::ReErased | ty::ReEarlyParam(_) => false,
ty::ReErased | ty::ReEarlyParam(_) | ty::ReStatic => false,
ty::ReBound(..) => true,
_ => unreachable!(),
_ => panic!("type_name unhandled region: {kind:?}"),
}
}

Expand Down
15 changes: 15 additions & 0 deletions tests/ui/type/type-name-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,19 @@ pub fn main() {
}
let a = Wrap(&()).get();
v!(a, "type_name_basic::main::Wrap<&()>::get::Info");

struct Issue146249<T>(T);
impl Issue146249<Box<dyn FnOnce()>> {
pub fn bar(&self) {
let f = || {};
v!(
f,
"type_name_basic::main::Issue146249<\
alloc::boxed::Box<dyn core::ops::function::FnOnce()>\
>::bar::{{closure}}"
);
}
}
let v: Issue146249<Box<dyn FnOnce()>> = Issue146249(Box::new(|| {}));
v.bar();
}
Loading