Repository navigation
Print a deprecated item's name only when it is deprecated - #98
Merged
Merged
Conversation
Every use of a value or a type checks the item for a `deprecated` attribute. 38acef3 (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>
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>
jfrolich
force-pushed
the
deprecation-name-on-demand
branch
from
November 11, 2026 17:23
5e8ec11 to
e9c064b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The deprecation check on a value or type use prints the item's path only when the item carries a
deprecatedattribute.Why
Every use of a value and every use of a type constructor asks whether the item is deprecated. 38acef3 (raise the invalid-escape errors where OCaml's readers raise) moved that check into a helper that takes the item's name as a string, and both callers passed
path.name(). So each use allocated and formatted the full dotted path before the attributes were looked at, and dropped it again for nearly every item, since almost none is deprecated.In a single-worker profile of a 3,735-module application this was 27 ms of a 6.1 s clean build (0.45% of CPU), up from 1.7 ms before that commit.
How
deprecated_warning_for_pathlooks for the attribute first and prints the path inside themapthat builds the warning. The constructor callers keepdeprecated_warning_from_attrs, whose name is already a string.Measurements
Clean build of a 3,735-module application, release builds with one codegen unit, one compile worker, alternating runs, retired instructions from
/usr/bin/time -l:The 3,980 generated files are byte-identical. The measured binary also carried two disabled measurement switches for other experiments; they are not part of this change.
Verification
Behaviour is meant to be unchanged, so the check is before against after:
M.N.x,M.N.t, with and without a reason) prints the same seven warnings from both compilers.tests/build_tests/super_errors/fixturesandtests/error_output_parity/compiler/fixturesthat mentiondeprecatedgive identical output and exit codes from both compilers; 15 of them print a deprecation warning.No test was added: the existing fixtures cover the warning text, and the change does not alter it.
Created by this Assistant session