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

Fix bad suggestions for code from proc_macro #85937

Merged
merged 2 commits into from
Jun 4, 2021

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Jun 2, 2021

Fixes #85932

This disables these suggestions for spans from external macros, while keeping them for macros defined locally:

Before:

3 | #[hello]
  | ^^^^^^^^
  | |
  | expected `&mut i32`, found integer
  | help: consider mutably borrowing here: `&mut #[hello]`

After:

3 | #[hello]
  | ^^^^^^^^ expected `&mut i32`, found integer

Unchanged:

26 | macro_rules! bla { () => { x(123); } }
   |                              ^^^
   |                              |
   |                              expected `&mut i32`, found integer
   |                              help: consider mutably borrowing here: `&mut 123`
...
29 |     bla!();
   |     ------- in this macro invocation

@m-ou-se m-ou-se added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Jun 2, 2021
@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 2, 2021
@m-ou-se m-ou-se changed the title Macro ref suggestions Fix bad suggestions for code from proc_macro Jun 2, 2021
@estebank
Copy link
Contributor

estebank commented Jun 3, 2021

r? @estebank
@bors r+

@bors
Copy link
Contributor

bors commented Jun 3, 2021

📌 Commit e735f60 has been approved by estebank

@rust-highfive rust-highfive assigned estebank and unassigned jackh726 Jun 3, 2021
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jun 3, 2021
…tebank

Fix bad suggestions for code from proc_macro

Fixes rust-lang#85932

This disables these suggestions for spans from external macros, while keeping them for macros defined locally:

Before:
```
3 | #[hello]
  | ^^^^^^^^
  | |
  | expected `&mut i32`, found integer
  | help: consider mutably borrowing here: `&mut #[hello]`
```

After:
```
3 | #[hello]
  | ^^^^^^^^ expected `&mut i32`, found integer
```

Unchanged:
```
26 | macro_rules! bla { () => { x(123); } }
   |                              ^^^
   |                              |
   |                              expected `&mut i32`, found integer
   |                              help: consider mutably borrowing here: `&mut 123`
...
29 |     bla!();
   |     ------- in this macro invocation
```
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 4, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#85717 (Document `From` impls for cow.rs)
 - rust-lang#85850 (Remove unused feature gates)
 - rust-lang#85888 (Fix typo in internal documentation for `TrustedRandomAccess`)
 - rust-lang#85889 (Restoring the `num_def_ids` function in the CStore API )
 - rust-lang#85899 (jsondocck small cleanup)
 - rust-lang#85937 (Fix bad suggestions for code from proc_macro)
 - rust-lang#85963 (Show `::{{constructor}}` in std::any::type_name().)
 - rust-lang#85977 (Fix linkcheck script from getting out of sync.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 99fc56b into rust-lang:master Jun 4, 2021
@rustbot rustbot added this to the 1.54.0 milestone Jun 4, 2021
@m-ou-se m-ou-se deleted the macro-ref-suggestions branch June 14, 2021 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestions are often invalid for proc-macro produced code
6 participants