From 8e2836ea45fd097fb6816cb5bf643eebaeafad25 Mon Sep 17 00:00:00 2001 From: wackbyte Date: Sat, 4 May 2024 10:53:58 -0400 Subject: [PATCH] Use diagnostic namespace on stable `#[diagnostic::on_unimplemented]` was stabilized in Rust 1.78.0 :) --- Cargo.toml | 2 +- src/lib.rs | 11 ++++------- src/private.rs | 11 ++++------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ce5cbf43..b578ebd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ std = [ "serde?/std" ] -# Enable nightly-only features like better compiler diagnostics and a Parser impl for ! (the never type). +# Enable nightly-only features like some experimental combinators and a Parser impl for ! (the never type). nightly = [] # Allows deeper recursion by dynamically spilling stack state on to the heap. diff --git a/src/lib.rs b/src/lib.rs index f9711743..2c0e57ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -349,13 +349,10 @@ impl ParseResult { /// /// 4) If you believe you've found a common use-case that's missing from chumsky, you could open a pull request to /// implement it in chumsky itself. -#[cfg_attr( - feature = "nightly", - diagnostic::on_unimplemented( - message = "The following is not a parser from `{I}` to `{O}`: `{Self}`", - label = "This parser is not compatible because it does not implement `Parser<{I}, {O}, E>`", - note = "You should check that the output types of your parsers are consistent with the combinators you're using", - ) +#[diagnostic::on_unimplemented( + message = "The following is not a parser from `{I}` to `{O}`: `{Self}`", + label = "This parser is not compatible because it does not implement `Parser<{I}, {O}, E>`", + note = "You should check that the output types of your parsers are consistent with the combinators you're using" )] pub trait Parser<'a, I: Input<'a>, O, E: ParserExtra<'a, I> = extra::Default>: ParserSealed<'a, I, O, E> diff --git a/src/private.rs b/src/private.rs index 764bc1cf..ebd3f74d 100644 --- a/src/private.rs +++ b/src/private.rs @@ -212,13 +212,10 @@ impl Mode for Check { // TODO: Consider removing these sealed traits in favour of `Sealed`, with the given methods just being on `Parser` // with doc(hidden) -#[cfg_attr( - feature = "nightly", - diagnostic::on_unimplemented( - message = "The following is not a parser from `{I}` to `{O}`: `{Self}`", - label = "This parser is not compatible because it does not implement `Parser<{I}, {O}, E>`", - note = "You should check that the output types of your parsers are consistent with the combinators you're using", - ) +#[diagnostic::on_unimplemented( + message = "The following is not a parser from `{I}` to `{O}`: `{Self}`", + label = "This parser is not compatible because it does not implement `Parser<{I}, {O}, E>`", + note = "You should check that the output types of your parsers are consistent with the combinators you're using" )] pub trait ParserSealed<'a, I: Input<'a>, O, E: ParserExtra<'a, I>> { fn go(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult