Weird error output when combining `syn::Error` in expression context
- Dominant language
- Rust
- Stars
- 3.4k
- Forks
- 374
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 2
Description
Test repo: https://github.com/danielparks/test-syn-error-combine
In a proc macro in expression position, using `syn::Error::combine()` on generates weird error output (see below, or see the test repo for slightly more comprehensive examples). This does not happen if `combine()` is not used (actually, I’m calling `extend()`, but I ran into the same problem with an explicit `combine()`), or if the macro is called as a statement.
I’m not sure if this is a bug in `syn`, some other code, or if I am making an obvious mistake. I’m happy to dig into this more, but pointers would be appreciated.
error: missing angle brackets in associated item path
--> tests/output.rs:15:19
|
15 | let _ = fail!("a" "b");
| ^^^
|
help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths
|
15 | let _ = fail!(<"a"> "b");
| + +
error: macro expansion ignores `!` and any tokens following
--> tests/output.rs:15:23
|
15 | let _ = fail!("a" "b");
| ----------^^^- caused by the macro expansion here
|
= note: the usage of `fail!` is likely invalid in expression context
error: ERROR "a"
--> tests/output.rs:15:19
|
15 | let _ = fail!("a" "b");
| ^^^
error[E0223]: ambiguous associated type
--> tests/output.rs:15:19
|
15 | let _ = fail!("a" "b");
| ^^^^^^^
|
help: if there were a trait named `Example` with associated type `core` implemented for `()`, you could use the fully-qualified path
|
15 - let _ = fail!("a" "b");
15 + let _ = fail!(<() as Example>::"b");
|
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.