diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
index 6dba5d2945dbe..b8701d3d3efca 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
@@ -1616,7 +1616,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
// | expected `()`, found closure
// |
// = note: expected unit type `()`
- // found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]`
+ // found closure `{closure@$DIR/issue-20862.rs:2:5: 2:14 x:_}`
//
// Also ignore opaque `Future`s that come from async fns.
if !self.ignore_span.overlaps(span)
diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs
index 632f159a7a889..da3ab1b2a573c 100644
--- a/compiler/rustc_middle/src/mir/pretty.rs
+++ b/compiler/rustc_middle/src/mir/pretty.rs
@@ -990,11 +990,11 @@ impl<'tcx> Debug for Rvalue<'tcx> {
AggregateKind::Closure(def_id, args) => ty::tls::with(|tcx| {
let name = if tcx.sess.opts.unstable_opts.span_free_formats {
let args = tcx.lift(args).unwrap();
- format!("[closure@{}]", tcx.def_path_str_with_args(def_id, args),)
+ format!("{{closure@{}}}", tcx.def_path_str_with_args(def_id, args),)
} else {
let span = tcx.def_span(def_id);
format!(
- "[closure@{}]",
+ "{{closure@{}}}",
tcx.sess.source_map().span_to_diagnostic_string(span)
)
};
@@ -1018,7 +1018,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
}),
AggregateKind::Generator(def_id, _, _) => ty::tls::with(|tcx| {
- let name = format!("[generator@{:?}]", tcx.def_span(def_id));
+ let name = format!("{{generator@{:?}}}", tcx.def_span(def_id));
let mut struct_fmt = fmt.debug_struct(&name);
// FIXME(project-rfc-2229#48): This should be a list of capture names/places
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 0ee63e92848f7..5b833dde92c13 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -795,7 +795,7 @@ pub trait PrettyPrinter<'tcx>:
}
ty::Str => p!("str"),
ty::Generator(did, args, movability) => {
- p!(write("["));
+ p!(write("{{"));
let generator_kind = self.tcx().generator_kind(did).unwrap();
let should_print_movability =
self.should_print_verbose() || generator_kind == hir::GeneratorKind::Gen;
@@ -836,13 +836,13 @@ pub trait PrettyPrinter<'tcx>:
}
}
- p!("]")
+ p!("}}")
}
ty::GeneratorWitness(types) => {
p!(in_binder(&types));
}
ty::GeneratorWitnessMIR(did, args) => {
- p!(write("["));
+ p!(write("{{"));
if !self.tcx().sess.verbose() {
p!("generator witness");
// FIXME(eddyb) should use `def_span`.
@@ -861,10 +861,10 @@ pub trait PrettyPrinter<'tcx>:
p!(print_def_path(did, args));
}
- p!("]")
+ p!("}}")
}
ty::Closure(did, args) => {
- p!(write("["));
+ p!(write("{{"));
if !self.should_print_verbose() {
p!(write("closure"));
// FIXME(eddyb) should use `def_span`.
@@ -904,7 +904,7 @@ pub trait PrettyPrinter<'tcx>:
p!(")");
}
}
- p!("]");
+ p!("}}");
}
ty::Array(ty, sz) => p!("[", print(ty), "; ", print(sz), "]"),
ty::Slice(ty) => p!("[", print(ty), "]"),
@@ -1061,7 +1061,7 @@ pub trait PrettyPrinter<'tcx>:
}
for (assoc_item_def_id, term) in assoc_items {
- // Skip printing `<[generator@] as Generator<_>>::Return` from async blocks,
+ // Skip printing `<{generator@} as Generator<_>>::Return` from async blocks,
// unless we can find out what generator return type it comes from.
let term = if let Some(ty) = term.skip_binder().ty()
&& let ty::Alias(ty::Projection, proj) = ty.kind()
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index e3e014a3b2a81..3ebb8cbc476a4 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -2550,7 +2550,7 @@ impl<'tcx> Ty<'tcx> {
/// Checks whether a type recursively contains any closure
///
- /// Example: `Option<[closure@file.rs:4:20]>` returns true
+ /// Example: `Option<{closure@file.rs:4:20}>` returns true
pub fn contains_closure(self) -> bool {
struct ContainsClosureVisitor;
diff --git a/src/tools/clippy/tests/ui/box_default.fixed b/src/tools/clippy/tests/ui/box_default.fixed
index 22c034c88ab1c..69cabcb32d333 100644
--- a/src/tools/clippy/tests/ui/box_default.fixed
+++ b/src/tools/clippy/tests/ui/box_default.fixed
@@ -36,7 +36,7 @@ fn main() {
issue_10381();
// `Box::