-
Notifications
You must be signed in to change notification settings - Fork 204
Open
Labels
Description
auto-reduced (treereduce-rust):
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
enum Enum {
Unit,
Tuple(i32),
Struct { x: i32 },
}
fn main() {
Enum::Unit {};
// ok
}original code
original:
//@ only-linux
//@ compile-flags: --error-format=human --color=always
enum Enum {
Unit,
Tuple(i32),
Struct { x: i32 },
}
fn main() {
Enum::Unit;
Enum::Enum;
Enum::Struct;
Enum::Unit();
Enum::Tuple();
Enum::Struct();
Enum::Unit {};
Enum::Tuple {};
Enum::Struct {};
Enum::r#struct(0);
Enum::Tuple(0);
Enum::Struct(0);
Enum::Unit { x: 0 };
Enum::Tuple { x: 0 };
Enum::Struct { x: 0 }; // ok
Enum::Unit(0, 0);
Enum::Tuple(0, 0);
Enum::Struct(0, 0);
Enum::Unit { x: 0, y: 0 };
Enum::unit { x: 0 };
Enum::Struct { x: 0, y: 0 };
Enum::unit;
Enum::tuple;
Enum::r#struct;
Enum::unit();
Enum::tuple();
Enum::r#struct();
Enum::unit {};
Enum::tuple {};
Enum::r#struct {};
Enum::unit(0);
Enum::tuple(0);
Enum::r#struct(0);
Enum::unit { x: 0 };
Enum::tuple { x: 0 };
Enum::Unit { x: 0 };
Enum::unit(0, 0);
Enum::tuple(0, 0);
Enum::r#struct(0, 0);
Enum::tuple {};
Enum::tuple { x: 0, y: 0 };
Enum::r#struct { x: 0, y: 0 };
}Version information:
Possibly related line of code:
gccrs/gcc/rust/typecheck/rust-tyty.cc
Lines 1563 to 1575 in 4db0cf7
| return fields.at (index); | |
| } | |
| std::vector<StructFieldType *> & | |
| VariantDef::get_fields () | |
| { | |
| rust_assert (type != NUM); | |
| return fields; | |
| } | |
| bool | |
| VariantDef::lookup_field (const std::string &lookup, | |
| StructFieldType **field_lookup, size_t *index) const |
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use
Program output
crab1: internal compiler error: in get_fields, at rust/typecheck/rust-tyty.cc:1569
0x301e249 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:786
0xc22881 fancy_abort(char const*, int, char const*)
../../gcc/diagnostics/context.cc:1787
0x9085ea Rust::TyTy::VariantDef::get_fields()
../../gcc/rust/typecheck/rust-tyty.cc:1569
0x9085ea Rust::TyTy::VariantDef::get_fields()
../../gcc/rust/typecheck/rust-tyty.cc:1567
0x106a768 Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::StructExprStruct&)
../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:1182
0x1065f44 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr&)
../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:50
0x1075aac ???
../../gcc/rust/typecheck/rust-hir-type-check-stmt.h:33
0x1076143 Rust::Resolver::TypeCheckStmt::Resolve(Rust::HIR::Stmt&)
../../gcc/rust/typecheck/rust-hir-type-check-stmt.cc:34
0x1067941 Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::BlockExpr&)
../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:622
0x1065f44 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr&)
../../gcc/rust/typecheck/rust-hir-type-check-expr.cc:50
0x1043a36 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:588
0x103a985 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
../../gcc/rust/typecheck/rust-hir-type-check-item.cc:57
0xfda37b Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
../../gcc/rust/typecheck/rust-hir-type-check.cc:71
0xe8752c Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:682
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.