Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use callsite's span for macro calls on suggestion #42368

Merged
merged 1 commit into from
Jun 3, 2017

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jun 1, 2017

When suggesting an appropriate mutability for a macro call, use the call
span instead of the expanded macro's span.

error[E0308]: mismatched types
  --> $DIR/coerce-suggestions.rs:48:9
   |
48 |     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 format!("foo")`
   = note: this error originates in a macro outside of the current crate

Fix #41858.

When suggesting an appropriate mutability for a macro call, use the call
span instead of the expanded macro's span.
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@nikomatsakis
Copy link
Contributor

This seems fine, though I do wonder if there's a more general rule -- i.e., if we can do this "change to call span of macro" at some other point.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jun 2, 2017

📌 Commit 4142d7b has been approved by nikomatsakis

@shepmaster shepmaster added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 2, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 3, 2017
Use callsite's span for macro calls on suggestion

When suggesting an appropriate mutability for a macro call, use the call
span instead of the expanded macro's span.

```
error[E0308]: mismatched types
  --> $DIR/coerce-suggestions.rs:48:9
   |
48 |     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 format!("foo")`
   = note: this error originates in a macro outside of the current crate
```
Fix rust-lang#41858.
bors added a commit that referenced this pull request Jun 3, 2017
Rollup of 5 pull requests

- Successful merges: #42353, #42354, #42363, #42368, #42382
- Failed merges:
@bors
Copy link
Contributor

bors commented Jun 3, 2017

☔ The latest upstream changes (presumably #42400) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors merged commit 4142d7b into rust-lang:master Jun 3, 2017
@estebank estebank deleted the call-site branch November 9, 2023 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants