Closed sherodtaylor closed 4 months ago
I'm kind of stuck debugging the macro
simple output RUSTFLAGS="-Zproc-macro-backtrace" cargo test
Compiling html-macro-test v0.1.0 (/Users/staylor279/code/percy/crates/html-macro-test)
warning: `percy-dom` (lib) generated 1 warning
thread '<unnamed>' panicked at library/proc_macro/src/bridge/symbol.rs:52:29:
`"hx-trigger"` is not a valid identifier
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: proc macro panicked
--> crates/html-macro-test/src/tests/all_tests.rs:35:20
|
35 | generated: html! { <a hx-trigger="click"></a> },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: `"hx-trigger"` is not a valid identifier
Output with backtrace RUST_BACKTRACE=full RUSTFLAGS="-Zproc-macro-backtrace" cargo test
warning: `percy-dom` (lib) generated 1 warning
Compiling html-macro-test v0.1.0 (/Users/staylor279/code/percy/crates/html-macro-test)
thread '<unnamed>' panicked at library/proc_macro/src/bridge/symbol.rs:52:29:
`"hx-trigger"` is not a valid identifier
stack backtrace:
0: 0x107565080 - std::backtrace_rs::backtrace::libunwind::trace::h7e181c7a01a98ba9
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
1: 0x107565080 - std::backtrace_rs::backtrace::trace_unsynchronized::h5d1f48c6edc00030
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x107565080 - std::sys_common::backtrace::_print_fmt::h9f3c4567c93cd78e
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/sys_common/backtrace.rs:68:5
3: 0x107565080 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4e8451aa4ebfb5ff
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/sys_common/backtrace.rs:44:22
4: 0x10757a81c - core::fmt::rt::Argument::fmt::h5e5019a892b695bd
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/core/src/fmt/rt.rs:165:63
5: 0x10757a81c - core::fmt::write::hf3884bd029f6cc35
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/core/src/fmt/mod.rs:1169:21
6: 0x1075634a8 - std::io::Write::write_fmt::hed661a84cebe2dd6
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/io/mod.rs:1835:15
7: 0x107564ed8 - std::sys_common::backtrace::_print::h94d3b0f42a22c797
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/sys_common/backtrace.rs:47:5
8: 0x107564ed8 - std::sys_common::backtrace::print::hbc3a91e400ee844d
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/sys_common/backtrace.rs:34:9
9: 0x107566344 - std::panicking::default_hook::{{closure}}::h9004021f8ce24a60
10: 0x107566038 - std::panicking::default_hook::h0b8973d6357e258c
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/panicking.rs:298:9
11: 0x107566c28 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha26f26fdcc1a8e51
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/alloc/src/boxed.rs:2077:9
12: 0x107566c28 - std::panicking::rust_panic_with_hook::h9d0b6287353b54cc
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/panicking.rs:799:13
13: 0x10756662c - std::panicking::begin_panic_handler::{{closure}}::h340df470dcd2c831
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/panicking.rs:664:13
14: 0x107565504 - std::sys_common::backtrace::__rust_end_short_backtrace::h3f752db9a2187ac2
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/sys_common/backtrace.rs:171:18
15: 0x10756639c - rust_begin_unwind
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/std/src/panicking.rs:652:5
16: 0x107582a84 - core::panicking::panic_fmt::h61cb4c084dcf0edf
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/core/src/panicking.rs:72:14
17: 0x10754753c - proc_macro::bridge::symbol::Symbol::new_ident::{{closure}}::h382bd6685f2962cb
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/proc_macro/src/bridge/symbol.rs:52:29
18: 0x10754753c - core::result::Result<T,E>::unwrap_or_else::h23d9065fadf788fa
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/core/src/result.rs:1435:23
19: 0x10754753c - proc_macro::bridge::symbol::Symbol::new_ident::h64348c27ad4aeaf9
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/proc_macro/src/bridge/symbol.rs:52:10
20: 0x107549a94 - proc_macro::Ident::new::h9d524309f43d1a1e
at /rustc/791adf759cc065316f054961875052d5bc03e16c/library/proc_macro/src/lib.rs:1091:18
21: 0x107533f34 - proc_macro2::imp::Ident::new_checked::h191ea521e506cb1e
22: 0x107539618 - proc_macro2::Ident::new::hf5ce127e01445872
23: 0x10743f140 - html_macro::tag::parse_ident_or_keyword::habdd721817b2fe60
You can try adding a test case to this list. That should help with being able to more easily figure out what's going on https://github.com/chinedufn/percy/blob/1d26d9c1469279b99385d49c334a119a1fa8932f/crates/html-macro/src/tag.rs#L325-L362
Let me know if I can help. I haven't looked at your diff yet.
Also, please update the PR body with an example of what this PR makes possible.
Something like:
For example, the following is now possible:
html! {
<div aria-disabled="true"></div>
}
Please also update your PR body to start with "This commit ...".
As in, a brief explanation of what this PR does.
Closing in favor of https://github.com/chinedufn/percy/pull/199
My attempt at issue https://github.com/chinedufn/percy/issues/105