Closed waywardmonkeys closed 6 years ago
Try running with RUST_BACKTRACE=1
set so we can see where the panic happens.
Here you are!
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:68
at libstd/sys_common/backtrace.rs:57
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:380
3: std::panicking::default_hook
at libstd/panicking.rs:396
4: std::panicking::begin_panic
at libstd/panicking.rs:576
5: std::panicking::begin_panic
at libstd/panicking.rs:537
6: std::panicking::try::do_call
at libstd/panicking.rs:521
7: std::panicking::try::do_call
at libstd/panicking.rs:497
8: core::ptr::drop_in_place
at libcore/panicking.rs:71
9: core::ptr::drop_in_place
at libcore/panicking.rs:58
10: <alloc::vec::Vec<T> as core::ops::index::Index<usize>>::index
at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1551
11: schemafy::Expander::expand_type_
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:308
12: schemafy::Expander::expand_type
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:291
13: schemafy::FieldExpander::expand_fields::{{closure}}
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:170
14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:271
15: <core::option::Option<T>>::map
at /Users/travis/build/rust-lang/rust/src/libcore/option.rs:404
16: <core::iter::Map<I, F> as core::iter::iterator::Iterator>::next
at /Users/travis/build/rust-lang/rust/src/libcore/iter/mod.rs:1251
17: <alloc::vec::Vec<T>>::extend_desugared
at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1921
18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend
at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1818
19: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1813
20: <alloc::vec::Vec<T> as core::iter::traits::FromIterator<T>>::from_iter
at /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1713
21: core::iter::iterator::Iterator::collect
at /Users/travis/build/rust-lang/rust/src/libcore/iter/iterator.rs:1298
22: schemafy::FieldExpander::expand_fields
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:159
23: schemafy::Expander::expand_schema
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:391
24: schemafy::Expander::expand_definitions
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:366
25: schemafy::Expander::expand
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:464
26: schemafy::format
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:513
27: schemafy::GenerateBuilder::build::{{closure}}
at /Users/bruce/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.4.1/src/lib.rs:520
28: build_script_build::main
at ./build.rs:16
29: std::rt::lang_start::{{closure}}
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
30: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:479
31: panic_unwind::dwarf::eh::read_encoded_pointer
at libpanic_unwind/lib.rs:102
32: std::sys_common::bytestring::debug_fmt_bytestring
at libstd/panicking.rs:458
at libstd/panic.rs:358
at libstd/rt.rs:58
33: std::rt::lang_start
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
34: build_script_build::main
Went through and fixed 2-3 more problems as well as I found them. I don't know exactly what quality you were hoping for but at least it compiles now.
If you find any patterns in the schema that compiles poorly then feel free to open an issue (or even better make a PR!) as long as its not something specific only to this schema I am happy to merge common patterns.
Eventually I'd like to make this more customisable but I haven't had any need/time to update this in a while. I need to refactor quite a bit as well to make it easier to modify...
Thanks! I have found a few things that could be improved in the output, but I will see if I can submit PRs instead of issues. :)
I tried experimentally to create Rust code from the latest Vega Lite JSON schema and it crashed:
The schema file that I used can be found at https://github.com/vega/schema/blob/master/vega-lite/v2.1.2.json