diff options
| author | Ayrton <a.munoz3327@gmail.com> | 2020-09-10 22:53:14 -0400 |
|---|---|---|
| committer | Ayrton <a.munoz3327@gmail.com> | 2020-10-27 11:04:04 -0400 |
| commit | 3214de735969602ddf2625ca500ff8d3ec57a745 (patch) | |
| tree | 7c9d4151373a76802c659f980dd0a21169fb5bb9 /compiler/rustc_session/src | |
| parent | 975547d475fcb3a7c6e440be5f8de3bf0497d383 (diff) | |
| download | rust-3214de735969602ddf2625ca500ff8d3ec57a745.tar.gz rust-3214de735969602ddf2625ca500ff8d3ec57a745.zip | |
modified lint to work with MIR
Working with MIR let's us exclude expressions like `&fn_name as &dyn Something` and `(&fn_name)()`. Also added ABI, unsafety and whether a function is variadic in the lint suggestion, included the `&` in the span of the lint and updated the test.
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/lint/builtin.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/lint/builtin.rs b/compiler/rustc_session/src/lint/builtin.rs index ab56a0a5667..4cfd3277202 100644 --- a/compiler/rustc_session/src/lint/builtin.rs +++ b/compiler/rustc_session/src/lint/builtin.rs @@ -2645,6 +2645,11 @@ declare_lint! { reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>", edition: None, }; + +declare_lint! { + pub FUNCTION_REFERENCES, + Warn, + "suggest casting functions to pointers when attempting to take references", } declare_lint! { @@ -2762,6 +2767,7 @@ declare_lint_pass! { CONST_EVALUATABLE_UNCHECKED, INEFFECTIVE_UNSTABLE_TRAIT_IMPL, UNINHABITED_STATIC, + FUNCTION_REFERENCES, ] } |
