Generalize TyCtxt::item_name.

This commit is contained in:
Camille GILLOT
2025-07-03 09:09:26 +00:00
parent 277b0ecf34
commit 36bc0948e0
5 changed files with 14 additions and 10 deletions

View File

@@ -59,7 +59,7 @@ fn equate_intrinsic_type<'tcx>(
/// Returns the unsafety of the given intrinsic.
fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Safety {
let is_in_list = match tcx.item_name(intrinsic_id.into()) {
let is_in_list = match tcx.item_name(intrinsic_id) {
// When adding a new intrinsic to this list,
// it's usually worth updating that intrinsic's documentation
// to note that it's safe to call, since
@@ -144,7 +144,7 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi
tcx.def_span(intrinsic_id),
DiagMessage::from(format!(
"intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `{}`",
tcx.item_name(intrinsic_id.into())
tcx.item_name(intrinsic_id)
)
)).emit();
}