rust-lang/rust

ICE on "lexer accepted unterminated literal with trailing slash"

dwrensha opened this issue · 0 comments

I'm getting an internal compiler on the following input (found by fuzz-rustc):

"\u\\"
error: incorrect unicode escape sequence
 --> main.rs:1:2
  |
1 | "\u\\"
  |  ^^^ incorrect unicode escape sequence
  |
  = help: format of unicode escape sequences is `\u{...}`

thread 'rustc' panicked at 'lexer accepted unterminated literal with trailing slash', src/libsyntax/parse/unescape_error_reporting.rs:194:13
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: rustc::util::common::panic_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: syntax::parse::unescape_error_reporting::emit_unescape_error
   6: syntax::parse::unescape::unescape_str
   7: syntax::parse::lexer::StringReader::try_next_token
   8: syntax::parse::lexer::StringReader::next_token
   9: syntax::parse::lexer::tokentrees::TokenTreesReader::parse_all_token_trees
  10: syntax::parse::lexer::tokentrees::<impl syntax::parse::lexer::StringReader>::into_token_trees
  11: syntax::parse::maybe_file_to_stream
  12: syntax::parse::maybe_source_file_to_parser
  13: syntax::parse::source_file_to_parser
  14: syntax::parse::parse_crate_from_file
  15: rustc_interface::passes::parse::{{closure}}
  16: rustc::util::common::time
  17: rustc_interface::passes::parse
  18: rustc_interface::queries::Query<T>::compute
  19: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::parse
  20: rustc_interface::interface::run_compiler_in_existing_thread_pool
  21: std::thread::local::LocalKey<T>::with
  22: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack
error: aborting due to previous error


error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.38.0-nightly (e649e9034 2019-07-22) running on x86_64-apple-darwin

I'm seeing the error on nightly, beta, and stable.