Skip to content

Commit 85189df

Browse files
committed
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.
1 parent 1408990 commit 85189df

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/src/fmt/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,11 @@ pub trait UpperHex {
920920
/// assert_eq!(&l_ptr[..2], "0x");
921921
/// ```
922922
#[stable(feature = "rust1", since = "1.0.0")]
923+
#[rustc_diagnostic_item = "pointer_trait"]
923924
pub trait Pointer {
924925
/// Formats the value using the given formatter.
925926
#[stable(feature = "rust1", since = "1.0.0")]
927+
#[rustc_diagnostic_item = "pointer_trait_fmt"]
926928
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
927929
}
928930

0 commit comments

Comments
 (0)