You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enumState{Succeeded,Failed,}fnprint_on_failure(state:&State){letmut num = 0;match*state {// error: expected unit struct, unit variant or constant, found tuple// variant `State::Failed`State::Failed => {
num = 1;},State::Succeeded => {
num = 2;},
_ => ()}}fnmain(){let b = State::Failed(1);print_on_failure(&b);}
Meta
What version of Rust GCC were you using, git sha if possible.
Error output
some_strange_type_check_bug.rs:22:13: error: expected function, tuple struct or tuple variant, found struct ‘State’ [E0423]
22 | let b = State::Failed(1);
| ^~~~~
some_strange_type_check_bug.rs:24:23: error: cannot find value ‘b’ in this scope [E0425]
24 | print_on_failure(&b);
| ^
Backtrace
crab1: internal compiler error: in TyVar, at rust/typecheck/rust-tyty-util.cc:31
0x131f9ff Rust::TyTy::TyVar::TyVar(unsigned int)
../../gccrs/gcc/rust/typecheck/rust-tyty-util.cc:31
0x138500b Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::BorrowExpr&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:1400
0x11cdd87 Rust::HIR::BorrowExpr::accept_vis(Rust::HIR::HIRExpressionVisitor&)
../../gccrs/gcc/rust/hir/tree/rust-hir.cc:3809
0x137f7af Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr*)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:42
0x13205d3 Rust::TyTy::TypeCheckCallExpr::visit(Rust::TyTy::FnType&)
../../gccrs/gcc/rust/typecheck/rust-tyty-call.cc:143
0x1306db7 Rust::TyTy::FnType::accept_vis(Rust::TyTy::TyVisitor&)
../../gccrs/gcc/rust/typecheck/rust-tyty.cc:1879
0x1387dff Rust::TyTy::TypeCheckCallExpr::go(Rust::TyTy::BaseType*, Rust::HIR::CallExpr&, Rust::TyTy::VariantDef&, Rust::Resolver::TypeCheckContext*)
../../gccrs/gcc/rust/typecheck/rust-tyty-call.h:39
0x138037b Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::CallExpr&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:239
0x11d0867 Rust::HIR::CallExpr::accept_vis(Rust::HIR::HIRExpressionVisitor&)
../../gccrs/gcc/rust/hir/tree/rust-hir.cc:4865
0x137f7af Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr*)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:42
0x138a77f Rust::Resolver::TypeCheckStmt::visit(Rust::HIR::ExprStmt&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-stmt.cc:41
0x11d066f Rust::HIR::ExprStmt::accept_vis(Rust::HIR::HIRStmtVisitor&)
../../gccrs/gcc/rust/hir/tree/rust-hir.cc:4811
0x138a71b Rust::Resolver::TypeCheckStmt::Resolve(Rust::HIR::Stmt*)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-stmt.cc:34
0x1381d53 Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::BlockExpr&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:593
0x11d0e5f Rust::HIR::BlockExpr::accept_vis(Rust::HIR::HIRExpressionVisitor&)
../../gccrs/gcc/rust/hir/tree/rust-hir.cc:5027
0x137f7af Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr*)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:42
0x1366f0b Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:587
0x11d0ed7 Rust::HIR::Function::accept_vis(Rust::HIR::HIRVisItemVisitor&)
../../gccrs/gcc/rust/hir/tree/rust-hir.cc:5039
0x13646bb Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:55
0x12ea887 Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
../../gccrs/gcc/rust/typecheck/rust-hir-type-check.cc:70
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.
The text was updated successfully, but these errors were encountered:
Interesting this is probably going to start to be more of an issue. I decided back ages ago with that TyVar that it should assert if no type was found but it probably needs to start doing the proper thing of returning an error type.
Code
Meta
Error output
Backtrace
The text was updated successfully, but these errors were encountered: