Skip to content

Commit

Permalink
Auto merge of rust-lang#115696 - RalfJung:closure-ty-print, r=oli-obk
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Sep 22, 2023
2 parents 84917c8 + 1fac304 commit 835d7d9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/ui/box_default.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() {
issue_10381();

// `Box::<Option<_>>::default()` would be valid here, but not `Box::default()` or
// `Box::<Option<[closure@...]>::default()`
// `Box::<Option<{closure@...}>::default()`
//
// Would have a suggestion after https://github.com/rust-lang/rust/blob/fdd030127cc68afec44a8d3f6341525dd34e50ae/compiler/rustc_middle/src/ty/diagnostics.rs#L554-L563
let mut unnameable = Box::new(Option::default());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/box_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() {
issue_10381();

// `Box::<Option<_>>::default()` would be valid here, but not `Box::default()` or
// `Box::<Option<[closure@...]>::default()`
// `Box::<Option<{closure@...}>::default()`
//
// Would have a suggestion after https://github.com/rust-lang/rust/blob/fdd030127cc68afec44a8d3f6341525dd34e50ae/compiler/rustc_middle/src/ty/diagnostics.rs#L554-L563
let mut unnameable = Box::new(Option::default());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/crashes/ice-6251.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
| ^^^^^^^^^^^ expected `usize`, found closure
|
= note: expected type `usize`
found closure `[closure@$DIR/ice-6251.rs:4:44: 4:53]`
found closure `{closure@$DIR/ice-6251.rs:4:44: 4:53}`

error: aborting due to 3 previous errors

Expand Down

0 comments on commit 835d7d9

Please sign in to comment.