From e66a4f6218c75092b6aaccdf5d46ecf5c724ec94 Mon Sep 17 00:00:00 2001
From: "open-session-submodule[bot]"
<341020755+open-session-submodule[bot]@users.noreply.github.com>
Date: Wed, 11 Nov 2026 17:37:21 +0100
Subject: [PATCH 1/2] Print a deprecated item's name only when it is deprecated
Every use of a value or a type checks the item for a `deprecated`
attribute. 38acef3a62 (raise invalid-escape errors where OCaml's readers
raise) folded that check into one helper that takes the item's name, so
both callers printed the path to a fresh string before looking at the
attributes. Almost no item is deprecated, and the string was dropped.
The path is now printed only once a `deprecated` attribute was found.
The warning and the invalid-escape error are unchanged.
Session: https://jakes-mac-mini.tail23a77e.ts.net:8443/session/os-01a1c9fa-0c5d-7912-a93b-3e7f38e53547
Signed-off-by: open-session-submodule[bot] <341020755+open-session-submodule[bot]@users.noreply.github.com>
---
compiler-rust/src/types/typecore.rs | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/compiler-rust/src/types/typecore.rs b/compiler-rust/src/types/typecore.rs
index a183e2ccdd..c8a4d71eae 100644
--- a/compiler-rust/src/types/typecore.rs
+++ b/compiler-rust/src/types/typecore.rs
@@ -7667,6 +7667,20 @@ fn deprecated_warning_from_attrs(
.map(|(reason, can_be_automigrated)| deprecated_warning(name, reason, can_be_automigrated)))
}
+/// `deprecated_warning_from_attrs` for an item named by its path. The name is
+/// printed only for a deprecated item: this runs on every use of a value or
+/// type, and almost none of them is deprecated.
+fn deprecated_warning_for_path(
+ path: &Path,
+ attrs: &[crate::types::decl::Attribute],
+) -> Result