[PATCH 3/3] Add EnumItem HIR lowering

2021-09-05 Thread Mark Wielaard
Make HIT EnumItem class an Item, not VisItem like in the AST. At the HIR level EnumItems shouldn't have visibility anymore. Move struct_field_name_exists to rust-ast-lower.cc with the declaration in rust-ast-lower.h to make it reusable in the different visitors. Add a new ASTLoweringEnumItem that

[PATCH 2/3] Resolve Enums and EnumItems

2021-09-05 Thread Mark Wielaard
Generate paths for Enum and EnumItem AST NodeIds and resolve the types of tuple and struct enum items. EnumItems always have the Enum as prefix. To make this work for ResolveStms (declaration statements are not given a canonical path) we add an enum_prefix to be used when resolving EnumItems. For

[PATCH 1/3] Parse optional visibility for enum item

2021-09-05 Thread Mark Wielaard
Syntactically enum items can have a visibility. The visibility has to be removed (through a cfg attribute or macro) before they get lowered. The semantic checking will be done when we implement lowering enum items. Make the AST EnumItem class a VisItem. This simplifies things a little for cloning

Re: Cleanup some StructExpr related classes

2021-09-05 Thread Mark Wielaard
Hi Philip, On Thu, Sep 02, 2021 at 02:23:33PM +0100, Philip Herron wrote: > I've been reviewing your branch a bit and noticed this commit > https://code.wildebeest.org/git/user/mjw/gccrs/commit/?h=enums&id=84d27b926e09ef44dd94be20c97d72bd4b865c40 > which I really like. I wasn't sure what was the b

Re: Rust Compatibility

2021-09-05 Thread Ian Lance Taylor via Gcc-rust
On Thu, Sep 2, 2021 at 7:06 AM Philip Herron wrote: > > Yesterday this issue was posted to us on GitHub > https://github.com/Rust-GCC/gccrs/issues/653, which revolves around > strict-aliasing rules. > > The conversation was focused on what level of compatibility we are aiming for > in the Rust