Skip to content

Commit d675115

Browse files
committed
rename the lint
1 parent 09a9b9a commit d675115

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

text/0000-todo-overreach.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## Summary
77
[summary]: #summary
88

9-
The `todo!()` macro is meant as a placeholder, often used to make type check pass while still writing the code. However, since it diverges, all code that comes after it is marked as unreachable. The author proposes changing that to reduce the `unreachable_code` churn, while adding a `todo_macro_uses` lint that can be deactivated while the code is still work in progress and activated before pushing to production.
9+
The `todo!()` macro is meant as a placeholder, often used to make type check pass while still writing the code. However, since it diverges, all code that comes after it is marked as unreachable. The author proposes changing that to reduce the `unreachable_code` churn, while adding a `todo_macro_calls` lint that can be deactivated while the code is still work in progress and activated before pushing to production.
1010

1111
## Motivation
1212
[motivation]: #motivation
@@ -50,7 +50,7 @@ fn test_external(x: Result<String, std::io::Error>) {
5050
## Reference-level explanation
5151
[reference-level-explanation]: #reference-level-explanation
5252

53-
To implement this, in the `rustc_hir_typeck` crate, there is one check for diverging code. There, we insert a check for a local `todo!()` macro call, and when that check returns `true`, we modify the result to "warned already" so that the code is marked as diverging (and e.g. the rest of type checking works as before), but the `unreachable_code` lint will no longer warn. To compensate for that, we emit the newly added `todo_macro_uses` lint for the expression.
53+
To implement this, in the `rustc_hir_typeck` crate, there is one check for diverging code. There, we insert a check for a local `todo!()` macro call, and when that check returns `true`, we modify the result to "warned already" so that the code is marked as diverging (and e.g. the rest of type checking works as before), but the `unreachable_code` lint will no longer warn. To compensate for that, we emit the newly added `todo_macro_calls` lint for the expression.
5454

5555
A proof of concept implementation is in [#149543](https://github.com/rust-lang/rust/pull/149543).
5656

@@ -66,16 +66,16 @@ A proof of concept implementation is in [#149543](https://github.com/rust-lang/r
6666
[rationale-and-alternatives]: #rationale-and-alternatives
6767

6868
- We could do nothing. This leaves the users with the problem stated above.
69-
- We could make `unreachable_code` ignore `todo!()` without adding a `todo_macros_uses` lint. However, people would need to run clippy (or use a search or other such IDE feature) to get rid of their `todo!()` calls. This is deemed suboptimal from a user experience standpoint.
70-
- We could only add a `todo_macros_uses` lint without omitting the `todo!()` macro from `unreachable_code` warnings. That would allow people to allow the `unreachable_code` lint while fixing up all `todo!()`s and only then fix the other unreachable code. However, again, the user might forget reactivating the `unreachable_code` lint, potentially leaving their code in a subpar state
71-
- We could make `allow(unreachable_code)` also suppress `todo_macro_uses`. However, this doesn't seem like a logical parent group.
69+
- We could make `unreachable_code` ignore `todo!()` without adding a `todo_macro_calls` lint. However, people would need to run clippy (or use a search or other such IDE feature) to get rid of their `todo!()` calls. This is deemed suboptimal from a user experience standpoint.
70+
- We could only add a `todo_macro_calls` lint without omitting the `todo!()` macro from `unreachable_code` warnings. That would allow people to allow the `unreachable_code` lint while fixing up all `todo!()`s and only then fix the other unreachable code. However, again, the user might forget reactivating the `unreachable_code` lint, potentially leaving their code in a subpar state
71+
- We could make `allow(unreachable_code)` also suppress `todo_macro_calls`. However, this doesn't seem like a logical parent group.
7272

7373
Please note that this is a language proposal only insofar as that a lint (which is technically part of the language) is changed in accordance with a standard library item. It is not possible to do this without compiler support. There may be a way to implement this so that users could write their own `placeholder!()` macros that do not trip up the `unreachable_code` lint, although at this point the author sees no value in that.
7474

7575
## Prior art
7676
[prior-art]: #prior-art
7777

78-
In clippy, there is a `todo` lint that would be deprecated as soon as `todo_macro_uses` is available on stable. Also in clippy, we have done a lot of work to reduce low-benefit lint warnings churn over the last years, so this is merely an extension of that work to the compiler.
78+
In clippy, there is a `todo` lint that would be deprecated as soon as `todo_macro_calls` is available on stable. Also in clippy, we have done a lot of work to reduce low-benefit lint warnings churn over the last years, so this is merely an extension of that work to the compiler.
7979

8080
## Unresolved questions
8181
[unresolved-questions]: #unresolved-questions
@@ -85,4 +85,4 @@ none
8585
## Future possibilities
8686
[future-possibilities]: #future-possibilities
8787

88-
There could be a shortcut to disable the `todo_macros_used` lint while working on the code, or e.g. in a rust-analyzer configuration. Also we can document how to deactivate the `todo_macro_uses` lint on `Debug` builds, avoiding lint message churn during development while making sure no `todo!()` call makes it into a release build.
88+
There could be a shortcut to disable the `todo_macro_calls` lint while working on the code, or e.g. in a rust-analyzer configuration. Also we can document how to deactivate the `todo_macro_calls` lint on `Debug` builds, avoiding lint message churn during development while making sure no `todo!()` call makes it into a release build.

0 commit comments

Comments
 (0)