Bug 23965 – [REG2.101.0] Appending deprecated structs in deprecated function causes deprecation message

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-06-04T18:44:23Z
Last change time
2023-07-02T13:41:41Z
Keywords
pull, rejects-valid
Assigned to
Teodor Dutu
Creator
Vladimir Panteleev

Comments

Comment #0 by dlang-bugzilla — 2023-06-04T18:44:23Z
Generally, deprecated code can use other deprecated code without additional messages. This allows to bulk-deprecate interdependent code in a library, making it possible to allow the library to compile with no deprecation messages, but only causing them if something (non-deprecated) accesses the deprecated declarations. However, the following case has regressed in 2.101: //// test.d /// deprecated: struct S {} void fun() { S[] arr; arr ~= S(); } /////////////// Before it compiled with no errors or messages. Now, with -de, it fails with: /path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/appending.d(#): Deprecation: struct `test.S` is deprecated test.d(8): instantiated from here: `_d_arrayappendcTXImpl!(S[], S)` /path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/utils.d(#): Deprecation: struct `test.S` is deprecated /path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/appending.d(#): instantiated from here: `_d_HookTraceImpl!(S[], _d_arrayappendcTX, "Cannot append to array if compiling without support for runtime type information!")` test.d(8): instantiated from here: `_d_arrayappendcTXImpl!(S[], S)` Introduced in https://github.com/dlang/dmd/pull/13495.
Comment #1 by dlang-bot — 2023-06-13T06:50:38Z
@teodutu updated dlang/dmd pull request #15315 "Fix Issue 23959 - Propagate deprecation to `_d_arrayappendcTXImpl` if the calling scope is deprecated" fixing this issue: - Fix Issue 23965 - Propagate deprecation to `_d_arrayappendcTXImpl` if the calling scope is deprecated This is needed if the lowered expression (`arr ~= elem`) is made within a deprecated context to avoid spurious deprecation messages about the hook being emitted. Signed-off-by: Teodor Dutu <[email protected]> https://github.com/dlang/dmd/pull/15315
Comment #2 by dlang-bot — 2023-06-19T09:57:27Z
dlang/dmd pull request #15315 "Fix Issue 23965 - Disable deprecation checks for DRuntime hooks" was merged into stable: - 5a722cd8dd92523470fc9a03aaf03c6e9fd49e44 by Teodor Dutu: Fix Issue 23965 - Disable deprecation checks for DRuntime hooks Lowerings to runtime hooks can be made from deprecated contexts, which results in incorrect deprecation messages of the deprecated context calling an undeprecated hook. Since hooks aren't going to be deprecated, this check may be disabled. Signed-off-by: Teodor Dutu <[email protected]> https://github.com/dlang/dmd/pull/15315
Comment #3 by dlang-bot — 2023-07-02T13:41:41Z
dlang/dmd pull request #15373 "merge stable" was merged into master: - b358cebfa64f3bab300f549883dc703a2f55d6a4 by Teodor Dutu: Fix Issue 23965 - Disable deprecation checks for DRuntime hooks (#15315) Lowerings to runtime hooks can be made from deprecated contexts, which results in incorrect deprecation messages of the deprecated context calling an undeprecated hook. Since hooks aren't going to be deprecated, this check may be disabled. Signed-off-by: Teodor Dutu <[email protected]> https://github.com/dlang/dmd/pull/15373