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

ICE and bad string (un)escaping regression in assert macro #50471

Closed
ollie27 opened this issue May 6, 2018 · 0 comments
Closed

ICE and bad string (un)escaping regression in assert macro #50471

ollie27 opened this issue May 6, 2018 · 0 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Milestone

Comments

@ollie27
Copy link
Member

ollie27 commented May 6, 2018

I tried this code:

assert!({false})
assert!(r"\u{41}" == "A")
assert!(r"\u{".is_empty())

I expected to see this happen:

thread 'main' panicked at 'assertion failed: { false }'
thread 'main' panicked at 'assertion failed: r"\u{41}" == "A"'
thread 'main' panicked at 'assertion failed: r"\u{".is_empty()'

Instead, this happened:

thread 'main' panicked at 'assertion failed: {{ false }}'
thread 'main' panicked at 'assertion failed: r"A" == "A"'
thread 'rustc' panicked at 'lexer should have rejected invalid escape sequences', libcore\option.rs:916:5
stack backtrace:
   0: std::rt::lang_start_internal
   1: std::sys::windows::c::TryAcquireSRWLockShared
   2: std::panicking::take_hook
   3: std::panicking::take_hook
   4: rustc::ty::maps::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::option::expect_failed
  10: syntax_ext::deriving::partial_ord::cs_partial_cmp
  11: syntax_ext::deriving::partial_ord::cs_partial_cmp
  12: syntax::ext::expand::MacroExpander::expand_crate
  13: syntax::ext::expand::MacroExpander::expand_crate
  14: syntax::ext::expand::MacroExpander::expand_crate
  15: rustc_driver::driver::build_output_filenames
  16: rustc_driver::driver::build_output_filenames
  17: rustc_driver::driver::count_nodes
  18: rustc_driver::driver::compile_input
  19: rustc_driver::run_compiler
  20: rustc_driver::target_features::add_configuration
  21: <unknown>
  22: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  23: _rust_maybe_catch_panic
  24: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_trait_item
  25: std::sync::mpsc::blocking::WaitToken::wait_max_until
  26: std::sys::windows::thread::Thread::new
  27: BaseThreadInitThunk
  28: RtlUserThreadStart

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.26.0-beta.18 (1f200ac2c 2018-05-03) running on x86_64-pc-windows-msvc

They all work in 1.25.0 but not in 1.26.0 beta or nightly and I think this is caused by #48813 (cc. @sinkuu).

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels May 6, 2018
@pietroalbini pietroalbini added this to the 1.26 milestone May 6, 2018
bors added a commit that referenced this issue May 6, 2018
Fix ICE in assertion macro

Fixes #50471. Needs beta-backport (stable-to-beta/nightly regression).

* `panic` with single argument does not need escaping `{` and `}`
* Instead of unescaping `\u{...}` manually, just use `escape_debug` in pprust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Projects
None yet
Development

No branches or pull requests

2 participants