Skip to content

Formatting empty array leaks internal function name new_debug #107745

Closed
@Kyuuhachi

Description

@Kyuuhachi

Code

fn main() {
    println!("{:?}", []);
}

Current output

error[E0282]: type annotations needed
 --> src/main.rs:2:22
  |
2 |     println!("{:?}", []);
  |                      ^^ cannot infer type of the type parameter `T` declared on the associated function `new_debug`

Desired output

Not sure about the exact details, but with other generics the error looks like:

error[E0282]: type annotations needed
 --> src/main.rs:3:22
  |
3 |     println!("{:?}", PhantomData);
  |                      ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData`
  |

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions