-
-
Notifications
You must be signed in to change notification settings - Fork 77
Failure when running with a valid Cargo.toml that uses dotted key syntax #257
Description
Reproduction steps
Create a workspace manifest Cargo.toml like this:
[workspace]
members = ["my-proc-macro"]
resolver = "2"
[workspace.package]
edition = "2021"
[profile.dev]
package.regex.opt-level = "z"
[profile.dev.package.serde_json]
opt-level = "1"
codegen-units = 1Notice that having both [profile.dev] and [profile.dev.package.serde_json] headers is important, as well as the dotted key syntax under [profile.dev]. This is the core pattern that breaks trybuild.
Create a proc-macro crate under my-proc-macro directory with my-proc-macro/Cargo.toml:
[package]
edition = { workspace = true }
name = "my-proc-macro"
version = "0.1.0"
[lib]
proc-macro = true
[dev-dependencies]
trybuild = "1.0"Setup trybuild as usual in the integration tests
Boilerplate setup (collapsed)
my-proc-macro/tests/main.rs
#[test]
fn trybuild() {
trybuild::TestCases::new().compile_fail("tests/compile_fail/*.rs");
}my-proc-macro/tests/compile_fail/test1.rs
fn main() {
bruh
}Actual
Trybuild panics with the following output:
cargo test --test '*' -p my-proc-macro
Finished test [unoptimized + debuginfo] target(s) in 0.03s
Running tests/main.rs (target/debug/deps/main-350bbdab8af3fc79)
running 1 test
ERROR: Cargo.toml uses edition.workspace=true, but no edition found in workspace's manifest
test trybuild ... FAILED
failures:
---- trybuild stdout ----
thread 'trybuild' panicked at /home/veetaha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/trybuild-1.0.89/src/run.rs:61:13:
tests failed
stack backtrace:
0: 0x55ee4ab9709c - std::backtrace_rs::backtrace::libunwind::trace::ha637c64ce894333a
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x55ee4ab9709c - std::backtrace_rs::backtrace::trace_unsynchronized::h47f62dea28e0c88d
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55ee4ab9709c - std::sys_common::backtrace::_print_fmt::h9eef0abe20ede486
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
3: 0x55ee4ab9709c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed7f999df88cc644
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:44:22
4: 0x55ee4abc4d00 - core::fmt::rt::Argument::fmt::h1539a9308b8d058d
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
5: 0x55ee4abc4d00 - core::fmt::write::h3a39390d8560d9c9
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
6: 0x55ee4ab9385f - std::io::Write::write_fmt::h040b369f3a0f9cbc
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
7: 0x55ee4ab96e84 - std::sys_common::backtrace::_print::h894006fb5c6f3d45
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
8: 0x55ee4ab96e84 - std::sys_common::backtrace::print::h23a2d212c6fff936
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
9: 0x55ee4ab98b47 - std::panicking::default_hook::{{closure}}::h8a1d2ee00185001a
10: 0x55ee4ab98833 - std::panicking::default_hook::h6038f2eba384e475
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:289:9
11: 0x55ee4ab65b57 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0ad024c9bdc6d768
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
12: 0x55ee4ab65b57 - test::test_main::{{closure}}::h7500b54257359db6
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/test/src/lib.rs:138:21
13: 0x55ee4ab991c8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1f8f335eaa9cfaee
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
14: 0x55ee4ab991c8 - std::panicking::rust_panic_with_hook::h2b5517d590cab22e
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:783:13
15: 0x55ee4ab98ee9 - std::panicking::begin_panic_handler::{{closure}}::h233112c06e0ef43e
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:649:13
16: 0x55ee4ab97566 - std::sys_common::backtrace::__rust_end_short_backtrace::h6e893f24d7ebbff8
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
17: 0x55ee4ab98c82 - rust_begin_unwind
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
18: 0x55ee4abc3085 - core::panicking::panic_fmt::hbf0e066aabfa482c
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
19: 0x55ee4aa9d9c4 - trybuild::run::<impl trybuild::Runner>::run::{{closure}}::hd83d3e91013f8a64
at /home/veetaha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/trybuild-1.0.89/src/run.rs:61:13
20: 0x55ee4aa76579 - core::result::Result<T,E>::unwrap_or_else::hdda898d1b93120b9
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1430:23
21: 0x55ee4aa7fadf - trybuild::run::<impl trybuild::Runner>::run::hcbea432d9573d6ae
at /home/veetaha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/trybuild-1.0.89/src/run.rs:53:32
22: 0x55ee4aa85c38 - <trybuild::TestCases as core::ops::drop::Drop>::drop::hd16a24684553c363
at /home/veetaha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/trybuild-1.0.89/src/lib.rs:317:13
23: 0x55ee4a952b37 - core::ptr::drop_in_place<trybuild::TestCases>::h45ce8b3d84ff243a
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
24: 0x55ee4a952803 - main::trybuild::h27a64ead6c3891db
at /home/veetaha/sandbox/rust/crates/my-proc-macro/tests/main.rs:4:71
25: 0x55ee4a952a47 - main::trybuild::{{closure}}::h44ba9f447382c23b
at /home/veetaha/sandbox/rust/crates/my-proc-macro/tests/main.rs:3:14
26: 0x55ee4a952ae6 - core::ops::function::FnOnce::call_once::h80bee375ca993ab6
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
27: 0x55ee4ab6b1af - core::ops::function::FnOnce::call_once::h2b5d431d5046312d
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
28: 0x55ee4ab6b1af - test::__rust_begin_short_backtrace::h7714669af176e207
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/test/src/lib.rs:628:18
29: 0x55ee4ab6a1c5 - test::run_test_in_process::{{closure}}::h85218797dcbcec12
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/test/src/lib.rs:651:60
30: 0x55ee4ab6a1c5 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h76c106ea31c14d7b
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panic/unwind_safe.rs:272:9
31: 0x55ee4ab6a1c5 - std::panicking::try::do_call::h3bd5d0f6620ee946
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
32: 0x55ee4ab6a1c5 - std::panicking::try::h232e535e4744fe31
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
33: 0x55ee4ab6a1c5 - std::panic::catch_unwind::h3ce3bd6ca8dbac68
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
34: 0x55ee4ab6a1c5 - test::run_test_in_process::hc97b257c9621286a
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/test/src/lib.rs:651:27
35: 0x55ee4ab6a1c5 - test::run_test::{{closure}}::h2aa798823a438d38
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/test/src/lib.rs:574:43
36: 0x55ee4ab2fff6 - test::run_test::{{closure}}::h87d231c78fb59832
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/test/src/lib.rs:602:41
37: 0x55ee4ab2fff6 - std::sys_common::backtrace::__rust_begin_short_backtrace::he6df152596625789
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:154:18
38: 0x55ee4ab350a7 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::ha94be15d1e0acf36
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/thread/mod.rs:529:17
39: 0x55ee4ab350a7 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h9dc6bd6372f16606
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panic/unwind_safe.rs:272:9
40: 0x55ee4ab350a7 - std::panicking::try::do_call::h9057517f80303cd4
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
41: 0x55ee4ab350a7 - std::panicking::try::he3a30b11ee45340c
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
42: 0x55ee4ab350a7 - std::panic::catch_unwind::h410458cfd3528b8b
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
43: 0x55ee4ab350a7 - std::thread::Builder::spawn_unchecked_::{{closure}}::h72ac3bdb567b737b
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/thread/mod.rs:528:30
44: 0x55ee4ab350a7 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h38f34da3654a8344
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
45: 0x55ee4ab9edf5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc7eafaff61e32df9
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
46: 0x55ee4ab9edf5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6ba4a5de48dd2304
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
47: 0x55ee4ab9edf5 - std::sys::unix::thread::Thread::new::thread_start::he469335aef763e45
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/thread.rs:108:17
48: 0x7f211f48bac3 - start_thread
at ./nptl/pthread_create.c:442:8
49: 0x7f211f51d850 - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
50: 0x0 - <unknown>
failures:
trybuild
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s
error: test failed, to rerun pass `-p my-proc-macro --test main`
Expected
Trybuild should not fail and tests should pass.
Footnotes
I assume trybuild's basic-toml dependency fails at parsing the file, or rather parses it incorrectly, because there is no parsing error thrown here.
Maybe if I could switch trybuild to use toml crate instead, that would fix this, especially because I already have it in my dependencies. Maybe via a cargo feature flag or smth?