eupn / macrotest

Test harness for declarative and procedural macros expansion via `cargo-expand`
47 stars 9 forks source link

panic in syn 1 on "(/*ERROR*/)" token #98

Closed ijackson closed 5 months ago

ijackson commented 5 months ago

To reproduce:

rustup toolchain add nightly-2023-09-04
git clone https://gitlab.torproject.org/Diziet/rust-derive-deftly
cd rust-derive-deftly
git  checkout edition-macrotest-broken
RUST_BACKTRACE=1 RUSTFLAGS="--cfg derive_deftly_dprint" TRYBUILD=overwrite MACROTEST=overwrite STDERRTEST=overwrite cargo +nightly-2023-09-04 test --locked --offline --workspace --all-features -- macrotest

Expected behaviour: test failures due to mismatched output, and overwrites of various files (sorry).

Actual behaviour: panic in syn.

Notes: seems to be fixed on macrotest master. I think updating to syn 2 fixes it.

``` test macrotest_expand ... FAILED failures: ---- macrotest_expand stdout ---- Running 16 macro expansion tests thread 'macrotest_expand' panicked at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lit.rs:1020:13: Unrecognized literal: `(/*ERROR*/)` stack backtrace: 0: rust_begin_unwind at /rustc/58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2/library/std/src/panicking.rs:619:5 1: core::panicking::panic_fmt at /rustc/58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2/library/core/src/panicking.rs:72:14 2: syn::lit::value::::new at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lit.rs:1020:13 3: syn::lit::parsing::::parse::{{closure}} at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lit.rs:749:32 4: syn::parse::ParseBuffer::step at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/parse.rs:1027:28 5: syn::lit::parsing::::parse at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lit.rs:747:13 6: ::peek::peek at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/token.rs:171:21 7: syn::token::peek_impl at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/token.rs:162:5 8: ::peek at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/token.rs:173:17 9: syn::parse::ParseBuffer::peek at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/parse.rs:585:9 10: syn::expr::parsing::atom_expr at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/expr.rs:1722:19 11: syn::expr::parsing::trailer_expr at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/expr.rs:1566:20 12: syn::expr::parsing::unary_expr at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/expr.rs:1536:13 13: syn::expr::parsing::expr_early at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/expr.rs:2040:28 14: syn::stmt::parsing::stmt_expr at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/stmt.rs:280:21 15: syn::stmt::parsing::parse_stmt at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/stmt.rs:207:13 16: syn::stmt::parsing::::parse_within at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/stmt.rs:119:25 17: syn::parse::ParseBuffer::call at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/parse.rs:508:9 18: syn::item::parsing::parse_rest_of_fn at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/item.rs:1554:21 19: syn::item::parsing::::parse at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/item.rs:992:21 20: syn::parse::ParseBuffer::parse at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/parse.rs:468:9 21: syn::file::parsing::::parse at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/file.rs:102:36 22: core::ops::function::FnOnce::call_once at /rustc/58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2/library/core/src/ops/function.rs:250:5 23: ::parse2 at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/parse.rs:1212:20 24: syn::parse::Parser::parse_str at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/parse.rs:1177:9 25: syn::parse_str at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lib.rs:918:5 26: syn::parse_file at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lib.rs:981:26 27: macrotest::expand::normalize_expansion at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macrotest-1.0.9/src/expand.rs:393:33 28: macrotest::expand::ExpandedTest::run at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macrotest-1.0.9/src/expand.rs:353:22 29: macrotest::expand::run_tests at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macrotest-1.0.9/src/expand.rs:134:15 30: macrotest::expand::expand_args at /home/rustcargo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macrotest-1.0.9/src/expand.rs:71:5 31: macrotest::macrotest_expand at ./macrotest.rs:17:9 32: macrotest::macrotest_expand::{{closure}} at ./macrotest.rs:15:27 33: core::ops::function::FnOnce::call_once at /rustc/58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2/library/core/src/ops/function.rs:250:5 34: core::ops::function::FnOnce::call_once at /rustc/58e967a9cc3bd39122e8cb728e8cec6e3a4eeef2/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. failures: macrotest_expand test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.77s error: test failed, to rerun pass `-p derive-deftly-tests --test macrotest` ```