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 for perform_test in pattern matching checking #109523

Closed
chenyukang opened this issue Mar 23, 2023 · 2 comments
Closed

ICE for perform_test in pattern matching checking #109523

chenyukang opened this issue Mar 23, 2023 · 2 comments
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chenyukang
Copy link
Member

Modified code from #109188 (comment),

Code

enum Either {
    One(X),
    Two(X),
}

struct X;

fn move_into_fnmut() {
    let x = Either::One(X);
    let y = || {
        let Either::Two(a) = x;
    };
}

fn main() { }

Only crash with the option --edition 2021:

rustc  --edition 2021  ./p/debug3.rs

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (da7c50c08 2023-03-19)

Error output

<output>
Backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_mir_build/src/build/expr/as_place.rs:258:31
stack backtrace:
   0:        0x100b585f8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hee0b2bdff53fbe2f
   1:        0x100bab3e4 - core::fmt::write::h2ec568216ced94aa
   2:        0x100b4e150 - std::io::Write::write_fmt::h872103ea2db2d6d8
   3:        0x100b5840c - std::sys_common::backtrace::print::h646c6cf0f9475b69
   4:        0x100b5ae94 - std::panicking::default_hook::{{closure}}::h8e98062e20db6bab
   5:        0x100b5abec - std::panicking::default_hook::h57307cc19ca2fc56
   6:        0x108cdfd0c - rustc_driver_impl[fe7592cf9605ddfa]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x100b5b58c - std::panicking::rust_panic_with_hook::h11f2b48dbccc22ae
   8:        0x100b5b344 - std::panicking::begin_panic_handler::{{closure}}::ha7c8b2604e8b2c49
   9:        0x100b58a18 - std::sys_common::backtrace::__rust_end_short_backtrace::hbdbd76863bbae247
  10:        0x100b5b0e0 - _rust_begin_unwind
  11:        0x100bd6648 - core::panicking::panic_fmt::h837acd5e3ef8f820
  12:        0x100bd66b8 - core::panicking::panic::hc8eadf36d168ba5e
  13:        0x10b747e3c - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::match_simplified_candidates
  14:        0x10b7432ac - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::lower_match_tree
  15:        0x10b743b4c - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::place_into_pattern
  16:        0x10b73a178 - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::ast_block_stmts
  17:        0x10b752b28 - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::in_scope::<<rustc_mir_build[2f3783f86689cfe3]::build::Builder>::ast_block::{closure#2}::{closure#0}, ()>
  18:        0x10b74f494 - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest
  19:        0x10b75349c - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::in_scope::<<rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest::{closure#0}::{closure#0}, ()>
  20:        0x10b75127c - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest::{closure#0}
  21:        0x10b74ee34 - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest
  22:        0x10b75349c - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::in_scope::<<rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest::{closure#0}::{closure#0}, ()>
  23:        0x10b75127c - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest::{closure#0}
  24:        0x10b74ee34 - <rustc_mir_build[2f3783f86689cfe3]::build::Builder>::expr_into_dest
  25:        0x10b737368 - rustc_mir_build[2f3783f86689cfe3]::build::mir_build
  26:        0x10b735374 - rustc_mir_build[2f3783f86689cfe3]::build::mir_built
  27:        0x10bd9bb88 - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::mir_built, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  28:        0x10be7a354 - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::mir_built
  29:        0x10b2c101c - rustc_mir_transform[14b1ee1c0cc88243]::check_unsafety::unsafety_check_result
  30:        0x10b2bd4c4 - <rustc_mir_transform[14b1ee1c0cc88243]::check_unsafety::provide::{closure#0} as core[198aa58134b92319]::ops::function::FnOnce<(rustc_middle[3050b1c8d92b003]::ty::context::TyCtxt, rustc_span[5d1b0ba83b8f57fc]::def_id::LocalDefId)>>::call_once
  31:        0x10bd2b508 - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::unsafety_check_result, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  32:        0x10be7f67c - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::unsafety_check_result
  33:        0x10b2bf718 - <rustc_mir_transform[14b1ee1c0cc88243]::check_unsafety::UnsafetyChecker as rustc_middle[3050b1c8d92b003]::mir::visit::Visitor>::visit_rvalue
  34:        0x10b2c112c - rustc_mir_transform[14b1ee1c0cc88243]::check_unsafety::unsafety_check_result
  35:        0x10b2bd4c4 - <rustc_mir_transform[14b1ee1c0cc88243]::check_unsafety::provide::{closure#0} as core[198aa58134b92319]::ops::function::FnOnce<(rustc_middle[3050b1c8d92b003]::ty::context::TyCtxt, rustc_span[5d1b0ba83b8f57fc]::def_id::LocalDefId)>>::call_once
  36:        0x10bd2b508 - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::unsafety_check_result, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  37:        0x10be7f67c - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::unsafety_check_result
  38:        0x10b2ddfd0 - rustc_mir_transform[14b1ee1c0cc88243]::mir_const
  39:        0x10bd9cb94 - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::mir_const, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  40:        0x10be7a504 - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::mir_const
  41:        0x10b2de824 - rustc_mir_transform[14b1ee1c0cc88243]::mir_promoted
  42:        0x10bc9cc38 - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::mir_promoted, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  43:        0x10be7af44 - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::mir_promoted
  44:        0x10b83f41c - rustc_borrowck[87ac93b10043328d]::mir_borrowck
  45:        0x10b8243e8 - <rustc_borrowck[87ac93b10043328d]::provide::{closure#0} as core[198aa58134b92319]::ops::function::FnOnce<(rustc_middle[3050b1c8d92b003]::ty::context::TyCtxt, rustc_span[5d1b0ba83b8f57fc]::def_id::LocalDefId)>>::call_once
  46:        0x10bc9ad4c - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::mir_borrowck, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  47:        0x10be822e8 - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::mir_borrowck
  48:        0x108de5278 - rustc_data_structures[e7b9553464f28486]::sync::par_for_each_in::<&[rustc_span[5d1b0ba83b8f57fc]::def_id::LocalDefId], <rustc_middle[3050b1c8d92b003]::hir::map::Map>::par_body_owners<rustc_interface[15e68b5497950d4d]::passes::analysis::{closure#2}::{closure#0}>::{closure#0}>
  49:        0x108d8dcf8 - <rustc_session[c2529cdbfecf5e3b]::session::Session>::time::<(), rustc_interface[15e68b5497950d4d]::passes::analysis::{closure#2}>
  50:        0x108d6abf8 - rustc_interface[15e68b5497950d4d]::passes::analysis
  51:        0x10bd904d0 - rustc_query_system[850bbbe679bd754c]::query::plumbing::try_execute_query::<rustc_query_impl[e3399835318cd2ff]::queries::analysis, rustc_query_impl[e3399835318cd2ff]::plumbing::QueryCtxt>
  52:        0x10be78090 - <rustc_query_impl[e3399835318cd2ff]::Queries as rustc_middle[3050b1c8d92b003]::ty::query::QueryEngine>::analysis
  53:        0x108d3efa0 - <rustc_middle[3050b1c8d92b003]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[fe7592cf9605ddfa]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>>
  54:        0x108d28008 - <rustc_interface[15e68b5497950d4d]::interface::Compiler>::enter::<rustc_driver_impl[fe7592cf9605ddfa]::run_compiler::{closure#1}::{closure#2}, core[198aa58134b92319]::result::Result<core[198aa58134b92319]::option::Option<rustc_interface[15e68b5497950d4d]::queries::Linker>, rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>>
  55:        0x108ce81ac - rustc_span[5d1b0ba83b8f57fc]::with_source_map::<core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>, rustc_interface[15e68b5497950d4d]::interface::run_compiler<core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>, rustc_driver_impl[fe7592cf9605ddfa]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  56:        0x108cf5240 - std[42e4d38c6d446ced]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[15e68b5497950d4d]::util::run_in_thread_pool_with_globals<rustc_interface[15e68b5497950d4d]::interface::run_compiler<core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>, rustc_driver_impl[fe7592cf9605ddfa]::run_compiler::{closure#1}>::{closure#0}, core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>>
  57:        0x108cecac0 - <<std[42e4d38c6d446ced]::thread::Builder>::spawn_unchecked_<rustc_interface[15e68b5497950d4d]::util::run_in_thread_pool_with_globals<rustc_interface[15e68b5497950d4d]::interface::run_compiler<core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>, rustc_driver_impl[fe7592cf9605ddfa]::run_compiler::{closure#1}>::{closure#0}, core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[198aa58134b92319]::result::Result<(), rustc_span[5d1b0ba83b8f57fc]::ErrorGuaranteed>>::{closure#1} as core[198aa58134b92319]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:        0x100b63bac - std::sys::unix::thread::Thread::new::thread_start::hcfe14f9f8cdec9a0
  59:        0x19174a06c - __pthread_deallocate

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.70.0-nightly (da7c50c08 2023-03-19) running on aarch64-apple-darwin```

</p>
</details>
@chenyukang chenyukang added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 23, 2023
@chenyukang chenyukang changed the title ICE for perform_test in patter matching checking ICE for perform_test in pattern matching checking Mar 23, 2023
@matthiaskrgr
Copy link
Member

probably duplicate of #108683

@chenyukang
Copy link
Member Author

Yes, we could close this one after the PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants