Skip to content

New #[test] export logic creates wonky error messages #53042

Closed
@djrenren

Description

@djrenren
#[test] fn foo(){}
#[test] fn foo(){}

produces:

error[E0252]: the name `foo` is defined multiple times
  --> ./test.rs:20:8
   |
13 | pub fn foo() {
   |        --- previous import of the value `foo` here
...
20 | pub fn foo() {
   |        ^^^ `foo` reimported here
   |
   = note: `foo` must be defined only once in the value namespace of this module
help: You can use `as` to change the binding name of the import
   |
20 | pub fn foo as other_foo() {
   |        ^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0252`.

PR responsible (sorry!): #52890

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-libtestArea: `#[test]` / the `test` libraryC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions