Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use diagnostic namespace on stable #632

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 4 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,10 @@ impl<T, E> ParseResult<T, E> {
///
/// 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>
Expand Down
11 changes: 4 additions & 7 deletions src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O>
Expand Down
Loading