Unsupported!() macro for compile errors when a code path is used

crates.io: Rust Package Registry (my entry to the worst crate name competition ;))

It implements compile-time errors when unsupported code paths are actually taken.

This helps to get rid of runtime panics from using todo!() or unimplemented!().

It also allows a novel programing pattern allowing traits with optional methods that the user only needs to implement when they are actually used.

It is a very small crate, I was honestly surprised such didn't already exist, still I believe it was worthwhile to publish as a crate.

I feel like you either:

  1. Won a million dollars
  2. Embellished your crate's description a bit too much

Given this code fails to compile, I would go with 2.

fn main() {
    if false {
        unsupported::unsupported!()
    }
}

(I think I understand what your crate does but the wording makes it seem like it does more)

agreed, this should need some rewording, i am just lack better ideas here that are not overly complicated "compile error when a code path that contains unsupported!() is instantiated" is a bit wordy and hard to understand either. Help welcome.

looking at how the macro just boils down to const { panic! } you could just say that it causes a compiler error when const { panic! } would cause one.

you could also say "unsupported causes a compiler error if it would be const evaluated" and link to Constant evaluation - The Rust Reference

The important point is that we defer this const-panic until the code becomes monomorphized. Unlike a plain const {panic} which would trigger a compile error instantly.