Skip to content

Commit 965a89b

Browse files
Update design for PR rust-lang#16117: Count unsafe operations and macro calls once towards the innermost unsafe block
1 parent 4d6fa3c commit 965a89b

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

.exp/design-workflow-5-lint-development.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Other aspects: Lints support configuration options, MSRV restrictions via attrib
2121

2222
## Scaffolding Sequence Diagram
2323

24-
\`\`\`mermaid
24+
```mermaid
2525
sequenceDiagram
2626
participant Developer
2727
participant "cargo dev new_lint" as NewLintTool
@@ -42,11 +42,11 @@ sequenceDiagram
4242
UpdateTool->>LibRs: Update mod declarations between comments
4343
UpdateTool->>README: Update lint counts and links
4444
Note over UpdateTool: Handles deprecated and renamed lints too
45-
\`\`\`
45+
```
4646

4747
## Integration and Execution Sequence Diagram
4848

49-
\`\`\`mermaid
49+
```mermaid
5050
sequenceDiagram
5151
participant User
5252
participant "cargo clippy" as CargoClippy
@@ -62,7 +62,7 @@ sequenceDiagram
6262
Driver->>Compiler: run compilation with registered lints
6363
Store->>Compiler: execute lint passes during compilation phases
6464
Compiler->>User: output diagnostics from lints
65-
\`\`\`
65+
```
6666

6767
## Additional High-Level Design Aspects
6868

pr-analysis-16117.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# PR #16117: Workflow Design Impact Analysis
2+
3+
## Affected Workflows
4+
- **cargo-clippy**: Modified file `clippy_lints/src/multiple_unsafe_ops_per_block.rs` is listed in relevant_files for this workflow. The change affects lint diagnostics produced during `cargo clippy` runs.
5+
- **clippy-driver**: Similarly impacts direct invocations of the Clippy driver via changes to lint logic in `clippy_lints/src/`.
6+
- **testing**: Updates to `tests/ui/multiple_unsafe_ops_per_block.rs` and `.stderr` directly involve the UI testing infrastructure.
7+
- **lint-development**: The PR demonstrates modification of an existing lint in `clippy_lints/src/` and corresponding UI test updates, aligning with this workflow's purpose and relevant files.
8+
9+
## cargo-clippy Analysis
10+
### Summary of design changes
11+
The PR fixes the `multiple_unsafe_ops_per_block` lint to count unsafe operations and macro calls only towards the innermost `unsafe` block, addressing [issue #16116](https://github.com/rust-lang/rust-clippy/issues/16116). This improves lint accuracy for nested unsafe code and macro expansions containing unsafe code.
12+
13+
This affects the internal implementation within the Clippy lints crate, altering diagnostic emission for specific code patterns during the lint execution phase. However, it does not modify workflow components, sequences, or flows documented in `.exp/design-workflow-1-cargo-clippy.md`. No new steps are added, and interactions remain the same.
14+
15+
**Potential benefits**: Reduces false positives in linting nested unsafe blocks, promoting better unsafe code organization and documentation.
16+
17+
No Mermaid diagrams require updates.
18+
19+
## clippy-driver Analysis
20+
### Summary of design changes
21+
Similar to cargo-clippy, the PR changes lint behavior in direct driver usage scenarios, refining how `multiple_unsafe_ops_per_block` operates on unsafe code structures. Documented in `.exp/design-workflow-2-clippy-driver.md`, the high-level design of driver invocation, lint registration, and execution is unaffected; only one lint's pass logic is enhanced.
22+
23+
**Potential implications**: Ensures consistent linting behavior across invocation methods (Cargo vs. direct).
24+
25+
No Mermaid diagrams require updates.
26+
27+
## testing Analysis
28+
### Summary of design changes
29+
The PR updates the UI test input and expected output (`.stderr`) for `multiple_unsafe_ops_per_block` to match the new lint logic, as part of validating the fix. This follows the standard UI testing process in `.exp/design-workflow-4-testing.md` without altering test compilation, execution, or validation steps.
30+
31+
**Potential benefits**: Maintains test coverage for the refined lint behavior, preventing regressions.
32+
33+
No Mermaid diagrams require updates.
34+
35+
## lint-development Analysis
36+
### Summary of design changes
37+
This PR exemplifies the lint-development workflow by modifying an existing LateLintPass implementation in `clippy_lints/src/multiple_unsafe_ops_per_block.rs` (adding logic to skip inner unsafe blocks and handle macro calls uniquely) and updating lint metadata (description notes) and UI tests. Per `.exp/design-workflow-5-lint-development.md`, this aligns with implementing lint passes and testing but introduces no changes to scaffolding, registration (via `update_lints`), or integration sequences.
38+
39+
The updated lint logic uses existing visitor patterns and compiler APIs without new components or steps.
40+
41+
**Potential benefits**: Provides a model for future lint refinements, especially for handling expansions and nesting.
42+
43+
No Mermaid diagrams require updates.
44+
45+
## Overall Conclusion
46+
The PR primarily impacts lint execution behavior in running Clippy (workflows 1 & 2) and validation processes (4 & 5) through a targeted fix in one lint. No structural changes to workflow designs necessitate updates to `.exp/` documentation or Mermaid diagrams. The change enhances lint precision without altering high-level architectures.
47+
48+
[PR #16117](https://github.com/rust-lang/rust-clippy/pull/16117)

0 commit comments

Comments
 (0)