Skip to content

"function defined here" notes shouldn't show muts #90889

Closed as not planned
Closed as not planned
@scottmcm

Description

@scottmcm

In #90886 I changed the definition of fold such that it no longer needed the mut on the f parameter, and was surprised to get a UI test failure (in https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-3044.rs) from it. The update from bless:
image

Playground link with the same as that UI test: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=548bf44a26aa1406bafb496f9341bf29

It doesn't seem to be showing the note in playground, though?!?

The current output is:

 note: associated function defined here
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
   |
LL |     fn fold<B, F>(mut self, init: B, mut f: F) -> B
   |        ^^^^

Ideally the output should look like:

 note: associated function defined here
  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
   |
LL |     fn fold<B, F>(self, init: B, f: F) -> B
   |        ^^^^

because the muts are not relevant to the caller of the function.

Metadata

Metadata

Assignees

No one assigned

    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