Skip to content

suggestion prints expanded macros #41858

Closed
@oli-obk

Description

@oli-obk
Contributor

= help: try with &mut $ crate :: fmt :: format ( format_args ! ( $ ( $ arg ) * ) )

should be

= help: try with &mut format!("foo")

at the minimum. Even better would be to suggest *s for the s on the lhs of the assignment.

fn main() {
    let s = &mut String::new();
    s = format!("foo");
}

produces

error[E0308]: mismatched types
 --> <anon>:3:9
  |
3 |     s = format!("foo");
  |         ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String`
  |
  = note: expected type `&mut std::string::String`
             found type `std::string::String`
  = help: try with `&mut $ crate :: fmt :: format ( format_args ! ( $ ( $ arg ) * ) )`
  = note: this error originates in a macro outside of the current crate

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on May 9, 2017
added a commit that references this issue on Jun 3, 2017

Rollup merge of rust-lang#42368 - estebank:call-site, r=nikomatsakis

bef8fbd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @nikomatsakis@oli-obk

        Issue actions

          suggestion prints expanded macros · Issue #41858 · rust-lang/rust