#proc-macro #procmacro

nightly macro blocked

A proc-macro that checks if blockers (issues) have been resolved

2 unstable releases

0.1.0 May 29, 2020
0.0.0 May 29, 2020

#641 in Procedural macros

MIT license

182 lines


# Cargo.toml
blocked = "^0.1.1"

Blocked provides the blocked! macro. When compiled it will check whether the referenced issue has been closed and emit a compile warning if it has.

This macro takes an issue pattern and an optional 'reason'.

When the BLOCKED_GITHUB_API_KEY environment variable is found, or a CI env is detected, this macro will attempt to find the status of the referenced issue. If the issue has been closed blocked will emit a warning containing the optional 'reason'.

Because this requires network access, it is recommended this is only run in CI builds so as to not slow down the edit-run-debug cycle.

// An attribute-like procedural macro is on the todo-list

use blocked::blocked;

fn hacky_workaround() {}

fn main() {
    blocked!("1", "This code can be removed when the issue is closed");

    // The reason is optional

Issue patterns

The following issue specifiers are supported (Github only for now)

  • #423 or 423. Repository and organisation are pulled from the upstream or origin remote if they exist.
  • serde#423 or serde/423 Organisation is pulled from upstream or origin remote if they exist.
  • serde-rs/serde#423 or serde-rs/serde/423
  • http(s)://github.com/serde-rs/serde/issues/423


~407K SLoC