@@ -1816,14 +1816,14 @@ pub(crate) enum AmbiguousWidePointerComparisonsAddrSuggestion<'a> {
18161816}
18171817
18181818#[ derive( LintDiagnostic ) ]
1819- pub ( crate ) enum UnpredictableFunctionPointerComparisons < ' a > {
1819+ pub ( crate ) enum UnpredictableFunctionPointerComparisons < ' a , ' tcx > {
18201820 #[ diag( lint_unpredictable_fn_pointer_comparisons) ]
18211821 #[ note( lint_note_duplicated_fn) ]
18221822 #[ note( lint_note_deduplicated_fn) ]
18231823 #[ note( lint_note_visit_fn_addr_eq) ]
18241824 Suggestion {
18251825 #[ subdiagnostic]
1826- sugg : UnpredictableFunctionPointerComparisonsSuggestion < ' a > ,
1826+ sugg : UnpredictableFunctionPointerComparisonsSuggestion < ' a , ' tcx > ,
18271827 } ,
18281828 #[ diag( lint_unpredictable_fn_pointer_comparisons) ]
18291829 #[ note( lint_note_duplicated_fn) ]
@@ -1833,22 +1833,40 @@ pub(crate) enum UnpredictableFunctionPointerComparisons<'a> {
18331833}
18341834
18351835#[ derive( Subdiagnostic ) ]
1836- #[ multipart_suggestion(
1837- lint_fn_addr_eq_suggestion,
1838- style = "verbose" ,
1839- applicability = "maybe-incorrect"
1840- ) ]
1841- pub ( crate ) struct UnpredictableFunctionPointerComparisonsSuggestion < ' a > {
1842- pub ne : & ' a str ,
1843- pub cast_right : String ,
1844- pub deref_left : & ' a str ,
1845- pub deref_right : & ' a str ,
1846- #[ suggestion_part( code = "{ne}std::ptr::fn_addr_eq({deref_left}" ) ]
1847- pub left : Span ,
1848- #[ suggestion_part( code = ", {deref_right}" ) ]
1849- pub middle : Span ,
1850- #[ suggestion_part( code = "{cast_right})" ) ]
1851- pub right : Span ,
1836+ pub ( crate ) enum UnpredictableFunctionPointerComparisonsSuggestion < ' a , ' tcx > {
1837+ #[ multipart_suggestion(
1838+ lint_fn_addr_eq_suggestion,
1839+ style = "verbose" ,
1840+ applicability = "maybe-incorrect"
1841+ ) ]
1842+ FnAddrEq {
1843+ ne : & ' a str ,
1844+ deref_left : & ' a str ,
1845+ deref_right : & ' a str ,
1846+ #[ suggestion_part( code = "{ne}std::ptr::fn_addr_eq({deref_left}" ) ]
1847+ left : Span ,
1848+ #[ suggestion_part( code = ", {deref_right}" ) ]
1849+ middle : Span ,
1850+ #[ suggestion_part( code = ")" ) ]
1851+ right : Span ,
1852+ } ,
1853+ #[ multipart_suggestion(
1854+ lint_fn_addr_eq_suggestion,
1855+ style = "verbose" ,
1856+ applicability = "maybe-incorrect"
1857+ ) ]
1858+ FnAddrEqWithCast {
1859+ ne : & ' a str ,
1860+ deref_left : & ' a str ,
1861+ deref_right : & ' a str ,
1862+ fn_sig : rustc_middle:: ty:: PolyFnSig < ' tcx > ,
1863+ #[ suggestion_part( code = "{ne}std::ptr::fn_addr_eq({deref_left}" ) ]
1864+ left : Span ,
1865+ #[ suggestion_part( code = ", {deref_right}" ) ]
1866+ middle : Span ,
1867+ #[ suggestion_part( code = " as {fn_sig})" ) ]
1868+ right : Span ,
1869+ } ,
18521870}
18531871
18541872pub ( crate ) struct ImproperCTypes < ' a > {
0 commit comments