about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-30 03:10:47 +0000
committerbors <bors@rust-lang.org>2020-09-30 03:10:47 +0000
commit6ac6c675744ecce378b13a34686bc3095e9ebc72 (patch)
treeaa312ad36bcebc359db181b343abece7a050c013
parent0d9afb67174131c16ca111dc368d342d120824e2 (diff)
parentadda0cd6852b9b00b0a9cbba94ece28da6a44126 (diff)
downloadrust-6ac6c675744ecce378b13a34686bc3095e9ebc72.tar.gz
rust-6ac6c675744ecce378b13a34686bc3095e9ebc72.zip
Auto merge of #77069 - sexxi-goose:closure_print_2, r=nikomatsakis
pretty.rs: Update Closure and Generator print

More detailed outline: https://github.com/rust-lang/project-rfc-2229/pull/17

Closes: https://github.com/rust-lang/project-rfc-2229/issues/11

r? `@nikomatsakis`
cc `@eddyb` `@davidtwco` `@estebank`
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs126
-rw-r--r--src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir4
-rw-r--r--src/test/ui/async-await/issue-68112.stderr4
-rw-r--r--src/test/ui/block-result/issue-20862.stderr2
-rw-r--r--src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr2
-rw-r--r--src/test/ui/closures/closure-move-sync.stderr4
-rw-r--r--src/test/ui/closures/closure-no-fn-1.stderr2
-rw-r--r--src/test/ui/closures/closure-no-fn-2.stderr2
-rw-r--r--src/test/ui/closures/closure-no-fn-3.stderr2
-rw-r--r--src/test/ui/closures/closure-reform-bad.stderr2
-rw-r--r--src/test/ui/closures/closure_cap_coerce_many_fail.stderr14
-rw-r--r--src/test/ui/closures/print/closure-print-generic-1.rs23
-rw-r--r--src/test/ui/closures/print/closure-print-generic-1.stderr20
-rw-r--r--src/test/ui/closures/print/closure-print-generic-2.rs13
-rw-r--r--src/test/ui/closures/print/closure-print-generic-2.stderr20
-rw-r--r--src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs16
-rw-r--r--src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr20
-rw-r--r--src/test/ui/closures/print/closure-print-generic-verbose-1.rs24
-rw-r--r--src/test/ui/closures/print/closure-print-generic-verbose-1.stderr20
-rw-r--r--src/test/ui/closures/print/closure-print-generic-verbose-2.rs16
-rw-r--r--src/test/ui/closures/print/closure-print-generic-verbose-2.stderr20
-rw-r--r--src/test/ui/closures/print/closure-print-verbose.rs12
-rw-r--r--src/test/ui/closures/print/closure-print-verbose.stderr14
-rw-r--r--src/test/ui/generator/issue-68112.stderr2
-rw-r--r--src/test/ui/generator/not-send-sync.stderr2
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-1.rs60
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-1.stderr40
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-2.rs24
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-2.stderr36
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-3.rs12
-rw-r--r--src/test/ui/generator/print/generator-print-verbose-3.stderr19
-rw-r--r--src/test/ui/impl-trait/auto-trait-leak2.stderr4
-rw-r--r--src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr6
-rw-r--r--src/test/ui/interior-mutability/interior-mutability.stderr2
-rw-r--r--src/test/ui/issues/issue-12127.stderr2
-rw-r--r--src/test/ui/issues/issue-31173.stderr14
-rw-r--r--src/test/ui/kindck/kindck-nonsendable-1.stderr6
-rw-r--r--src/test/ui/no-send-res-ports.stderr6
-rw-r--r--src/test/ui/not-clone-closure.stderr8
-rw-r--r--src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr2
-rw-r--r--src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr8
41 files changed, 513 insertions, 122 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index cfc4b062885..7b5cf681f38 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -641,42 +641,35 @@ pub trait PrettyPrinter<'tcx>:
             }
             ty::Str => p!(write("str")),
             ty::Generator(did, substs, movability) => {
+                p!(write("["));
                 match movability {
-                    hir::Movability::Movable => p!(write("[generator")),
-                    hir::Movability::Static => p!(write("[static generator")),
+                    hir::Movability::Movable => {}
+                    hir::Movability::Static => p!(write("static ")),
                 }
 
-                // FIXME(eddyb) should use `def_span`.
-                if let Some(did) = did.as_local() {
-                    let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
-                    let span = self.tcx().hir().span(hir_id);
-                    p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
-
-                    if substs.as_generator().is_valid() {
-                        let upvar_tys = substs.as_generator().upvar_tys();
-                        let mut sep = " ";
-                        for (&var_id, upvar_ty) in self
-                            .tcx()
-                            .upvars_mentioned(did)
-                            .as_ref()
-                            .iter()
-                            .flat_map(|v| v.keys())
-                            .zip(upvar_tys)
-                        {
-                            p!(write("{}{}:", sep, self.tcx().hir().name(var_id)), print(upvar_ty));
-                            sep = ", ";
-                        }
+                if !self.tcx().sess.verbose() {
+                    p!(write("generator"));
+                    // FIXME(eddyb) should use `def_span`.
+                    if let Some(did) = did.as_local() {
+                        let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
+                        let span = self.tcx().hir().span(hir_id);
+                        p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
+                    } else {
+                        p!(write("@{}", self.tcx().def_path_str(did)));
                     }
                 } else {
-                    p!(write("@{}", self.tcx().def_path_str(did)));
-
+                    p!(print_def_path(did, substs));
                     if substs.as_generator().is_valid() {
-                        let upvar_tys = substs.as_generator().upvar_tys();
-                        let mut sep = " ";
-                        for (index, upvar_ty) in upvar_tys.enumerate() {
-                            p!(write("{}{}:", sep, index), print(upvar_ty));
-                            sep = ", ";
+                        // Search for the first inference variable
+                        p!(write(" upvar_tys=("));
+                        let mut uninferred_ty =
+                            substs.as_generator().upvar_tys().filter(|ty| ty.is_ty_infer());
+                        if uninferred_ty.next().is_some() {
+                            p!(write("unavailable"));
+                        } else {
+                            self = self.comma_sep(substs.as_generator().upvar_tys())?;
                         }
+                        p!(write(")"));
                     }
                 }
 
@@ -684,61 +677,50 @@ pub trait PrettyPrinter<'tcx>:
                     p!(write(" "), print(substs.as_generator().witness()));
                 }
 
-                p!(write("]"))
+                p!(write("]"));
             }
             ty::GeneratorWitness(types) => {
                 p!(in_binder(&types));
             }
             ty::Closure(did, substs) => {
-                p!(write("[closure"));
-
-                // FIXME(eddyb) should use `def_span`.
-                if let Some(did) = did.as_local() {
-                    let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
-                    if self.tcx().sess.opts.debugging_opts.span_free_formats {
-                        p!(write("@"), print_def_path(did.to_def_id(), substs));
-                    } else {
-                        let span = self.tcx().hir().span(hir_id);
-                        p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
-                    }
-
-                    if substs.as_closure().is_valid() {
-                        let upvar_tys = substs.as_closure().upvar_tys();
-                        let mut sep = " ";
-                        for (&var_id, upvar_ty) in self
-                            .tcx()
-                            .upvars_mentioned(did)
-                            .as_ref()
-                            .iter()
-                            .flat_map(|v| v.keys())
-                            .zip(upvar_tys)
-                        {
-                            p!(write("{}{}:", sep, self.tcx().hir().name(var_id)), print(upvar_ty));
-                            sep = ", ";
+                p!(write("["));
+                if !self.tcx().sess.verbose() {
+                    p!(write("closure"));
+                    // FIXME(eddyb) should use `def_span`.
+                    if let Some(did) = did.as_local() {
+                        let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
+                        if self.tcx().sess.opts.debugging_opts.span_free_formats {
+                            p!(write("@"), print_def_path(did.to_def_id(), substs));
+                        } else {
+                            let span = self.tcx().hir().span(hir_id);
+                            p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
                         }
+                    } else {
+                        p!(write("@{}", self.tcx().def_path_str(did)));
                     }
                 } else {
-                    p!(write("@{}", self.tcx().def_path_str(did)));
-
+                    p!(print_def_path(did, substs));
                     if substs.as_closure().is_valid() {
-                        let upvar_tys = substs.as_closure().upvar_tys();
-                        let mut sep = " ";
-                        for (index, upvar_ty) in upvar_tys.enumerate() {
-                            p!(write("{}{}:", sep, index), print(upvar_ty));
-                            sep = ", ";
+                        // Search for the first inference variable
+                        let mut uninferred_ty =
+                            substs.as_closure().upvar_tys().filter(|ty| ty.is_ty_infer());
+                        if uninferred_ty.next().is_some() {
+                            // If the upvar substs contain an inference variable we haven't
+                            // finished capture analysis.
+                            p!(write(" closure_substs=(unavailable)"));
+                        } else {
+                            p!(write(" closure_kind_ty="), print(substs.as_closure().kind_ty()));
+                            p!(
+                                write(" closure_sig_as_fn_ptr_ty="),
+                                print(substs.as_closure().sig_as_fn_ptr_ty())
+                            );
+                            p!(write(" upvar_tys=("));
+                            self = self.comma_sep(substs.as_closure().upvar_tys())?;
+                            p!(write(")"));
                         }
                     }
                 }
-
-                if self.tcx().sess.verbose() && substs.as_closure().is_valid() {
-                    p!(write(" closure_kind_ty="), print(substs.as_closure().kind_ty()));
-                    p!(
-                        write(" closure_sig_as_fn_ptr_ty="),
-                        print(substs.as_closure().sig_as_fn_ptr_ty())
-                    );
-                }
-
-                p!(write("]"))
+                p!(write("]"));
             }
             ty::Array(ty, sz) => {
                 p!(write("["), print(ty), write("; "));
diff --git a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
index cb222a997b6..5138b50c9f0 100644
--- a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
+++ b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
@@ -4,10 +4,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
     debug t => _1;                       // in scope 0 at $DIR/inline-closure-captures.rs:10:17: 10:18
     debug q => _2;                       // in scope 0 at $DIR/inline-closure-captures.rs:10:23: 10:24
     let mut _0: (i32, T);                // return place in scope 0 at $DIR/inline-closure-captures.rs:10:34: 10:42
-    let _3: [closure@foo<T>::{closure#0} q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:11:9: 11:10
+    let _3: [closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline-closure-captures.rs:11:9: 11:10
     let mut _4: &i32;                    // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
     let mut _5: &T;                      // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
-    let mut _6: &[closure@foo<T>::{closure#0} q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:6
+    let mut _6: &[closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:6
     let mut _7: (i32,);                  // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
     let mut _8: i32;                     // in scope 0 at $DIR/inline-closure-captures.rs:12:7: 12:8
     let mut _10: i32;                    // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr
index 07269f70f6b..e97d088cf3e 100644
--- a/src/test/ui/async-await/issue-68112.stderr
+++ b/src/test/ui/async-await/issue-68112.stderr
@@ -41,8 +41,8 @@ LL |     require_send(send_fut);
    |
    = help: the trait `Sync` is not implemented for `RefCell<i32>`
    = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
-   = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36 t:Arc<RefCell<i32>> {}]`
-   = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36 t:Arc<RefCell<i32>> {}]>`
+   = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36 {}]`
+   = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36 {}]>`
    = note: required because it appears within the type `impl Future`
    = note: required because it appears within the type `impl Future`
    = note: required because it appears within the type `impl Future`
diff --git a/src/test/ui/block-result/issue-20862.stderr b/src/test/ui/block-result/issue-20862.stderr
index 560c9c2fbef..09c06e8428d 100644
--- a/src/test/ui/block-result/issue-20862.stderr
+++ b/src/test/ui/block-result/issue-20862.stderr
@@ -7,7 +7,7 @@ LL |     |y| x + y
    |     ^^^^^^^^^ 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]`
 
 error[E0618]: expected function, found `()`
   --> $DIR/issue-20862.rs:7:13
diff --git a/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
index 3781691ff41..e8a026cfab9 100644
--- a/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
+++ b/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr
@@ -4,7 +4,7 @@ error: lifetime may not live long enough
 LL |     let _action = move || {
    |                   -------
    |                   |     |
-   |                   |     return type of closure is [closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:15 f:&'2 [closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:2:13: 2:23]]
+   |                   |     return type of closure is [closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:15]
    |                   lifetime `'1` represents this closure's body
 LL |         || f() // The `nested` closure
    |         ^^^^^^ returning this value requires that `'1` must outlive `'2`
diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr
index 505cae981b0..da5e25c0d18 100644
--- a/src/test/ui/closures/closure-move-sync.stderr
+++ b/src/test/ui/closures/closure-move-sync.stderr
@@ -11,7 +11,7 @@ LL |     F: Send + 'static,
    |
    = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>`
    = note: required because of the requirements on the impl of `Send` for `&std::sync::mpsc::Receiver<()>`
-   = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6 recv:&std::sync::mpsc::Receiver<()>]`
+   = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6]`
 
 error[E0277]: `Sender<()>` cannot be shared between threads safely
   --> $DIR/closure-move-sync.rs:18:5
@@ -26,7 +26,7 @@ LL |     F: Send + 'static,
    |
    = help: the trait `Sync` is not implemented for `Sender<()>`
    = note: required because of the requirements on the impl of `Send` for `&Sender<()>`
-   = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42 tx:&Sender<()>]`
+   = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42]`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/closures/closure-no-fn-1.stderr b/src/test/ui/closures/closure-no-fn-1.stderr
index 5e76ee5a9a5..76136315a1b 100644
--- a/src/test/ui/closures/closure-no-fn-1.stderr
+++ b/src/test/ui/closures/closure-no-fn-1.stderr
@@ -7,7 +7,7 @@ LL |     let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
    |              expected due to this
    |
    = note: expected fn pointer `fn(u8) -> u8`
-                 found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]`
+                 found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/closure-no-fn-2.stderr b/src/test/ui/closures/closure-no-fn-2.stderr
index 07ffd6e5c99..85cbdbe7c18 100644
--- a/src/test/ui/closures/closure-no-fn-2.stderr
+++ b/src/test/ui/closures/closure-no-fn-2.stderr
@@ -7,7 +7,7 @@ LL |     let bar: fn() -> u8 = || { b };
    |              expected due to this
    |
    = note: expected fn pointer `fn() -> u8`
-                 found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35 b:_]`
+                 found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/closure-no-fn-3.stderr b/src/test/ui/closures/closure-no-fn-3.stderr
index 4b3b4be798f..95683a786ba 100644
--- a/src/test/ui/closures/closure-no-fn-3.stderr
+++ b/src/test/ui/closures/closure-no-fn-3.stderr
@@ -1,4 +1,4 @@
-error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37 b:_]` as `fn() -> u8`
+error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37]` as `fn() -> u8`
   --> $DIR/closure-no-fn-3.rs:6:27
    |
 LL |     let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr
index 3c4ae450764..77c8c7ab794 100644
--- a/src/test/ui/closures/closure-reform-bad.stderr
+++ b/src/test/ui/closures/closure-reform-bad.stderr
@@ -7,7 +7,7 @@ LL |     call_bare(f)
    |               ^ expected fn pointer, found closure
    |
    = note: expected fn pointer `for<'r> fn(&'r str)`
-                 found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50 string:_]`
+                 found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/closure_cap_coerce_many_fail.stderr b/src/test/ui/closures/closure_cap_coerce_many_fail.stderr
index 63eb0bd8fab..bd2e31648cc 100644
--- a/src/test/ui/closures/closure_cap_coerce_many_fail.stderr
+++ b/src/test/ui/closures/closure_cap_coerce_many_fail.stderr
@@ -12,7 +12,7 @@ LL | |     };
    | |_____- `match` arms have incompatible types
    |
    = note: expected type `fn(i32, i32) -> i32 {add}`
-           found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43 cap:_]`
+           found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43]`
 
 error[E0308]: `match` arms have incompatible types
   --> $DIR/closure_cap_coerce_many_fail.rs:18:16
@@ -28,7 +28,7 @@ LL | |     };
    | |_____- `match` arms have incompatible types
    |
    = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
-           found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43 cap:_]`
+           found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43]`
    = note: no two closures, even if identical, have the same type
    = help: consider boxing your closure and/or using it as a trait object
 
@@ -38,14 +38,14 @@ error[E0308]: `match` arms have incompatible types
 LL |       let _ = match "+" {
    |  _____________-
 LL | |         "+" => |a, b| (a + b + cap) as i32,
-   | |                --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43 cap:_]`
+   | |                --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
 LL | |         "-" => |a, b| (a - b) as i32,
    | |                ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
 LL | |         _ => unimplemented!(),
 LL | |     };
    | |_____- `match` arms have incompatible types
    |
-   = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43 cap:_]`
+   = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
            found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:37]`
    = note: no two closures, even if identical, have the same type
    = help: consider boxing your closure and/or using it as a trait object
@@ -56,15 +56,15 @@ error[E0308]: `match` arms have incompatible types
 LL |       let _ = match "+" {
    |  _____________-
 LL | |         "+" => |a, b| (a + b + cap) as i32,
-   | |                --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]`
+   | |                --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
 LL | |         "-" => |a, b| (a - b + cap) as i32,
    | |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
 LL | |         _ => unimplemented!(),
 LL | |     };
    | |_____- `match` arms have incompatible types
    |
-   = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]`
-           found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43 cap:_]`
+   = note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
+           found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43]`
    = note: no two closures, even if identical, have the same type
    = help: consider boxing your closure and/or using it as a trait object
 
diff --git a/src/test/ui/closures/print/closure-print-generic-1.rs b/src/test/ui/closures/print/closure-print-generic-1.rs
new file mode 100644
index 00000000000..504b4adbeb9
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-1.rs
@@ -0,0 +1,23 @@
+fn to_fn_once<F: FnOnce()>(f: F) -> F {
+    f
+}
+
+fn f<T: std::fmt::Display>(y: T) {
+    struct Foo<U: std::fmt::Display> {
+        x: U,
+    };
+
+    let foo = Foo { x: "x" };
+
+    let c = to_fn_once(move || {
+        println!("{} {}", foo.x, y);
+    });
+
+    c();
+    c();
+    //~^ ERROR use of moved value
+}
+
+fn main() {
+    f("S");
+}
diff --git a/src/test/ui/closures/print/closure-print-generic-1.stderr b/src/test/ui/closures/print/closure-print-generic-1.stderr
new file mode 100644
index 00000000000..43a12f675f5
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-1.stderr
@@ -0,0 +1,20 @@
+error[E0382]: use of moved value: `c`
+  --> $DIR/closure-print-generic-1.rs:17:5
+   |
+LL |     let c = to_fn_once(move || {
+   |         - move occurs because `c` has type `[closure@$DIR/closure-print-generic-1.rs:12:24: 14:6]`, which does not implement the `Copy` trait
+...
+LL |     c();
+   |     --- `c` moved due to this call
+LL |     c();
+   |     ^ value used here after move
+   |
+note: this value implements `FnOnce`, which causes it to be moved when called
+  --> $DIR/closure-print-generic-1.rs:16:5
+   |
+LL |     c();
+   |     ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/closures/print/closure-print-generic-2.rs b/src/test/ui/closures/print/closure-print-generic-2.rs
new file mode 100644
index 00000000000..3f77fd26b17
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-2.rs
@@ -0,0 +1,13 @@
+mod mod1 {
+    pub fn f<T: std::fmt::Display>(t: T) {
+        let x = 20;
+
+        let c = || println!("{} {}", t, x);
+        let c1: () = c;
+        //~^ ERROR mismatched types
+    }
+}
+
+fn main() {
+    mod1::f(5i32);
+}
diff --git a/src/test/ui/closures/print/closure-print-generic-2.stderr b/src/test/ui/closures/print/closure-print-generic-2.stderr
new file mode 100644
index 00000000000..f7cfbd251b7
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-2.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-print-generic-2.rs:6:22
+   |
+LL |         let c = || println!("{} {}", t, x);
+   |                 -------------------------- the found closure
+LL |         let c1: () = c;
+   |                 --   ^ expected `()`, found closure
+   |                 |
+   |                 expected due to this
+   |
+   = note: expected unit type `()`
+                found closure `[closure@$DIR/closure-print-generic-2.rs:5:17: 5:43]`
+help: use parentheses to call this closure
+   |
+LL |         let c1: () = c();
+   |                       ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs b/src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs
new file mode 100644
index 00000000000..07bf8fe4c00
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.rs
@@ -0,0 +1,16 @@
+// compile-flags: -Ztrim-diagnostic-paths=off -Zverbose
+
+mod mod1 {
+    pub fn f<T: std::fmt::Display>(t: T)
+    {
+        let x = 20;
+
+        let c = || println!("{} {}", t, x);
+        let c1 : () = c;
+        //~^ ERROR mismatched types
+    }
+}
+
+fn main() {
+    mod1::f(5i32);
+}
diff --git a/src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr b/src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
new file mode 100644
index 00000000000..7fd929221d0
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-print-generic-trim-off-verbose-2.rs:9:23
+   |
+LL |         let c = || println!("{} {}", t, x);
+   |                 -------------------------- the found closure
+LL |         let c1 : () = c;
+   |                  --   ^ expected `()`, found closure
+   |                  |
+   |                  expected due to this
+   |
+   = note: expected unit type `()`
+                found closure `[mod1::f<T>::{closure#0} closure_substs=(unavailable)]`
+help: use parentheses to call this closure
+   |
+LL |         let c1 : () = c();
+   |                        ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/closures/print/closure-print-generic-verbose-1.rs b/src/test/ui/closures/print/closure-print-generic-verbose-1.rs
new file mode 100644
index 00000000000..67d37f1c59b
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-verbose-1.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Zverbose
+
+fn to_fn_once<F:FnOnce()>(f: F) -> F { f }
+
+fn f<T: std::fmt::Display>(y: T) {
+    struct Foo<U: std::fmt::Display> {
+        x: U
+    };
+
+    let foo =  Foo{ x: "x" };
+
+    let c = to_fn_once(move|| {
+        println!("{} {}", foo.x, y);
+    });
+
+    c();
+    c();
+    //~^ ERROR use of moved value
+}
+
+
+fn main() {
+    f("S");
+}
diff --git a/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr b/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr
new file mode 100644
index 00000000000..fdaf353fe3d
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr
@@ -0,0 +1,20 @@
+error[E0382]: use of moved value: `c`
+  --> $DIR/closure-print-generic-verbose-1.rs:17:5
+   |
+LL |     let c = to_fn_once(move|| {
+   |         - move occurs because `c` has type `[f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'_#10r str>, T)]`, which does not implement the `Copy` trait
+...
+LL |     c();
+   |     --- `c` moved due to this call
+LL |     c();
+   |     ^ value used here after move
+   |
+note: this value implements `FnOnce`, which causes it to be moved when called
+  --> $DIR/closure-print-generic-verbose-1.rs:16:5
+   |
+LL |     c();
+   |     ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/closures/print/closure-print-generic-verbose-2.rs b/src/test/ui/closures/print/closure-print-generic-verbose-2.rs
new file mode 100644
index 00000000000..f460fedffb7
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-verbose-2.rs
@@ -0,0 +1,16 @@
+// compile-flags: -Zverbose
+
+mod mod1 {
+    pub fn f<T: std::fmt::Display>(t: T)
+    {
+        let x = 20;
+
+        let c = || println!("{} {}", t, x);
+        let c1 : () = c;
+        //~^ ERROR mismatched types
+    }
+}
+
+fn main() {
+    mod1::f(5i32);
+}
diff --git a/src/test/ui/closures/print/closure-print-generic-verbose-2.stderr b/src/test/ui/closures/print/closure-print-generic-verbose-2.stderr
new file mode 100644
index 00000000000..680f6ff6792
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-generic-verbose-2.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-print-generic-verbose-2.rs:9:23
+   |
+LL |         let c = || println!("{} {}", t, x);
+   |                 -------------------------- the found closure
+LL |         let c1 : () = c;
+   |                  --   ^ expected `()`, found closure
+   |                  |
+   |                  expected due to this
+   |
+   = note: expected unit type `()`
+                found closure `[f<T>::{closure#0} closure_substs=(unavailable)]`
+help: use parentheses to call this closure
+   |
+LL |         let c1 : () = c();
+   |                        ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/closures/print/closure-print-verbose.rs b/src/test/ui/closures/print/closure-print-verbose.rs
new file mode 100644
index 00000000000..4b0438a91ed
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-verbose.rs
@@ -0,0 +1,12 @@
+// compile-flags: -Zverbose
+
+// Same as closure-coerce-fn-1.rs
+
+// Ensure that capturing closures are never coerced to fns
+// Especially interesting as non-capturing closures can be.
+
+fn main() {
+    let mut a = 0u8;
+    let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
+    //~^ ERROR mismatched types
+}
diff --git a/src/test/ui/closures/print/closure-print-verbose.stderr b/src/test/ui/closures/print/closure-print-verbose.stderr
new file mode 100644
index 00000000000..9e07137a241
--- /dev/null
+++ b/src/test/ui/closures/print/closure-print-verbose.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-print-verbose.rs:10:29
+   |
+LL |     let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
+   |              ------------   ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
+   |              |
+   |              expected due to this
+   |
+   = note: expected fn pointer `fn(u8) -> u8`
+                 found closure `[main::{closure#0} closure_substs=(unavailable)]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr
index 84d2a854a4b..96a8d6d70e0 100644
--- a/src/test/ui/generator/issue-68112.stderr
+++ b/src/test/ui/generator/issue-68112.stderr
@@ -29,7 +29,7 @@ LL |     require_send(send_gen);
    |
    = help: the trait `Sync` is not implemented for `RefCell<i32>`
    = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
-   = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:38:5: 41:6 t:Arc<RefCell<i32>> {()}]`
+   = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:38:5: 41:6 {()}]`
    = note: required because it appears within the type `impl Generator`
    = note: required because it appears within the type `impl Generator`
    = note: required because it appears within the type `{impl Generator, ()}`
diff --git a/src/test/ui/generator/not-send-sync.stderr b/src/test/ui/generator/not-send-sync.stderr
index 32527c45c35..2384ed3d249 100644
--- a/src/test/ui/generator/not-send-sync.stderr
+++ b/src/test/ui/generator/not-send-sync.stderr
@@ -9,7 +9,7 @@ LL |     assert_send(|| {
    |
    = help: the trait `Sync` is not implemented for `Cell<i32>`
    = note: required because of the requirements on the impl of `Send` for `&Cell<i32>`
-   = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6 a:&Cell<i32> _]`
+   = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6 _]`
 
 error: generator cannot be shared between threads safely
   --> $DIR/not-send-sync.rs:9:5
diff --git a/src/test/ui/generator/print/generator-print-verbose-1.rs b/src/test/ui/generator/print/generator-print-verbose-1.rs
new file mode 100644
index 00000000000..fe0687722b0
--- /dev/null
+++ b/src/test/ui/generator/print/generator-print-verbose-1.rs
@@ -0,0 +1,60 @@
+// compile-flags: -Zverbose
+
+// Same as: src/test/ui/generator/issue-68112.stderr
+
+#![feature(generators, generator_trait)]
+
+use std::{
+    cell::RefCell,
+    sync::Arc,
+    pin::Pin,
+    ops::{Generator, GeneratorState},
+};
+
+pub struct Ready<T>(Option<T>);
+impl<T> Generator<()> for Ready<T> {
+    type Return = T;
+    type Yield = ();
+    fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
+        GeneratorState::Complete(self.0.take().unwrap())
+    }
+}
+pub fn make_gen1<T>(t: T) -> Ready<T> {
+    Ready(Some(t))
+}
+
+fn require_send(_: impl Send) {}
+
+fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> {
+    make_gen1(Arc::new(RefCell::new(0)))
+}
+
+fn test1() {
+    let send_gen = || {
+        let _non_send_gen = make_non_send_generator();
+        yield;
+    };
+    require_send(send_gen);
+    //~^ ERROR generator cannot be sent between threads
+}
+
+pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+    || {
+        yield;
+        t
+    }
+}
+fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+    make_gen2(Arc::new(RefCell::new(0)))
+}
+
+fn test2() {
+    let send_gen = || {
+        let _non_send_gen = make_non_send_generator2();
+        yield;
+    };
+    require_send(send_gen);
+    //~^ ERROR `RefCell<i32>` cannot be shared between threads safely
+}
+
+fn main() {}
diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr
new file mode 100644
index 00000000000..b5c63584c6c
--- /dev/null
+++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr
@@ -0,0 +1,40 @@
+error: generator cannot be sent between threads safely
+  --> $DIR/generator-print-verbose-1.rs:37:5
+   |
+LL | fn require_send(_: impl Send) {}
+   |                         ---- required by this bound in `require_send`
+...
+LL |     require_send(send_gen);
+   |     ^^^^^^^^^^^^ generator is not `Send`
+   |
+   = help: the trait `Sync` is not implemented for `RefCell<i32>`
+note: generator is not `Send` as this value is used across a yield
+  --> $DIR/generator-print-verbose-1.rs:35:9
+   |
+LL |         let _non_send_gen = make_non_send_generator();
+   |             ------------- has type `Opaque(DefId(0:24 ~ generator_print_verbose_1[317d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
+LL |         yield;
+   |         ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
+LL |     };
+   |     - `_non_send_gen` is later dropped here
+
+error[E0277]: `RefCell<i32>` cannot be shared between threads safely
+  --> $DIR/generator-print-verbose-1.rs:56:5
+   |
+LL | fn require_send(_: impl Send) {}
+   |                         ---- required by this bound in `require_send`
+...
+LL |     require_send(send_gen);
+   |     ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `RefCell<i32>`
+   = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
+   = note: required because it appears within the type `[make_gen2<Arc<RefCell<i32>>>::{closure#0} upvar_tys=(Arc<RefCell<i32>>) {()}]`
+   = note: required because it appears within the type `Opaque(DefId(0:29 ~ generator_print_verbose_1[317d]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])`
+   = note: required because it appears within the type `Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), [])`
+   = note: required because it appears within the type `{Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), []), ()}`
+   = note: required because it appears within the type `[test2::{closure#0} upvar_tys=() {Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), []), ()}]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/generator/print/generator-print-verbose-2.rs b/src/test/ui/generator/print/generator-print-verbose-2.rs
new file mode 100644
index 00000000000..d914719cb36
--- /dev/null
+++ b/src/test/ui/generator/print/generator-print-verbose-2.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Zverbose
+
+// Same as test/ui/generator/not-send-sync.rs
+#![feature(generators)]
+
+use std::cell::Cell;
+
+fn main() {
+    fn assert_sync<T: Sync>(_: T) {}
+    fn assert_send<T: Send>(_: T) {}
+
+    assert_sync(|| {
+        //~^ ERROR: generator cannot be shared between threads safely
+        let a = Cell::new(2);
+        yield;
+    });
+
+    let a = Cell::new(2);
+    assert_send(|| {
+        //~^ ERROR: E0277
+        drop(&a);
+        yield;
+    });
+}
diff --git a/src/test/ui/generator/print/generator-print-verbose-2.stderr b/src/test/ui/generator/print/generator-print-verbose-2.stderr
new file mode 100644
index 00000000000..cc45d5631cb
--- /dev/null
+++ b/src/test/ui/generator/print/generator-print-verbose-2.stderr
@@ -0,0 +1,36 @@
+error[E0277]: `Cell<i32>` cannot be shared between threads safely
+  --> $DIR/generator-print-verbose-2.rs:19:5
+   |
+LL |     fn assert_send<T: Send>(_: T) {}
+   |                       ---- required by this bound in `assert_send`
+...
+LL |     assert_send(|| {
+   |     ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `Cell<i32>`
+   = note: required because of the requirements on the impl of `Send` for `&'_#3r Cell<i32>`
+   = note: required because it appears within the type `[main::{closure#1} upvar_tys=(&'_#3r Cell<i32>) _#16t]`
+
+error: generator cannot be shared between threads safely
+  --> $DIR/generator-print-verbose-2.rs:12:5
+   |
+LL |     fn assert_sync<T: Sync>(_: T) {}
+   |                       ---- required by this bound in `assert_sync`
+...
+LL |     assert_sync(|| {
+   |     ^^^^^^^^^^^ generator is not `Sync`
+   |
+   = help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
+note: generator is not `Sync` as this value is used across a yield
+  --> $DIR/generator-print-verbose-2.rs:15:9
+   |
+LL |         let a = Cell::new(2);
+   |             - has type `Cell<i32>` which is not `Sync`
+LL |         yield;
+   |         ^^^^^ yield occurs here, with `a` maybe used later
+LL |     });
+   |     - `a` is later dropped here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/generator/print/generator-print-verbose-3.rs b/src/test/ui/generator/print/generator-print-verbose-3.rs
new file mode 100644
index 00000000000..8689539ec8e
--- /dev/null
+++ b/src/test/ui/generator/print/generator-print-verbose-3.rs
@@ -0,0 +1,12 @@
+// compile-flags: -Zverbose
+
+#![feature(generators, generator_trait)]
+
+fn main() {
+    let x = "Type mismatch test";
+    let generator :() = || {
+    //~^ ERROR mismatched types
+        yield 1i32;
+        return x
+    };
+}
diff --git a/src/test/ui/generator/print/generator-print-verbose-3.stderr b/src/test/ui/generator/print/generator-print-verbose-3.stderr
new file mode 100644
index 00000000000..0ce108dfd62
--- /dev/null
+++ b/src/test/ui/generator/print/generator-print-verbose-3.stderr
@@ -0,0 +1,19 @@
+error[E0308]: mismatched types
+  --> $DIR/generator-print-verbose-3.rs:7:25
+   |
+LL |       let generator :() = || {
+   |  ____________________--___^
+   | |                    |
+   | |                    expected due to this
+LL | |
+LL | |         yield 1i32;
+LL | |         return x
+LL | |     };
+   | |_____^ expected `()`, found generator
+   |
+   = note: expected unit type `()`
+              found generator `[main::{closure#0} upvar_tys=(unavailable) _#5t]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/impl-trait/auto-trait-leak2.stderr b/src/test/ui/impl-trait/auto-trait-leak2.stderr
index 8bb05c89e91..6b2b8248a4f 100644
--- a/src/test/ui/impl-trait/auto-trait-leak2.stderr
+++ b/src/test/ui/impl-trait/auto-trait-leak2.stderr
@@ -11,7 +11,7 @@ LL |     send(before());
    |     ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
    |
    = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
-   = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22 p:Rc<Cell<i32>>]`
+   = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]`
    = note: required because it appears within the type `impl Fn<(i32,)>`
 
 error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
@@ -27,7 +27,7 @@ LL | fn after() -> impl Fn(i32) {
    |               ------------ within this `impl Fn<(i32,)>`
    |
    = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
-   = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22 p:Rc<Cell<i32>>]`
+   = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22]`
    = note: required because it appears within the type `impl Fn<(i32,)>`
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
index 42e13411bda..0f89ec2475c 100644
--- a/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
+++ b/src/test/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
@@ -54,7 +54,7 @@ LL |   fn closure_capture() -> impl Sized {
 LL | /     move || {
 LL | |         x;
 LL | |     }
-   | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 37:6 x:impl Sized]`
+   | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 37:6]`
 
 error[E0720]: cannot resolve opaque type
   --> $DIR/recursive-impl-trait-type-indirect.rs:40:29
@@ -65,7 +65,7 @@ LL |   fn closure_ref_capture() -> impl Sized {
 LL | /     move || {
 LL | |         &x;
 LL | |     }
-   | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 45:6 x:impl Sized]`
+   | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 45:6]`
 
 error[E0720]: cannot resolve opaque type
   --> $DIR/recursive-impl-trait-type-indirect.rs:48:21
@@ -95,7 +95,7 @@ LL | /     move || {
 LL | |         yield;
 LL | |         x;
 LL | |     }
-   | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 64:6 x:impl Sized {()}]`
+   | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 64:6 {()}]`
 
 error[E0720]: cannot resolve opaque type
   --> $DIR/recursive-impl-trait-type-indirect.rs:67:35
diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr
index 3e19746cc5c..dd43da11664 100644
--- a/src/test/ui/interior-mutability/interior-mutability.stderr
+++ b/src/test/ui/interior-mutability/interior-mutability.stderr
@@ -12,7 +12,7 @@ LL | pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
    = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
    = note: required because it appears within the type `Cell<i32>`
    = note: required because of the requirements on the impl of `UnwindSafe` for `&Cell<i32>`
-   = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35 x:&Cell<i32>]`
+   = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-12127.stderr b/src/test/ui/issues/issue-12127.stderr
index e5ac85a1019..e1559ab2fea 100644
--- a/src/test/ui/issues/issue-12127.stderr
+++ b/src/test/ui/issues/issue-12127.stderr
@@ -11,7 +11,7 @@ note: this value implements `FnOnce`, which causes it to be moved when called
    |
 LL |         f();
    |         ^
-   = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41 x:Box<isize>]`, which does not implement the `Copy` trait
+   = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41]`, which does not implement the `Copy` trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr
index a4f69a17cef..818e004ffc8 100644
--- a/src/test/ui/issues/issue-31173.stderr
+++ b/src/test/ui/issues/issue-31173.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]> as Iterator>::Item == &_`
+error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]> as Iterator>::Item == &_`
   --> $DIR/issue-31173.rs:10:10
    |
 LL |         .cloned()
@@ -7,11 +7,11 @@ LL |         .cloned()
    = note:   expected type `u8`
            found reference `&_`
 
-error[E0599]: no method named `collect` found for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` in the current scope
+error[E0599]: no method named `collect` found for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` in the current scope
   --> $DIR/issue-31173.rs:14:10
    |
 LL |         .collect();
-   |          ^^^^^^^ method not found in `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>`
+   |          ^^^^^^^ method not found in `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`
    | 
   ::: $SRC_DIR/core/src/iter/adapters/mod.rs:LL:COL
    |
@@ -22,10 +22,10 @@ LL | pub struct TakeWhile<I, P> {
    | -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
    |
    = note: the method `collect` exists but the following trait bounds were not satisfied:
-           `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]> as Iterator>::Item = &_`
-           which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>: Iterator`
-           `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>: Iterator`
-           which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>: Iterator`
+           `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]> as Iterator>::Item = &_`
+           which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
+           `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
+           which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr
index 45c767fbe6c..c7d67a991bf 100644
--- a/src/test/ui/kindck/kindck-nonsendable-1.stderr
+++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr
@@ -5,12 +5,12 @@ LL | fn bar<F:FnOnce() + Send>(_: F) { }
    |                     ---- required by this bound in `bar`
 ...
 LL |     bar(move|| foo(x));
-   |     ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]`
+   |     ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`
    |     |
    |     `Rc<usize>` cannot be sent between threads safely
    |
-   = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]`, the trait `Send` is not implemented for `Rc<usize>`
-   = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]`
+   = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`, the trait `Send` is not implemented for `Rc<usize>`
+   = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr
index 6bd4537240c..ef7fb4ad7b2 100644
--- a/src/test/ui/no-send-res-ports.stderr
+++ b/src/test/ui/no-send-res-ports.stderr
@@ -9,17 +9,17 @@ LL | |
 LL | |         let y = x;
 LL | |         println!("{:?}", y);
 LL | |     });
-   | |_____- within this `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:Foo]`
+   | |_____- within this `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`
    | 
   ::: $SRC_DIR/std/src/thread/mod.rs:LL:COL
    |
 LL |       F: Send + 'static,
    |          ---- required by this bound in `spawn`
    |
-   = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:Foo]`, the trait `Send` is not implemented for `Rc<()>`
+   = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`, the trait `Send` is not implemented for `Rc<()>`
    = note: required because it appears within the type `Port<()>`
    = note: required because it appears within the type `Foo`
-   = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:Foo]`
+   = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr
index f54a69e1902..a62c21f2ee9 100644
--- a/src/test/ui/not-clone-closure.stderr
+++ b/src/test/ui/not-clone-closure.stderr
@@ -1,16 +1,16 @@
-error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`
+error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
   --> $DIR/not-clone-closure.rs:11:23
    |
 LL |       let hello = move || {
    |  _________________-
 LL | |         println!("Hello {}", a.0);
 LL | |     };
-   | |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`
+   | |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
 LL | 
 LL |       let hello = hello.clone();
-   |                         ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `Clone` is not implemented for `S`
+   |                         ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S`
    |
-   = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`
+   = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
index 2a7dda7b261..ab1fa2a4d87 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr
@@ -33,7 +33,7 @@ LL |     let mut f = move |g: Box<dyn FnMut(isize)>, b: isize| {
    |         ----- captured outer variable
 ...
 LL |         foo(f);
-   |             ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 54:6 s:String]`, which does not implement the `Copy` trait
+   |             ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 54:6]`, which does not implement the `Copy` trait
 
 error[E0505]: cannot move out of `f` because it is borrowed
   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
index cec01fefca8..69e95efa72d 100644
--- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -41,7 +41,7 @@ LL | |
 LL | | where
 LL | |     G: Get<T>
    | |_____________^
-note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:30:5: 32:6 g:G, dest:&mut T]` will meet its required lifetime bounds
+note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:30:5: 32:6]` will meet its required lifetime bounds
   --> $DIR/missing-lifetimes-in-signature.rs:25:37
    |
 LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
@@ -65,7 +65,7 @@ LL | |
 LL | | where
 LL | |     G: Get<T>
    | |_____________^
-note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:52:5: 54:6 g:G, dest:&mut T]` will meet its required lifetime bounds
+note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:52:5: 54:6]` will meet its required lifetime bounds
   --> $DIR/missing-lifetimes-in-signature.rs:47:45
    |
 LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
@@ -86,7 +86,7 @@ note: the parameter type `G` must be valid for the anonymous lifetime #1 defined
    |
 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:61:9: 63:10 g:G, dest:&mut T]` will meet its required lifetime bounds
+note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:61:9: 63:10]` will meet its required lifetime bounds
   --> $DIR/missing-lifetimes-in-signature.rs:59:58
    |
 LL |     fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
@@ -108,7 +108,7 @@ error[E0309]: the parameter type `G` may not live long enough
   --> $DIR/missing-lifetimes-in-signature.rs:79:44
    |
 LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
-   |            -                               ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:84:5: 86:6 g:G, dest:&mut T]` will meet its required lifetime bounds
+   |            -                               ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:84:5: 86:6]` will meet its required lifetime bounds
    |            |
    |            help: consider adding an explicit lifetime bound...: `G: 'a`