Skip to content

Commit 835d7d9

Browse files
committed
Auto merge of rust-lang#115696 - RalfJung:closure-ty-print, r=oli-obk
adjust how closure/generator types are printed I saw `&[closure@$DIR/issue-20862.rs:2:5]` and I thought it is a slice type, because that's usually what `&[_]` is... it took me a while to realize that this is just a confusing printer and actually there's no slice. Let's use something that cannot be mistaken for a regular type.
2 parents 84917c8 + 1fac304 commit 835d7d9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

tests/ui/box_default.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
issue_10381();
3737

3838
// `Box::<Option<_>>::default()` would be valid here, but not `Box::default()` or
39-
// `Box::<Option<[closure@...]>::default()`
39+
// `Box::<Option<{closure@...}>::default()`
4040
//
4141
// Would have a suggestion after https://github.com/rust-lang/rust/blob/fdd030127cc68afec44a8d3f6341525dd34e50ae/compiler/rustc_middle/src/ty/diagnostics.rs#L554-L563
4242
let mut unnameable = Box::new(Option::default());

tests/ui/box_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() {
3636
issue_10381();
3737

3838
// `Box::<Option<_>>::default()` would be valid here, but not `Box::default()` or
39-
// `Box::<Option<[closure@...]>::default()`
39+
// `Box::<Option<{closure@...}>::default()`
4040
//
4141
// Would have a suggestion after https://github.com/rust-lang/rust/blob/fdd030127cc68afec44a8d3f6341525dd34e50ae/compiler/rustc_middle/src/ty/diagnostics.rs#L554-L563
4242
let mut unnameable = Box::new(Option::default());

tests/ui/crashes/ice-6251.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
2727
| ^^^^^^^^^^^ expected `usize`, found closure
2828
|
2929
= note: expected type `usize`
30-
found closure `[closure@$DIR/ice-6251.rs:4:44: 4:53]`
30+
found closure `{closure@$DIR/ice-6251.rs:4:44: 4:53}`
3131

3232
error: aborting due to 3 previous errors
3333

0 commit comments

Comments
 (0)