1118: Add reachability visitor to Enum variants r=CohenArthur a=CohenArthur
This visits all of an enum's variants and their fields if present. To do that properly, this adds a new `EnumItemKind` enum which allows static casting when visiting each variant of the enum (kept as an `EnumItem` class which is derived three times)
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
1107: tests: Improve timeout handling r=philberty a=liushuyu
- add a 10-second timeout for individual compile test
- add a xfail test case to ensure the timeout mechanism is working
Co-authored-by: liushuyu <liushuyu011@gmail.com>
1116: Move `cfg!()` macro to builtins. Fixes#1039 r=CohenArthur a=antego
Fixes#1039
Hey team, I need help understanding why the test fails.
Compilation succeeds, all the existing tests pass. However the test that I've added fails with the error:
```
FAIL: rust/compile/cfg_macro.rs (test for excess errors)
Excess errors:
/Users/anton/Documents/projects/gcc2/gccrs/gcc/testsuite/rust/compile/cfg_macro.rs:17:8: fatal error: Failed to lower expr: [MacroInvocation:
outer attributes: none
cfg!((A))
has semicolon: false]
compilation terminated.
```
I tried to understand what's happening using a debugger. The only thing that I understood is that the `MacroBuiltin::cfg` function runs.
Appreciate any feedback.
Thank you.
Co-authored-by: antego <antego@users.noreply.github.com>
1110: Add Reachability visitors for items with generics r=CohenArthur a=CohenArthur
This factors generics' predicates visiting in the `ReachabilityVisitor` and calls the function in other items with generic parameters
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
1088: rust-session-manager: better crate name handling logic r=philberty a=liushuyu
- rust-session-manager: set and validate crate name properly
- testsuite/rust: fix the testcases and add more testcases for testing crate name handling
Co-authored-by: liushuyu <liushuyu011@gmail.com>
1111: Add AST Private Visibilities r=CohenArthur a=CohenArthur
When parsing a visibility in `parse_visibility`, it is not an error to
not have a pub token: It simply means we want to create a private
visibility. If we had C++14 or another language, we could instead
represent all visibilities as an optional<AST::Visibility> where the
Visibility class would not need to change. But I think the best course
of action for our case is to instead keep visibilities even when they
are private and have a special case in the `VisKind` enumeration.
This also enables HIR lowering of visibilities to be performed properly for private items
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
1114: rust: Use -Otarget when building and logging warnings r=philberty a=simonpcook
This will provide some synchronization for output lines, and so will
make comparisons with known warnings as part of CI more reliable.
Co-authored-by: Simon Cook <simon.cook@embecosm.com>
When parsing a visibility in `parse_visibility`, it is not an error to
not have a pub token: It simply means we want to create a private
visibility. If we had C++14 or another language, we could instead
represent all visibilities as an optional<AST::Visibility> where the
Visibility class would not need to change. But I think the best course
of action for our case is to instead keep visibilities even when they
are private and have a special case in the `VisKind` enumeration.
1112: rust: Clang/macOS Testing r=philberty a=simonpcook
This adds a version of the build-and-check job that runs with clang on
macOS.
Co-authored-by: Simon Cook <simon.cook@embecosm.com>
1109: rust: Allow gccrs to build on x86_64-apple-darwin with clang/libc++ r=CohenArthur a=simonpcook
This makes changes to the includes such that gccrs can be built with
clang/libc++, and for x86_64-apple-darwin. Similarly, a couple of
changes have been made to creating MacroInvocations and wrapping into
ExprOrStmts for libc++ compatibility.
Co-authored-by: Simon Cook <simon.cook@embecosm.com>
This makes changes to the includes such that gccrs can be built with
clang/libc++, and for x86_64-apple-darwin. Similarly, a couple of
changes have been made to creating MacroInvocations and wrapping into
ExprOrStmts for libc++ compatibility.
1082: Add base for privacy visitor r=CohenArthur a=CohenArthur
This PR is extremely early and implements some building blocks for privacy visitors. I'd like to get some feedback on the architecture and, if satisfactory, merge this first "visitor" which only takes care of visiting HIR struct definitions, to make reviewing easier. We could also merge it to a different branch for now, in order to not add an incomplete pass to the compiler.
Thanks!
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
1108: Add missing unify rules for inference variables r=philberty a=philberty
Inference variables can unify with anything so this includes these
covariant types like references/slices etc. This patch is needed for more
complex type-checking in libcore and generics.
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Inference variables can unify with anything so this includes these
covariant types like references/slices etc. This patch is needed for more
complex type-checking in libcore and generics.
lookup_reachability()
Inserting reach levels in the reachability_map should only be done if
the existing reach level is lower than the provided one. If the node is
not yet present in the reachability map, insert it no matter what
1103: Lower AST::Visibility to HIR::Visibility properly r=CohenArthur a=CohenArthur
Fixes#1093
This should cover every case since the previous code simply created public HIR visibilities.
The PR refactors the HIR::Visibility struct to be tinier and a desugared version of the AST one.
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
1086: Slice support r=philberty a=philberty
Please see the commit a8de089969cb45199008027cd8d1b80dff25746f for
a long explanation of what's going on in the patch. Unfortunately, I have not been
able to split this patch up anymore since supporting slices exposed many bugs
in the implementation of generics in general never main the missing support for
generic associated types.
Fixes#849
Co-authored-by: Philip Herron <philip.herron@embecosm.com>