@@ -108,7 +108,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
108108 } )
109109 . unwrap_or_default ( ) ;
110110
111- self . tcx . emit_node_span_lint (
111+ self . tcx . emit_diag_node_span_lint (
112112 DEPRECATED_SAFE_2024 ,
113113 self . hir_context ,
114114 span,
@@ -780,7 +780,7 @@ impl UnsafeOpKind {
780780 // FIXME: ideally we would want to trim the def paths, but this is not
781781 // feasible with the current lint emission API (see issue #106126).
782782 match self {
783- CallToUnsafeFunction ( Some ( did) ) => tcx. emit_node_span_lint (
783+ CallToUnsafeFunction ( Some ( did) ) => tcx. emit_diag_node_span_lint (
784784 UNSAFE_OP_IN_UNSAFE_FN ,
785785 hir_id,
786786 span,
@@ -790,7 +790,7 @@ impl UnsafeOpKind {
790790 unsafe_not_inherited_note,
791791 } ,
792792 ) ,
793- CallToUnsafeFunction ( None ) => tcx. emit_node_span_lint (
793+ CallToUnsafeFunction ( None ) => tcx. emit_diag_node_span_lint (
794794 UNSAFE_OP_IN_UNSAFE_FN ,
795795 hir_id,
796796 span,
@@ -799,7 +799,7 @@ impl UnsafeOpKind {
799799 unsafe_not_inherited_note,
800800 } ,
801801 ) ,
802- UseOfInlineAssembly => tcx. emit_node_span_lint (
802+ UseOfInlineAssembly => tcx. emit_diag_node_span_lint (
803803 UNSAFE_OP_IN_UNSAFE_FN ,
804804 hir_id,
805805 span,
@@ -808,7 +808,7 @@ impl UnsafeOpKind {
808808 unsafe_not_inherited_note,
809809 } ,
810810 ) ,
811- InitializingTypeWith => tcx. emit_node_span_lint (
811+ InitializingTypeWith => tcx. emit_diag_node_span_lint (
812812 UNSAFE_OP_IN_UNSAFE_FN ,
813813 hir_id,
814814 span,
@@ -817,7 +817,7 @@ impl UnsafeOpKind {
817817 unsafe_not_inherited_note,
818818 } ,
819819 ) ,
820- InitializingTypeWithUnsafeField => tcx. emit_node_span_lint (
820+ InitializingTypeWithUnsafeField => tcx. emit_diag_node_span_lint (
821821 UNSAFE_OP_IN_UNSAFE_FN ,
822822 hir_id,
823823 span,
@@ -826,7 +826,7 @@ impl UnsafeOpKind {
826826 unsafe_not_inherited_note,
827827 } ,
828828 ) ,
829- UseOfMutableStatic => tcx. emit_node_span_lint (
829+ UseOfMutableStatic => tcx. emit_diag_node_span_lint (
830830 UNSAFE_OP_IN_UNSAFE_FN ,
831831 hir_id,
832832 span,
@@ -835,7 +835,7 @@ impl UnsafeOpKind {
835835 unsafe_not_inherited_note,
836836 } ,
837837 ) ,
838- UseOfExternStatic => tcx. emit_node_span_lint (
838+ UseOfExternStatic => tcx. emit_diag_node_span_lint (
839839 UNSAFE_OP_IN_UNSAFE_FN ,
840840 hir_id,
841841 span,
@@ -844,7 +844,7 @@ impl UnsafeOpKind {
844844 unsafe_not_inherited_note,
845845 } ,
846846 ) ,
847- UseOfUnsafeField => tcx. emit_node_span_lint (
847+ UseOfUnsafeField => tcx. emit_diag_node_span_lint (
848848 UNSAFE_OP_IN_UNSAFE_FN ,
849849 hir_id,
850850 span,
@@ -853,7 +853,7 @@ impl UnsafeOpKind {
853853 unsafe_not_inherited_note,
854854 } ,
855855 ) ,
856- DerefOfRawPointer => tcx. emit_node_span_lint (
856+ DerefOfRawPointer => tcx. emit_diag_node_span_lint (
857857 UNSAFE_OP_IN_UNSAFE_FN ,
858858 hir_id,
859859 span,
@@ -862,7 +862,7 @@ impl UnsafeOpKind {
862862 unsafe_not_inherited_note,
863863 } ,
864864 ) ,
865- AccessToUnionField => tcx. emit_node_span_lint (
865+ AccessToUnionField => tcx. emit_diag_node_span_lint (
866866 UNSAFE_OP_IN_UNSAFE_FN ,
867867 hir_id,
868868 span,
@@ -871,7 +871,7 @@ impl UnsafeOpKind {
871871 unsafe_not_inherited_note,
872872 } ,
873873 ) ,
874- MutationOfLayoutConstrainedField => tcx. emit_node_span_lint (
874+ MutationOfLayoutConstrainedField => tcx. emit_diag_node_span_lint (
875875 UNSAFE_OP_IN_UNSAFE_FN ,
876876 hir_id,
877877 span,
@@ -880,7 +880,7 @@ impl UnsafeOpKind {
880880 unsafe_not_inherited_note,
881881 } ,
882882 ) ,
883- BorrowOfLayoutConstrainedField => tcx. emit_node_span_lint (
883+ BorrowOfLayoutConstrainedField => tcx. emit_diag_node_span_lint (
884884 UNSAFE_OP_IN_UNSAFE_FN ,
885885 hir_id,
886886 span,
@@ -889,29 +889,30 @@ impl UnsafeOpKind {
889889 unsafe_not_inherited_note,
890890 } ,
891891 ) ,
892- CallToFunctionWith { function, missing, build_enabled } => tcx. emit_node_span_lint (
893- UNSAFE_OP_IN_UNSAFE_FN ,
894- hir_id,
895- span,
896- UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
892+ CallToFunctionWith { function, missing, build_enabled } => tcx
893+ . emit_diag_node_span_lint (
894+ UNSAFE_OP_IN_UNSAFE_FN ,
895+ hir_id,
897896 span,
898- function : with_no_trimmed_paths ! ( tcx. def_path_str( * function) ) ,
899- missing_target_features : DiagArgValue :: StrListSepByAnd (
900- missing. iter ( ) . map ( |feature| Cow :: from ( feature. to_string ( ) ) ) . collect ( ) ,
901- ) ,
902- missing_target_features_count : missing. len ( ) ,
903- note : !build_enabled. is_empty ( ) ,
904- build_target_features : DiagArgValue :: StrListSepByAnd (
905- build_enabled
906- . iter ( )
907- . map ( |feature| Cow :: from ( feature. to_string ( ) ) )
908- . collect ( ) ,
909- ) ,
910- build_target_features_count : build_enabled. len ( ) ,
911- unsafe_not_inherited_note,
912- } ,
913- ) ,
914- UnsafeBinderCast => tcx. emit_node_span_lint (
897+ UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
898+ span,
899+ function : with_no_trimmed_paths ! ( tcx. def_path_str( * function) ) ,
900+ missing_target_features : DiagArgValue :: StrListSepByAnd (
901+ missing. iter ( ) . map ( |feature| Cow :: from ( feature. to_string ( ) ) ) . collect ( ) ,
902+ ) ,
903+ missing_target_features_count : missing. len ( ) ,
904+ note : !build_enabled. is_empty ( ) ,
905+ build_target_features : DiagArgValue :: StrListSepByAnd (
906+ build_enabled
907+ . iter ( )
908+ . map ( |feature| Cow :: from ( feature. to_string ( ) ) )
909+ . collect ( ) ,
910+ ) ,
911+ build_target_features_count : build_enabled. len ( ) ,
912+ unsafe_not_inherited_note,
913+ } ,
914+ ) ,
915+ UnsafeBinderCast => tcx. emit_diag_node_span_lint (
915916 UNSAFE_OP_IN_UNSAFE_FN ,
916917 hir_id,
917918 span,
@@ -1200,7 +1201,7 @@ pub(crate) fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
12001201 warnings. sort_by_key ( |w| w. block_span ) ;
12011202 for UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe } in warnings {
12021203 let block_span = tcx. sess . source_map ( ) . guess_head_span ( block_span) ;
1203- tcx. emit_node_span_lint (
1204+ tcx. emit_diag_node_span_lint (
12041205 UNUSED_UNSAFE ,
12051206 hir_id,
12061207 block_span,
0 commit comments