shepmaster / fuzzy-pickles

A Rust parser to power Strata Rust
Apache License 2.0
7 stars 2 forks source link

'points are backwards' panic when prefix operator has no target #90

Closed dwrensha closed 7 years ago

dwrensha commented 7 years ago
    #[test]
    fn bug() {
        let _ = parse_rust_file("fn main ()  {  (a)* *");
    }
$ RUST_BACKTRACE=1 cargo test bug
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/fuzzy_pickles-60e92bd1d9636d2b

running 1 test
test test::bug ... FAILED

failures:

---- test::bug stdout ----
    thread 'test::bug' panicked at 'points are backwards', src/lib.rs:171:33
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:60
             at src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:391
   4: std::panicking::begin_panic
             at src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /Users/travis/build/rust-lang/rust/src/libstd/panicking.rs:538
   6: fuzzy_pickles::State::ex
             at src/lib.rs:171
   7: fuzzy_pickles::expression::ShuntingYard::apply_prefix
             at src/expression.rs:762
   8: fuzzy_pickles::expression::ShuntingYard::apply_one
             at src/expression.rs:571
   9: fuzzy_pickles::expression::ShuntingYard::apply_all
             at src/expression.rs:556
  10: fuzzy_pickles::expression::ShuntingYard::finish
             at src/expression.rs:537
  11: fuzzy_pickles::expression::expression_shunting_yard
             at src/expression.rs:106
  12: fuzzy_pickles::expression::statement_expression
             at src/expression.rs:26
  13: core::ops::function::FnOnce::call_once
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:223
  14: peresil::combinators::map::{{closure}}
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/combinators.rs:143
  15: <peresil::Alternate<'pm, P, T, E, S>>::run_one
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/lib.rs:383
  16: <peresil::Alternate<'pm, P, T, E, S>>::one
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/lib.rs:403
  17: fuzzy_pickles::statement
             at src/lib.rs:3316
  18: core::ops::function::Fn::call
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:73
  19: core::ops::function::impls::<impl core::ops::function::Fn<A> for &'a F>::call
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:232
  20: fuzzy_pickles::parse_tailed
             at src/lib.rs:2500
  21: fuzzy_pickles::zero_or_more_implicitly_tailed_append::{{closure}}
             at src/lib.rs:2635
  22: peresil::combinators::map::{{closure}}
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/combinators.rs:143
  23: fuzzy_pickles::block
             at src/lib.rs:3294
  24: fuzzy_pickles::function
             at src/lib.rs:2996
  25: core::ops::function::FnOnce::call_once
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:223
  26: peresil::combinators::map::{{closure}}
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/combinators.rs:143
  27: <peresil::Alternate<'pm, P, T, E, S>>::run_one
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/lib.rs:383
  28: <peresil::Alternate<'pm, P, T, E, S>>::one
             at /Users/dwrensha/.cargo/git/checkouts/peresil-7403d1c1394b7448/64e6caf/src/lib.rs:406
  29: fuzzy_pickles::item
             at src/lib.rs:2757
  30: core::ops::function::Fn::call
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:73
  31: fuzzy_pickles::attributed::{{closure}}
             at src/lib.rs:4677
  32: fuzzy_pickles::parse_rust_file
             at src/lib.rs:394
  33: fuzzy_pickles::test::bug
             at src/lib.rs:6302
  34: <F as test::FnBox<T>>::call_box
             at src/libtest/lib.rs:1480
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:223
             at src/libtest/lib.rs:141
  35: panic_unwind::dwarf::eh::read_encoded_pointer
             at src/libpanic_unwind/lib.rs:99

failures:
    test::bug
shepmaster commented 7 years ago

The next panic / unimplemented / unreachable I put in is going to say "hello dwrensha" in it, I swear.

shepmaster commented 7 years ago

Thank you!