diff options
| author | Ayrton <a.munoz3327@gmail.com> | 2020-10-06 09:51:10 -0400 |
|---|---|---|
| committer | Ayrton <a.munoz3327@gmail.com> | 2020-10-27 11:04:04 -0400 |
| commit | 511fe048b4ee2535961014b1be3294a771cc7e87 (patch) | |
| tree | 2fb41c1d16b3a455ab2def35bd3ed9a8fbf504b0 /compiler/rustc_session/src | |
| parent | 3214de735969602ddf2625ca500ff8d3ec57a745 (diff) | |
| download | rust-511fe048b4ee2535961014b1be3294a771cc7e87.tar.gz rust-511fe048b4ee2535961014b1be3294a771cc7e87.zip | |
Changed lint to check for `std::fmt::Pointer` and `transmute`
The lint checks arguments in calls to `transmute` or functions that have `Pointer` as a trait bound and displays a warning if the argument is a function reference. Also checks for `std::fmt::Pointer::fmt` to handle formatting macros although it doesn't depend on the exact expansion of the macro or formatting internals. `std::fmt::Pointer` and `std::fmt::Pointer::fmt` were also added as diagnostic items and symbols.
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/lint/builtin.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/lint/builtin.rs b/compiler/rustc_session/src/lint/builtin.rs index 4cfd3277202..41abdacb54c 100644 --- a/compiler/rustc_session/src/lint/builtin.rs +++ b/compiler/rustc_session/src/lint/builtin.rs @@ -2645,9 +2645,10 @@ declare_lint! { reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>", edition: None, }; +} declare_lint! { - pub FUNCTION_REFERENCES, + pub FUNCTION_ITEM_REFERENCES, Warn, "suggest casting functions to pointers when attempting to take references", } @@ -2767,7 +2768,7 @@ declare_lint_pass! { CONST_EVALUATABLE_UNCHECKED, INEFFECTIVE_UNSTABLE_TRAIT_IMPL, UNINHABITED_STATIC, - FUNCTION_REFERENCES, + FUNCTION_ITEM_REFERENCES, ] } |
