Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic with no productions defined #24

Closed
dagit opened this issue Sep 23, 2015 · 1 comment
Closed

Panic with no productions defined #24

dagit opened this issue Sep 23, 2015 · 1 comment
Labels
Milestone

Comments

@dagit
Copy link
Contributor

dagit commented Sep 23, 2015

If you create a .lalrpop file that contains only the line grammar;, you will get a panic when building your project.

$ cargo build
   Compiling miniprolog v0.1.0 (file:///Users/dagit/local-data/sandbox/rust/miniprolog)
failed to run custom build command for `miniprolog v0.1.0 (file:///Users/dagit/local-data/sandbox/rust/miniprolog)`
Process didn't exit successfully: `/Users/dagit/local-data/sandbox/rust/miniprolog/target/debug/build/miniprolog-50573cc21f0fa1d2/build-script-build` (exit code: 101)
--- stderr
thread '<main>' panicked at 'assertion failed: !other_transitions.is_empty()', /Users/dagit/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/lalrpop-0.6.1/src/lexer/dfa/mod.rs:174
stack backtrace:
   1:        0x104c69255 - sys::backtrace::write::h71ee98355e9ff89fUss
   2:        0x104c727a0 - panicking::on_panic::h3058b136d38637c267w
   3:        0x104c2bb52 - rt::unwind::begin_unwind_inner::h1a353d5ea12e1abeVBw
   4:        0x1042a09bc - rt::unwind::begin_unwind::h5864343035433208673
   5:        0x10436af11 - lexer::dfa::DFABuilder<'nfa>::build::h72d848d8eba64160CJi
   6:        0x104363138 - lexer::dfa::build_dfa::h76649dab246e12c8P2h
   7:        0x104482f29 - normalize::token_check::construct::h8a5ede6247deacc07Tp
   8:        0x104418e22 - normalize::token_check::validate::hb4e530ee2dfc6236MIp
   9:        0x10441731b - normalize::normalize_helper::ha10a27530ab278bcBpo
  10:        0x1042a0b54 - normalize::normalize::h8de0f84f9cda2da8ppo
  11:        0x104280068 - build::parse_and_normalize_grammar::h8860a3dd1118077eoVa
  12:        0x1042774ec - build::process_dir::h489121058815528936
  13:        0x104276b78 - build::process_root::hfd9d6d1192435efeeNa
  14:        0x104268105 - main::h241e4db26acdb9e6faa
  15:        0x104c7200d - __rust_try
  16:        0x104c7372d - rt::lang_start::hd654f015947477d622w
  17:        0x10426881e - main

If the file is completely empty you get a parse error instead of a panic.

@nikomatsakis nikomatsakis added this to the 1.0 milestone Nov 5, 2015
@ahmedcharles
Copy link
Contributor

This now results in:

Error: no public symbols declared in grammar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants