Skip to content

Commit

Permalink
refactor: emite compile error, don't bother with proc-macro-error2
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Sep 13, 2024
1 parent eb1f1fb commit 94f6f04
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
23 changes: 0 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ repository = "https://github.com/hydro-project/matchbox"
proc-macro = true

[dependencies]
proc-macro-error2 = "2.0.0"
proc-macro2 = "1.0.80"
quote = "1.0.37"
syn = { version = "2.0.7", features = ["fold", "full", "extra-traits"] }
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ struct Bind {
struct MyFold {
binds: Vec<Bind>,
counter: u32,
diagnostics: Vec<proc_macro_error2::Diagnostic>,
}
impl MyFold {
fn handle(&mut self, subpat: syn::Pat, typ: Type, span: proc_macro2::Span) -> syn::PatIdent {
Expand Down Expand Up @@ -106,8 +105,8 @@ impl syn::fold::Fold for MyFold {
syn::Pat::Ident(pat_ident)
}
Err(err) => {
self.diagnostics.push(err.into());
syn::parse_quote_spanned!(span=> _error) // Error placeholder pattern.
let compile_error = err.into_compile_error();
syn::parse_quote_spanned!(span=> #compile_error)
}
}
} else {
Expand Down

0 comments on commit 94f6f04

Please sign in to comment.