Skip to content

ICE on "lexer accepted unterminated literal with trailing slash" #62913

@dwrensha

Description

@dwrensha

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.

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions