r3bl-open-core icon indicating copy to clipboard operation
r3bl-open-core copied to clipboard

[terminal_async] use latest #[diagnostic::on_unimplemented] feature in compiler

Open nazmulidris opened this issue 9 months ago • 0 comments

Try and use diagnostic attributes, which is a brand new compiler feature, to decorate important traits (eg: SharedWriter).

#[test]
fn name() {
    #[diagnostic::on_unimplemented(
        message = "`ImportantTrait<{A}>` is not implemented for `{Self}`",
        label = "My Label",
        note = "Note 1",
        note = "Note 2"
    )]
    trait ImportantTrait<A> {}

    fn use_my_trait(_: impl ImportantTrait<i32>) {}

    fn main() {
        use_my_trait(String::new());
    }
}

nazmulidris avatar May 14 '24 19:05 nazmulidris