Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement @deprecated #22898

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

kristoff-it
Copy link
Member

Implements #22822

The part I'm most unsure about this implementation relates to how the build system represents -fallow-deprecated and -fno-allow-deprecated internally and how then this is reflected in the CLI invocation of build-exe and related subcommands.

@kristoff-it kristoff-it force-pushed the deprecated-proposal branch 2 times, most recently from a46c2b2 to a9d609a Compare February 17, 2025 16:38
@andrewrk
Copy link
Member

Can't wait to use this immediately, like this:

    if (std.meta.hasMethod(T, "format")) {
        if (fmt.len > 0 and fmt[0] == 'f') {
            return value.format(fmt[1..], options, bw);
        } else {
            @deprecated();
            // After 0.14.0 is tagged, uncomment this next line:
            //@compileError("ambiguous format string; specify {f} to call format method, or {any} to skip it");
            //and then delete the `hasMethod` condition
            return value.format(fmt, options, bw);
        }
    }

@kristoff-it
Copy link
Member Author

@andrewrk rewiew it and it's all yours :^)

@alexrp alexrp added this to the 0.14.0 milestone Feb 24, 2025
@alexrp
Copy link
Member

alexrp commented Feb 24, 2025

Failure looks related:

test
+- test-cases
   +- zig build-obj deprecated Debug native failure
error: 
========= expected: =====================
":1:13: error: found deprecated code",

========= but found: ====================
/Users/runner/work/zig/zig/zig-local-cache/o/0ffd4dc9bed490371ea1bface94a9b5e/tmp.zig:1:13: error: found deprecated code

@kristoff-it kristoff-it force-pushed the deprecated-proposal branch 3 times, most recently from 54bb964 to 9be963b Compare February 24, 2025 09:36
@andrewrk andrewrk self-assigned this Feb 26, 2025
kristoff-it and others added 11 commits February 25, 2025 22:40
mlugg suggested a better way of implementing analysis of an istruction
that cannot be referenced by other instructions.
This implementation looks at the builder of each
module in the build graph instead of storing a
boolean for each module.
Inheriting allow-deprecation from parent modules doesn't make too much
sense, so instead make them default to disallow unless otherwise
specified. This allows build system to avoid redundant
`-fno-allow-deprecated` args.

This makes the generated CLIs smaller, and makes zig1.wasm update not
needed.

Also represented `is_root` differently (moved to field of graph).
"found" -> "reached" to match "reached unreachable code"
@andrewrk andrewrk force-pushed the deprecated-proposal branch from 9be963b to 2d29c85 Compare February 26, 2025 08:01
@andrewrk andrewrk enabled auto-merge February 26, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants