Stream: wit-bindgen

Topic: How to generate old version of world


view this post on Zulip QuantumSegfault (Apr 17 2026 at 07:01):

I'm sure this has been asked many times over already, but given a WIT world/package at a particular version (e.g. @0.1.4) how can I generate bindings for the older version of the world (exclude elements of the interface with @since newer than requested version).

Like for example

package test:plugin@0.1.4;

interface logging {
    @since(version = 0.1.0)
    @deprecated(version = 0.1.3)
    log: func(msg: string);

    @since(version = 0.1.3)
    enum severity {
        trace,
        debug,
        warning,
        info,
        error,
        fatal-error
    }
    @since(version = 0.1.3)
    log2: func(severity: severity, msg: string);

    @since(version = 0.1.4)
    trace: func(msg: string);
    @since(version = 0.1.4)
    debug: func(msg: string);
    @since(version = 0.1.4)
    warning: func(msg: string);
    @since(version = 0.1.4)
    info: func(msg: string);
    @since(version = 0.1.4)
    error: func(msg: string);
    @since(version = 0.1.4)
    fatal-error: func(msg: string);
}

world plugin {
    import logging;

    export execute: func();
}

I would imagine I'd be able to do something like wit-bindgen rust -w 'test:plugin/plugin@0.1.0' wit/v1/plugin.wit

But I just get Error: unknown package 'test:plugin@0.1.0'

If you can't, then I don't really understand the value of @since except as documentation, if you have grab old versions of the WIT to generated the more minimal world anyway. @unstable makes sense. @deprecated too. It's just @since that seems pointless?

view this post on Zulip Alex Crichton (Apr 17 2026 at 14:19):

To do this you'd need to get a historical copy of the world, the annotations are primarily for humans at this point. Tooling hasn't started using it this way yet


Last updated: May 03 2026 at 22:13 UTC