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

Add rustX check to codeblock attributes lint #118872

Merged
merged 5 commits into from
Dec 13, 2023

Conversation

GuillaumeGomez
Copy link
Member

We discovered this issue here.

I assume that the issue will be present in other places outside of the compiler so it's worth adding a check for it.

First commit is just a small cleanup about variables creation which was a bit strange (at least more than necessary).

r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 12, 2023
@GuillaumeGomez
Copy link
Member Author

Thanks for the suggestion @Urgau!

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

Fixed the error.

|
= help: there is an attribute with a similar name: `edition2018`

error: aborting due to 13 previous errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you write two bad attributes in a row?

```rust2018 shouldpanic
panic!();
```

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This:

warning: unknown attribute `rust2018`
 --> foo.rs:3:1
  |
3 | / /**
4 | | ```rust2018 shouldpanic
5 | | panic!();
6 | | ```
7 | | */
  | |__^
  |
  = help: there is an attribute with a similar name: `edition2018`
  = note: `#[warn(rustdoc::invalid_codeblock_attributes)]` on by default

warning: unknown attribute `shouldpanic`
 --> foo.rs:3:1
  |
3 | / /**
4 | | ```rust2018 shouldpanic
5 | | panic!();
6 | | ```
7 | | */
  | |__^
  |
  = help: there is an attribute with a similar name: `should_panic`
  = help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running

warning: 2 warnings emitted

Copy link
Contributor

@notriddle notriddle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the above comment about combining multiple mistakes, this seems like a great diagnostic improvement. Thanks!

Add a test case for combining them, then r=me

@GuillaumeGomez
Copy link
Member Author

@bors r=notriddle rollup

@bors
Copy link
Contributor

bors commented Dec 12, 2023

📌 Commit 58327c1 has been approved by notriddle

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 Dec 12, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 12, 2023
…, r=notriddle

Add rustX check to codeblock attributes lint

We discovered this issue [here](rust-lang#118802 (comment)).

I assume that the issue will be present in other places outside of the compiler so it's worth adding a check for it.

First commit is just a small cleanup about variables creation which was a bit strange (at least more than necessary).

r? `@notriddle`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Dec 12, 2023
…, r=notriddle

Add rustX check to codeblock attributes lint

We discovered this issue [here](rust-lang#118802 (comment)).

I assume that the issue will be present in other places outside of the compiler so it's worth adding a check for it.

First commit is just a small cleanup about variables creation which was a bit strange (at least more than necessary).

r? ``@notriddle``
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#117050 ([`RFC 3086`] Attempt to try to resolve blocking concerns  )
 - rust-lang#118500 (Move some methods from `tcx.hir()` to `tcx`)
 - rust-lang#118871 (Coroutine variant fields can be uninitialized)
 - rust-lang#118872 (Add rustX check to codeblock attributes lint)
 - rust-lang#118884 (NFC: simplify merging of two vecs)
 - rust-lang#118885 (clippy::complexity fixes)
 - rust-lang#118886 (Clean up variables in `search.js`)
 - rust-lang#118887 (Typo)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 13, 2023
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#118858 (Remove dead codes in core)
 - rust-lang#118864 (Fix alignment passed down to LLVM for simd_masked_load)
 - rust-lang#118872 (Add rustX check to codeblock attributes lint)
 - rust-lang#118873 (fix `waker_getters` tracking issue number)
 - rust-lang#118884 (NFC: simplify merging of two vecs)
 - rust-lang#118885 (clippy::complexity fixes)
 - rust-lang#118886 (Clean up variables in `search.js`)
 - rust-lang#118887 (Typo)
 - rust-lang#118889 (more clippy::complexity fixes)
 - rust-lang#118891 (Actually parse async gen blocks correctly)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0430782 into rust-lang:master Dec 13, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 13, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 13, 2023
Rollup merge of rust-lang#118872 - GuillaumeGomez:codeblock-attr-lint, r=notriddle

Add rustX check to codeblock attributes lint

We discovered this issue [here](rust-lang#118802 (comment)).

I assume that the issue will be present in other places outside of the compiler so it's worth adding a check for it.

First commit is just a small cleanup about variables creation which was a bit strange (at least more than necessary).

r? ```@notriddle```
@GuillaumeGomez GuillaumeGomez deleted the codeblock-attr-lint branch December 13, 2023 09:58
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-rustdoc Relevant to the rustdoc 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

6 participants