Skip to content

bug: Error when passing multiple arguments in enum entries #96

@Zffu

Description

@Zffu

Sample code

enum test {
	abc(s32 meow, s64 meow)
	cdef(bool kai)
}

Expected behavior

This should work normally

Got error

error[E1]: unexpected ,
  --> structs.qf:2:14
   |
   |    abc(s32 meow, s64 meow)
   |                  
   |
Internally captured in:
   0: <diagnostics::diagnostic::Diagnostic as core::clone::Clone>::clone
             at ./compiler/diagnostics/src/diagnostic.rs:94:24
   1: diagnostics::diagnostic::Diagnostic::push_to_storage::{{closure}}
             at ./compiler/diagnostics/src/diagnostic.rs:196:27
   2: std::thread::local::LocalKey<core::cell::RefCell<T>>::with_borrow_mut::{{closure}}
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/thread/local.rs:757:26
   3: std::thread::local::LocalKey<T>::try_with
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/thread/local.rs:513:12
   4: std::thread::local::LocalKey<T>::with
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/thread/local.rs:477:20
   5: std::thread::local::LocalKey<core::cell::RefCell<T>>::with_borrow_mut
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/thread/local.rs:757:14
   6: diagnostics::diagnostic::Diagnostic::push_to_storage
             at ./compiler/diagnostics/src/diagnostic.rs:195:30
   7: diagnostics::diagnostic::Diagnostic::new_base
             at ./compiler/diagnostics/src/diagnostic.rs:189:11
   8: <lexer::token::LexerToken as diagnostics::DiagnosticSpanOrigin>::make_simple_diagnostic
             at ./compiler/lexer/src/token.rs:271:9
   9: diagnostics::builders::make_unexpected_simple_error
             at ./compiler/diagnostics/src/builders.rs:55:12
  10: ast_parser::types::parse_type_member
             at ./compiler/ast_parser/src/types.rs:172:24
  11: ast_parser::types::parse_type
             at ./compiler/ast_parser/src/types.rs:182:29
  12: ast_parser::structs::members::parse_types_field_member
             at ./compiler/ast_parser/src/structs/members.rs:15:23
  13: ast_parser::structs::enums::parse_enum_entry
             at ./compiler/ast_parser/src/structs/enums.rs:29:21
  14: ast_parser::structs::enums::parse_enum_declaration
             at ./compiler/ast_parser/src/structs/enums.rs:73:26
  15: ast_parser::parser::parse_ast_node
             at ./compiler/ast_parser/src/parser.rs:59:20
  16: ast_parser::parse_ast_ctx
             at ./compiler/ast_parser/src/lib.rs:31:20
  17: compiler_main::cmds::check::run_check
             at ./compiler/compiler_main/src/cmds/check.rs:11:15
  18: compiler_main::main
             at ./compiler/compiler_main/src/main.rs:32:17
  19: core::ops::function::FnOnce::call_once
             at /usr/src/debug/rust/rustc-1.95.0-src/library/core/src/ops/function.rs:250:5
  20: std::sys::backtrace::__rust_begin_short_backtrace
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/sys/backtrace.rs:166:18
  21: std::rt::lang_start::{{closure}}
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/rt.rs:206:18
  22: std::rt::lang_start_internal
  23: std::rt::lang_start
             at /usr/src/debug/rust/rustc-1.95.0-src/library/std/src/rt.rs:205:5
  24: main
  25: <unknown>
  26: __libc_start_main
  27: _start

Metadata

Metadata

Assignees

Type

Projects

Status

Todo this release

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions