Skip to content

only string and byte strings supported in compare_values #26989

Closed
@simonsimon006

Description

@simonsimon006

When I try to compile my code, the compiler fails with "only string and byte strings supported in compare_values";.
My code:

struct Foo {
    x: Option<i32>,
    y: Option<i32>
}
fn main() {
    let mut test = Foo {x: Option::None, y: Option::Some(32)};
    match test {
        Foo {x: Some(12), y: a @ _} => println!("{:?}", a),
        Foo {y: Option::Some(ref mut a), x: Option::None} => {
            //println!("{:?}", a);
            *a=11000;
        },
        Foo {y: Option::Some(32), ..} => println!("all"),
        _ => println!("other")
    }
    println!("{:?}", test.y);
}

I am learning the language, so I don't know if this really is a bug.

Here the backtrace:

stack backtrace:
   1:     0x7f332c7e62d9 - sys::backtrace::write::h534114ba1b06b93294r
   2:     0x7f332c7ee1f9 - panicking::on_panic::h4e97afe0febd2c7biJw
   3:     0x7f332c7aeff2 - rt::unwind::begin_unwind_inner::hfe7dd1cef83ccc0fsow
   4:     0x7f3329b93a2d - rt::unwind::begin_unwind::h11509303451443813476
   5:     0x7f3329b940eb - diagnostic::Handler::bug::h238bf6cb3345eafa4aC
   6:     0x7f332a77917b - session::Session::bug::h3b46b49c0728a5bdior
   7:     0x7f332b6ac537 - trans::_match::compile_submatch_continue::h950de3ef5f507e64T0H
   8:     0x7f332b6a7c16 - trans::_match::compile_submatch::ha5fc5204dd2d2befZUH
   9:     0x7f332b6aba24 - trans::_match::compile_submatch_continue::h950de3ef5f507e64T0H
  10:     0x7f332b6a7c16 - trans::_match::compile_submatch::ha5fc5204dd2d2befZUH
  11:     0x7f332b6aba24 - trans::_match::compile_submatch_continue::h950de3ef5f507e64T0H
  12:     0x7f332b6a8175 - trans::_match::compile_submatch::ha5fc5204dd2d2befZUH
  13:     0x7f332b6a9f7b - trans::_match::compile_submatch_continue::h950de3ef5f507e64T0H
  14:     0x7f332b6a7c16 - trans::_match::compile_submatch::ha5fc5204dd2d2befZUH
  15:     0x7f332b6af82d - trans::_match::trans_match_inner::hec6393d4bbea11f96uI
  16:     0x7f332b672cf5 - trans::expr::trans_rvalue_dps_unadjusted::h8fcdb28f6f732a15FkB
  17:     0x7f332b648eac - trans::expr::trans_into::hada10aa0abe58f6fXaA
  18:     0x7f332b648a1a - trans::controlflow::trans_stmt_semi::hf87684594e9d274dD2u
  19:     0x7f332b5ccd8a - trans::controlflow::trans_block::h58628df23515fb60z3u
  20:     0x7f332b5cb9f1 - trans::base::trans_closure::h8e149909d93e9d35jHh
  21:     0x7f332b5cd6ca - trans::base::trans_fn::h6fdd3daa5a1290101Rh
  22:     0x7f332b5d0497 - trans::base::trans_item::hae1a16e69a6f2b67dgi
  23:     0x7f332b5de302 - trans::base::trans_crate::h60d17a2e7a10efe004i
  24:     0x7f332cd341e6 - driver::phase_4_translate_to_llvm::h2764cf85036c98d7nOa
  25:     0x7f332cd0ffe6 - driver::compile_input::hd8975b759aec0d60Qba
  26:     0x7f332cdc60e1 - run_compiler::h3b0c3beaef2163aa75b
  27:     0x7f332cdc3932 - boxed::F.FnBox<A>::call_box::h5202619178778601284
  28:     0x7f332cdc2ef9 - rt::unwind::try::try_fn::h4053862560305393821
  29:     0x7f332c85d3d8 - rust_try_inner
  30:     0x7f332c85d3c5 - rust_try
  31:     0x7f332cdc3194 - boxed::F.FnBox<A>::call_box::h4599430653034051152
  32:     0x7f332c7ecf91 - sys::thread::Thread::new::thread_start::h089e987aa4c0e52dzvv
  33:     0x7f332733e353 - start_thread
  34:     0x7f332c43ebfc - __clone
  35:                0x0 - <unknown>

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