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 on match expression without any match arms #2567

Open
MahadMuhammad opened this issue Aug 17, 2023 · 1 comment
Open

ICE on match expression without any match arms #2567

MahadMuhammad opened this issue Aug 17, 2023 · 1 comment

Comments

@MahadMuhammad
Copy link
Contributor

ICE - match statement having no match arms


Code

enum Empty {}

fn foo(x: Empty) {
    match x {
        // empty
    }
}

Meta

  • What version of Rust GCC were you using, git sha 95dcbb2
  • gccrs (Compiler-Explorer-Build-gcc-dba8bc5bf8247161b6eff4f738b6479382f770f2-binutils-2.40) 13.0.1 20230417 (experimental)

Error output

  • Internal Compiler Error.
Backtrace

➜  gccrs-build gcc/crab1 ../mahad-testsuite/E0002.rs
crab1: internal compiler error: in check_match_scrutinee, at rust/backend/rust-compile-expr.cc:1286
0x7c6897 check_match_scrutinee
  ../../gccrs/gcc/rust/backend/rust-compile-expr.cc:1286
0xcc7d7b Rust::Compile::CompileExpr::visit(Rust::HIR::MatchExpr&)
  ../../gccrs/gcc/rust/backend/rust-compile-expr.cc:1314
0xcbd394 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr*, Rust::Compile::Context*)
  ../../gccrs/gcc/rust/backend/rust-compile-expr.cc:45
0xce5194 Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
  ../../gccrs/gcc/rust/backend/rust-compile-base.cc:487
0xce71fe Rust::Compile::HIRCompileBase::compile_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Rust::HIR::SelfParam&, std::vector<Rust::HIR::FunctionParam, std::allocator<Rust::HIR::FunctionParam> >&, Rust::HIR::FunctionQualifiers const&, Rust::HIR::Visibility&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&, unsigned int, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const*, Rust::TyTy::FnType*)
  ../../gccrs/gcc/rust/backend/rust-compile-base.cc:643
0xcbac68 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
  ../../gccrs/gcc/rust/backend/rust-compile-item.cc:181
0xac42f9 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, bool, unsigned int)
  ../../gccrs/gcc/rust/backend/rust-compile-item.h:38
0xac42f9 Rust::Compile::CompileCrate::go()
  ../../gccrs/gcc/rust/backend/rust-compile.cc:47
0xac4348 Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
  ../../gccrs/gcc/rust/backend/rust-compile.cc:40
0xabe37d Rust::Session::compile_crate(char const*)
  ../../gccrs/gcc/rust/rust-session-manager.cc:671
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


@CohenArthur CohenArthur changed the title empty match arm ICE, ICE on match expression without any match arms Aug 17, 2023
@powerboat9
Copy link
Contributor

It seems like matching on zero-variant enums isn't supported yet, and any attempt to do so fails an assertion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants