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 the ffi_unwind_calls lint documentation #108588

Merged
merged 3 commits into from Mar 23, 2023

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Mar 1, 2023

This fixes the ffi_unwind_calls documentation to show its output correctly. Currently it is showing the text {{produces}} which is not how it should look.

This fixes it by not ignoring the example. I'm not sure why it was ignored, as the way the lint currently works it doesn't seem to require external linkage. This also fixes several mistakes in the example:

  • There is no ffi_unwind_calls feature.
  • Denies the lint (which is otherwise allow be default).
  • Removes the mod impl which is not valid Rust syntax, and doesn't appear to be needed anyways.

The output now looks like:

warning: call to foreign function with FFI-unwind ABI
  --> lint_example.rs:10:14
   |
10 |     unsafe { foo(); }
   |              ^^^^^ call to foreign function with FFI-unwind ABI
   |
note: the lint level is defined here
  --> lint_example.rs:2:9
   |
2  | #![warn(ffi_unwind_calls)]
   |         ^^^^^^^^^^^^^^^^


warning: call to function pointer with FFI-unwind ABI
  --> lint_example.rs:12:14
   |
12 |     unsafe { ptr(); }
   |              ^^^^^ call to function pointer with FFI-unwind ABI

This also includes some updates to the lint-docs tool to help with this issue:

  • Adds a check if a lint documentation has {{produces}} with an ignored example, and generates an error.
  • All instances of a lint are now displayed. Previously it only showed the first time the lint fires. Some examples may trigger a lint multiple times, and they are all now displayed.

If a lint example has an `ignore` tag, but the lint author also includes
the {{produces}} marker, then the output will just contain the text
`{{produces}}`. This adds a check for this mistake and provides help on
how the lint docs should be written.
@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2023

r? @eholk

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 1, 2023
Some examples may contain multiple lines which trigger the lint.
Previously it would only display the first message.
This updates it so that all matching instances of the lint are displayed.
@eholk
Copy link
Contributor

eholk commented Mar 23, 2023

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Mar 23, 2023

📌 Commit ab2508a has been approved by eholk

It is now in the queue for this repository.

@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 Mar 23, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#106964 (Clarify `Error::last_os_error` can be weird)
 - rust-lang#107718 (Add `-Z time-passes-format` to allow specifying a JSON output for `-Z time-passes`)
 - rust-lang#107880 (Lint ambiguous glob re-exports)
 - rust-lang#108549 (Remove issue number for `link_cfg`)
 - rust-lang#108588 (Fix the ffi_unwind_calls lint documentation)
 - rust-lang#109231 (Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize`)
 - rust-lang#109472 (Add parentheses properly for method calls)
 - rust-lang#109487 (Move useless_anynous_reexport lint into unused_imports)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fc5516b into rust-lang:master Mar 23, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 23, 2023
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. 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.

None yet

4 participants