Skip to content

ICE in type checking - cannot apply unary operator #19602

Closed

Description

@richard-uk1

Hi

Rustc asked me to report this error

<std macros>:8:12: 38:39 error: cannot apply unary operator `!` to type `char`
<std macros>:8         if !$cond {
<std macros>:9             panic!($($arg),+)
<std macros>:10         }
<std macros>:11     );
<std macros>:12 )
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'index out of bounds: the len is 12 but the index is 12', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/lib.rs:1

stack backtrace:
   1:     0x7fb2cf4683e0 - rt::backtrace::imp::write::h50b71c7573aa44d5Bgt
   2:     0x7fb2cf46b460 - failure::on_fail::hc49a9332645beb08cCt
   3:     0x7fb2cfc1fc60 - unwind::begin_unwind_inner::hfe5348fa0e613e77E9c
   4:     0x7fb2cfc1f8e0 - unwind::begin_unwind_fmt::h48b873903726e60f66c
   5:     0x7fb2cfc1f8a0 - rust_begin_unwind
   6:     0x7fb2cfc67140 - panicking::panic_fmt::hbfadc17a8c01315cEbk
   7:     0x7fb2cfc66f90 - panicking::panic_bounds_check::h73ba7baff614d114dak
   8:     0x7fb2ce393f20 - codemap::FileMap::get_line::h192934b979bc5d3ed3E
   9:     0x7fb2ce3c2d50 - diagnostic::emit::h0ba7a9b0a713f542FtG
  10:     0x7fb2ce3bf9a0 - diagnostic::EmitterWriter.Emitter::emit::h01878845221ff36aupG
  11:     0x7fb2ce3be1b0 - diagnostic::Handler::emit::h44371b5cad933b62d7F
  12:     0x7fb2ce3907a0 - diagnostic::SpanHandler::span_err::h87dd4a425f0a4994dVF
  13:     0x7fb2d061dde0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message_str_with_expected::h042559e2867ebbbcGSi
  14:     0x7fb2d054b8a0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message::hd9209b296102c05cSXi
  15:     0x7fb2d057d970 - middle::typeck::check::check_expr_with_unifier::check_user_unop::closure.133616
  16:     0x7fb2d057c3f0 - middle::typeck::check::check_expr_with_unifier::lookup_op_method::hcfc648f6228d30741OZ
  17:     0x7fb2d055d010 - middle::typeck::check::check_expr_with_unifier::check_user_unop::h03d1f1e99cf9de8eb6Z
  18:     0x7fb2d0552260 - middle::typeck::check::check_expr_with_unifier::hf8fe8eef68996629CDZ
  19:     0x7fb2d0552260 - middle::typeck::check::check_expr_with_unifier::hf8fe8eef68996629CDZ
  20:     0x7fb2d05abd60 - middle::typeck::check::check_stmt::h9f595cf8617a1f47zK1
  21:     0x7fb2d0516e80 - middle::typeck::check::check_block_with_expected::h0fea93573b81044aIO1
  22:     0x7fb2d0513910 - middle::typeck::check::check_fn::h1b4757f4032ec37b2fW
  23:     0x7fb2d0513650 - middle::typeck::check::check_bare_fn::h8859bc9921fa87cah5V
  24:     0x7fb2d05199b0 - middle::typeck::check::check_method_body::h254a30cb3173ff69aAW
  25:     0x7fb2d050f760 - middle::typeck::check::check_item::h681bf31078c35e88qpW
  26:     0x7fb2d05130c0 - visit::walk_mod::h8538191843827045767
  27:     0x7fb2d0513410 - middle::typeck::check::check_item_types::haaf57373a94a7fcer4V
  28:     0x7fb2d0009500 - util::common::time::h8626294688042829121
  29:     0x7fb2d0837300 - middle::typeck::check_crate::hfa212ee0e17fb693lrp
  30:     0x7fb2d089f970 - driver::driver::phase_3_run_analysis_passes::h70b3e1b9e7435761M9B
  31:     0x7fb2d089a800 - driver::driver::compile_input::h43620c662d0342b9xQB
  32:     0x7fb2d0922000 - driver::run_compiler::h2eff8561814a6434OGF
  33:     0x7fb2d0921ef0 - driver::run::closure.146242
  34:     0x7fb2d0022da0 - task::TaskBuilder<S>::try_future::closure.104747
  35:     0x7fb2d0022b90 - task::TaskBuilder<S>::spawn_internal::closure.104718
  36:     0x7fb2d117bb00 - task::NativeSpawner.Spawner::spawn::closure.2456
  37:     0x7fb2cfc74bc0 - rust_try_inner
  38:     0x7fb2cfc74bb0 - rust_try
  39:     0x7fb2cfc1d5e0 - unwind::try::he984010f47153659mYc
  40:     0x7fb2cfc1d470 - task::Task::run::had29636eca7af1a3u4b
  41:     0x7fb2d117b840 - task::NativeSpawner.Spawner::spawn::closure.2382
  42:     0x7fb2cfc1ec80 - thread::thread_start::h1833ce4dca7b1a7erpc
  43:     0x7fb2cac5e250 - start_thread
  44:     0x7fb2cf8f93b9 - clone
  45:                0x0 - <unknown>

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Dec 6, 2014
  2. steveklabnik commented on Dec 6, 2014

    @steveklabnik
    Contributor

    Can you show the macro definition?

  3. steveklabnik commented on Dec 6, 2014

    @steveklabnik
    Contributor

    (or the code that caused this)

  4. changed the title [-]Compiler error[/-] [+]ICE in type checking - cannot apply unary operator[/+] on Dec 6, 2014
  5. richard-uk1 commented on Dec 6, 2014

    @richard-uk1
    ContributorAuthor

    the code was something like

    fn main() {
         let re = regex!("match me");
         assert!(re.as_str().char_at(0), '^')
    }
    

    i.e. there was a syntax error

    I'll just try with latest rust.

  6. richard-uk1 commented on Dec 6, 2014

    @richard-uk1
    ContributorAuthor

    In the latest version of rustc this reports a syntax error as expected.

    Closing ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions