]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 months agogccrs: Remove empty visit functions
Pierre-Emmanuel Patry [Thu, 5 Sep 2024 11:23:52 +0000 (13:23 +0200)] 
gccrs: Remove empty visit functions

We can let the default visitor visit those nodes anyway so we're sure
all nodes can be reached.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
empty visit function implementations.
* resolve/rust-default-resolver.h: Remove corresponding prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Mark virtual function override in default resolver
Pierre-Emmanuel Patry [Thu, 5 Sep 2024 11:01:07 +0000 (13:01 +0200)] 
gccrs: Mark virtual function override in default resolver

Those function prototype were not marked as override and throwing
warning.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.h: Make most visit function override.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Loop on expansion if a new export has been defined
Pierre-Emmanuel Patry [Wed, 21 Aug 2024 15:14:46 +0000 (17:14 +0200)] 
gccrs: Loop on expansion if a new export has been defined

When a use statement requires a reexported item it cannot find it in
the same pass, an additional pass shall be performed. This means we need
to detect whether a new item has been reexported and resolve until the
end.

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::Early): Add dirty
flag initialization.
(Early::go): Set dirty flag using top level resolver.
* resolve/rust-early-name-resolver-2.0.h: Add dirty flag.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::TopLevel):
Initialize dirty flag.
(TopLevel::insert_or_error_out): Set dirty flag on successful
namespace modification.
* resolve/rust-toplevel-name-resolver-2.0.h: Add dirty flag.
* rust-session-manager.cc (Session::expansion): Modify fixed point
condition to include name resolution modifications.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Fix missing error on duplicated nodes
Pierre-Emmanuel Patry [Wed, 21 Aug 2024 15:01:29 +0000 (17:01 +0200)] 
gccrs: Fix missing error on duplicated nodes

When we tried to insert a shadowable node and another shadowable node has
been inserted before, we didn't emit any error if the node has already
been inserted previously and failed silently.

gcc/rust/ChangeLog:

* resolve/rust-rib.cc (Rib::insert): Emit an error when trying to
insert an already inserted node.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: nr2.0: Cleanup import mappings and factor into a class.
Arthur Cohen [Wed, 10 Apr 2024 15:38:19 +0000 (17:38 +0200)] 
gccrs: nr2.0: Cleanup import mappings and factor into a class.

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.h: New class for imports.
* resolve/rust-finalize-imports-2.0.cc (finalize_simple_import): Use
the new API.
(finalize_glob_import): Likewise.
(finalize_rebind_import): Likewise.
(FinalizeImports::FinalizeImports): Likewise.
(FinalizeImports::visit): Likewise.
* resolve/rust-finalize-imports-2.0.h: Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Likewise.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.

4 months agogccrs: Insert imports in all namespaces they were resolved in
Arthur Cohen [Mon, 8 Apr 2024 16:44:15 +0000 (18:44 +0200)] 
gccrs: Insert imports in all namespaces they were resolved in

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_simple_import):
Insert import in all namespaces where they were resolved.
(Early::resolve_rebind_import): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Improve APIs, make them
accept multiple resolutions.
* resolve/rust-finalize-imports-2.0.cc: Handle multiple resolutions.
* resolve/rust-name-resolution-context.h (resolve_path): Remove function.

4 months agogccrs: early: Do not emit errors for unresolved imports, store them instead
Arthur Cohen [Sat, 6 Apr 2024 21:23:39 +0000 (23:23 +0200)] 
gccrs: early: Do not emit errors for unresolved imports, store them instead

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Store errors for later.

4 months agogccrs: imports: Make FinalizeImports a resolver visitor as well
Arthur Cohen [Sat, 6 Apr 2024 21:02:51 +0000 (23:02 +0200)] 
gccrs: imports: Make FinalizeImports a resolver visitor as well

gcc/rust/ChangeLog:

* resolve/rust-finalize-imports-2.0.cc (FinalizeImports::go): Turn
static method into method.
(FinalizeImports::visit): New.
* resolve/rust-finalize-imports-2.0.h (class FinalizeImports): Make
FinalizeImports a visitor.
* resolve/rust-early-name-resolver-2.0.cc (Early::go): Use new FinalizeImports API.
(Early::resolve_glob_import): Use new API.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
(Early::build_import_mapping): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Likewise.

4 months agogccrs: imports: Start storing Ribs in ImportKind
Arthur Cohen [Fri, 5 Apr 2024 22:32:57 +0000 (00:32 +0200)] 
gccrs: imports: Start storing Ribs in ImportKind

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add debug call.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Store
imports using the new classes.
* resolve/rust-toplevel-name-resolver-2.0.h: Use new classes.

4 months agogccrs: imports: Create ImportData class and use it in import_mappings
Arthur Cohen [Fri, 5 Apr 2024 22:00:49 +0000 (00:00 +0200)] 
gccrs: imports: Create ImportData class and use it in import_mappings

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import):
Use ImportData class.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
(Early::build_import_mapping): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
* resolve/rust-finalize-imports-2.0.cc (finalize_simple_import): Likewise.
(finalize_glob_import): Likewise.
(finalize_rebind_import): Likewise.
(FinalizeImports::go): Likewise.
* resolve/rust-finalize-imports-2.0.h: Likewise.
* resolve/rust-name-resolution-context.h: Likewise.
* resolve/rust-rib.h: Define ImportData class.

4 months agogccrs: imports: Add FinalizeImports class
Arthur Cohen [Thu, 4 Apr 2024 15:07:54 +0000 (17:07 +0200)] 
gccrs: imports: Add FinalizeImports class

gcc/rust/ChangeLog:

* Make-lang.in: Add new object file.
* ast/rust-item.h: Constify method.
* resolve/rust-early-name-resolver-2.0.cc (Early::go): Call into
the imports finalizer.
(Early::resolve_glob_import): Remove old resolution.
(Early::resolve_rebind_import): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go):
New function.
(GlobbingVisitor::visit): Likewise.
(TopLevel::visit): Do not call into handle_use_* functions anymore.
* resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor):
New.
* resolve/rust-finalize-imports-2.0.cc: New file.
* resolve/rust-finalize-imports-2.0.h: New file.

4 months agogccrs: early: Resolve imports and create import mappings
Arthur Cohen [Thu, 4 Apr 2024 14:25:30 +0000 (16:25 +0200)] 
gccrs: early: Resolve imports and create import mappings

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): New function.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
(Early::build_import_mapping): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Add declarations and list of imports to
resolve.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob): Remove function,
which is now being handled by the Early name resolver.
(TopLevel::handle_use_dec): Likewise.
(TopLevel::handle_rebind): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Likewise, and add functions for creating
import list and fetching it.

4 months agogccrs: toplevel: Build list of imports for Early to resolve
Arthur Cohen [Thu, 4 Apr 2024 13:42:29 +0000 (15:42 +0200)] 
gccrs: toplevel: Build list of imports for Early to resolve

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc: Comment out handle_use
call and error emission.
* resolve/rust-toplevel-name-resolver-2.0.h: Create ImportKind class.

4 months agogccrs: toplevel: Add note for resolving use declarations
Arthur Cohen [Wed, 3 Apr 2024 15:41:47 +0000 (17:41 +0200)] 
gccrs: toplevel: Add note for resolving use declarations

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec):
Add notes on the problem.
* resolve/rust-toplevel-name-resolver-2.0.h: Likewise.

4 months agogccrs: nr2.0: default-visitor: Conditionally visit type in self parameters.
Arthur Cohen [Wed, 27 Mar 2024 16:20:15 +0000 (17:20 +0100)] 
gccrs: nr2.0: default-visitor: Conditionally visit type in self parameters.

This could trigger an assertions as `get_type` on `SelfParam` asserts that
the self param does have a given type, which is not always the case.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc (DefaultResolver::visit): Do not
visit self's type if it does not have one.

4 months agogccrs: rust fix ICE when hir lowering qualified path expressions without an as
Philip Herron [Fri, 20 Sep 2024 16:13:38 +0000 (17:13 +0100)] 
gccrs: rust fix ICE when hir lowering qualified path expressions without an as

Qualified path expressions usually are <X as Y>::... but the as is optional
this adds the extra checking in hir lowering to not hit that nullptr.

Fixes #3082

gcc/rust/ChangeLog:

* hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit):
check for valid as segment

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-3082.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
4 months agorust: fix ICE when compiling impl block for !
Philip Herron [Fri, 20 Sep 2024 17:45:12 +0000 (18:45 +0100)] 
rust: fix ICE when compiling impl block for !

We need to resolve the never type which is its own special AST node so it
doesnt magically get handled like the regular builtin type paths such as
i32.

Fixes #3035

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-type.cc (ResolveType::visit):
handle never type
(ResolveTypeToCanonicalPath::visit): likewise
* resolve/rust-ast-resolve-type.h: missing never type
* resolve/rust-name-resolver.cc (Resolver::generate_builtins):
track never type node_id
(Resolver::setup_builtin): likewise
* resolve/rust-name-resolver.h: new never type getter

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-3035.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
4 months agogccrs: Remove some overloaded methods from DefaultResolver.
Owen Avery [Mon, 23 Sep 2024 21:44:19 +0000 (17:44 -0400)] 
gccrs: Remove some overloaded methods from DefaultResolver.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Remove some empty overloads which
DefaultASTVisitor::visit should be able to handle.
* resolve/rust-default-resolver.h
(DefaultResolver::visit): Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agogccrs: Add extra assertions to tl::optional
Owen Avery [Wed, 18 Sep 2024 20:05:31 +0000 (16:05 -0400)] 
gccrs: Add extra assertions to tl::optional

gcc/rust/ChangeLog:

* util/optional.h
(optional): Add assertions to dereference operator overloads
when C++14 is available.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agogccrs: adjust hir dump of BlockExpr
Marc Poulhiès [Sat, 21 Sep 2024 08:44:12 +0000 (10:44 +0200)] 
gccrs: adjust hir dump of BlockExpr

Add tail_reachable and label fields to the dump.

gcc/rust/ChangeLog:

* hir/rust-hir-dump.cc (Dump::visit): Add missing fields.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
4 months agorust: negative polarity removes restrictions on validation of impl blocks
Philip Herron [Fri, 20 Sep 2024 16:49:36 +0000 (17:49 +0100)] 
rust: negative polarity removes restrictions on validation of impl blocks

Negative polarity means we can just ignore if any trait items are not
implemented.

Fxies #3030

gcc/rust/ChangeLog:

* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): the polarity was reversed
* typecheck/rust-hir-type-check-item.cc: check the polarity

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-3030.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
4 months agogccrs: Fix ICE on error propagation with generic
benjamin.thos [Thu, 12 Sep 2024 17:10:49 +0000 (17:10 +0000)] 
gccrs: Fix ICE on error propagation with generic

add a resolve expr visitor on error propagation to avoid internal
compiler error when used with generics

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add
implementation of error propagation visitor
* resolve/rust-ast-resolve-expr.h: Add prototype of error
propagation

Signed-off-by: benjamin.thos <benjamin.thos@epita.fr>
4 months agogccrs: Check if the type has been correctly resolved
Pierre-Emmanuel Patry [Thu, 19 Sep 2024 12:38:48 +0000 (14:38 +0200)] 
gccrs: Check if the type has been correctly resolved

We did not check the optional was valid, this lead to rogue dereference
and undefined behaviors.

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add optional
check.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Create new test system for name resolution 2.0
Owen Avery [Mon, 16 Sep 2024 22:27:19 +0000 (18:27 -0400)] 
gccrs: Create new test system for name resolution 2.0

This runs the standard compile/**.rs tests
with name resolution 2.0 enabled. The exclude file
can be used to exclude tests which are not yet working
with name resolution 2.0.

gcc/testsuite/ChangeLog:

* rust/compile/nr2/compile.exp: New test.
* rust/compile/nr2/exclude: New.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agogccrs: [gccrs#3141] Remove double negation by returning CompileExpr::Compile early
JoanVC [Sun, 15 Sep 2024 13:59:34 +0000 (15:59 +0200)] 
gccrs: [gccrs#3141] Remove double negation by returning CompileExpr::Compile early

Fixes gccrs#3141.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc

Signed-off-by: Joan Vilardaga <github-91yu@joanvc.cat>
4 months agogccrs: [gccrs#3141] Fix incorrect handling of overflow in numeric types
JoanVC [Tue, 10 Sep 2024 19:52:50 +0000 (21:52 +0200)] 
gccrs: [gccrs#3141] Fix incorrect handling of overflow in numeric types

Fixes gccrs#3141.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc: Fix range checking for both integers and floats.
* hir/tree/rust-hir-expr.h: Add "negative_number" boolean to LiteralExpr class.

gcc/testsuite/ChangeLog:

* rust/compile/issue-3141.rs: New test.

Signed-off-by: Joan Vilardaga <github-91yu@joanvc.cat>
4 months agogccrs: session-manager: Fix typos in -frust-incomplete message
Arthur Cohen [Thu, 5 Sep 2024 14:17:57 +0000 (16:17 +0200)] 
gccrs: session-manager: Fix typos in -frust-incomplete message

gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::compile_crate): Use less repetition,
fix a typo in `reports`, fix word order.

4 months agogccrs: Emit error on auto-traits
benjamin.thos [Wed, 11 Sep 2024 14:31:20 +0000 (14:31 +0000)] 
gccrs: Emit error on auto-traits

Throw an error when auto-traits used without feature attribute.

gcc/rust/ChangeLog:

* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Emit error
on trait when auto field member true.
* checks/errors/rust-feature-gate.h: add prototype of trait visitor.
* checks/errors/rust-feature.cc (Feature::create): add
optin_builtin_traits in match of feature.

gcc/testsuite/ChangeLog:

* rust/compile/auto_trait_super_trait.rs: Add feature attribute.
* rust/compile/generic_auto_trait.rs: likewise.
* rust/compile/auto_trait.rs: add test for error without
feature attribute

Signed-off-by: benjamin.thos <benjamin.thos@epita.fr>
4 months agogccrs: Implement initial pattern analysis pass.
Raiki Tamura [Wed, 7 Aug 2024 17:25:05 +0000 (02:25 +0900)] 
gccrs: Implement initial pattern analysis pass.

gcc/rust/ChangeLog:

* Make-lang.in: Add rust-hir-pattern-analysis.o.
* rust-session-manager.cc (Session::compile_crate):
Add pattern analysis pass.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Do typecheck for subpatterns.
* checks/errors/rust-hir-pattern-analysis.cc: New file.
* checks/errors/rust-hir-pattern-analysis.h: New file.

gcc/testsuite/ChangeLog:

* rust/compile/exhaustiveness1.rs: New test.
* rust/compile/exhaustiveness2.rs: New test.
* rust/compile/exhaustiveness3.rs: New test.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
4 months agogccrs: Dynamic dispatch with supertraits
Liam Naddell [Thu, 8 Aug 2024 09:31:58 +0000 (05:31 -0400)] 
gccrs: Dynamic dispatch with supertraits

gcc/rust/ChangeLog:

* backend/rust-compile.cc:
Modify compute_address_for_trait_item to support supertraits
* typecheck/rust-tyty.cc:
Remove auto

gcc/testsuite/ChangeLog:

* rust/compile/trait13.rs:
Add test for supertraits of supertraits
* rust/compile/trait14.rs:
Diamond problem with supertraits test
* rust/execute/torture/trait14.rs:
Add test for dynamic dispatch with supertraits
* rust/execute/torture/trait15.rs:
Add test for dynamic dispatch with generics
* rust/execute/torture/trait16.rs:
Add test for dynamic dispatch with lifetime params 1
* rust/execute/torture/trait17.rs:
Add test for dynamic dispatch with lifetime params 2
* rust/execute/torture/trait18.rs:
Add test for default implementations with dynamic dispatch and
supertraits

Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
4 months agogccrs: Used `IndexVec` for place_map
Kushal Pal [Wed, 28 Aug 2024 06:39:28 +0000 (06:39 +0000)] 
gccrs: Used `IndexVec` for place_map

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use strong
type instead of size_t.
(Dump::visit_place): Likewise.
(Dump::visit_scope): Likewise.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Use
IndeVec for place_map.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Use `IndexVec` for bb_fold_map
Kushal Pal [Wed, 28 Aug 2024 06:16:11 +0000 (06:16 +0000)] 
gccrs: Use `IndexVec` for bb_fold_map

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg):
Used `IndexVec` for bb_fold_map.
(Dump::go): Use strong type as index instead of value as now we
are using `IndexVec`.
(Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Use
`IndexVec` for bb_fold_map.
* checks/errors/borrowck/rust-bir-place.h: Add constructor for
`IndexVec` that can reserve size.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Used `IndexVec` for Places
Kushal Pal [Tue, 20 Aug 2024 06:09:51 +0000 (06:09 +0000)] 
gccrs: Used `IndexVec` for Places

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-place.h: Use strong types as
index.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Used `IndexVec` for BasicBlocks
Kushal Pal [Mon, 19 Aug 2024 10:06:49 +0000 (10:06 +0000)] 
gccrs: Used `IndexVec` for BasicBlocks

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Use strong type as index and
remove access to numeric value.
* checks/errors/borrowck/rust-bir-builder-internal.h
(struct BuilderContext): Likewise.
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg):
Likewise.
(Dump::go): Likewise.
(Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h
(class FactCollector): Likewise.
(points): Likewise.
* checks/errors/borrowck/rust-bir.h (struct BasicBlockId): Used
IndexVec for BasicBlocks.
(struct Function): Likewise.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::get_statement): Change the extracted
index to strong type.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Used `IndexVec` for Loans
Kushal Pal [Mon, 19 Aug 2024 09:48:49 +0000 (09:48 +0000)] 
gccrs: Used `IndexVec` for Loans

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-place.h: Used `IndexVec` with
ScopeId as index.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::get_loan): Convert Polonius::Loan to
BIR::Loan, so we can use it as index.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Used `IndexVec` for Scopes
Kushal Pal [Mon, 19 Aug 2024 09:38:52 +0000 (09:38 +0000)] 
gccrs: Used `IndexVec` for Scopes

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-place.h:
Used `IndexVec` with ScopeId as index.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Introduce `IndexVec`
Kushal Pal [Mon, 19 Aug 2024 09:28:25 +0000 (09:28 +0000)] 
gccrs: Introduce `IndexVec`

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-place.h (struct Loan):
Introduce new class `IndexVec` inspired from IndexVec of rust.
It acts as a wrapper around `std::vector` and lets user specify
a strong type to use as index.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Strong type BasicBlockId
Kushal Pal [Wed, 7 Aug 2024 10:58:17 +0000 (10:58 +0000)] 
gccrs: Strong type BasicBlockId

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Use value of BasicBlockId as index.
* checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext):
Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h:
Initialize with ENTRY_BASIC_BLOCK.
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg):
Use value of BasicBlockId as index.
(Dump::go): Likewise.
(Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
Initialize with ENTRY_BASIC_BLOCK.
(points): Use value of BasicBlockId as index.
* checks/errors/borrowck/rust-bir.h (struct BasicBlockId):
BasicBlockId is a struct now.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Strong type ScopeId
Kushal Pal [Wed, 7 Aug 2024 10:16:24 +0000 (10:16 +0000)] 
gccrs: Strong type ScopeId

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::setup_loop): Use value of ScopeId.
(ExprStmtBuilder::visit): Use continue scope id instead of
continue basic block id.
* checks/errors/borrowck/rust-bir-builder-internal.h: Use value
of ScopeId.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use
ROOT_VALUE instead of hardcoded 0.
(Dump::visit_scope): Use value of ScopeId.
* checks/errors/borrowck/rust-bir-place.h (struct ScopeId):
ScopeId is now a struct.
(std::numeric_limits::max): Set invalid ScopeId.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Strong type LoanId
Kushal Pal [Wed, 7 Aug 2024 08:44:03 +0000 (08:44 +0000)] 
gccrs: Strong type LoanId

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): Use new
API, i.e get_loan_id() instead of get_loan().
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Use
value of LoanId in Polonius facts.
* checks/errors/borrowck/rust-bir-place.h (struct LoanId):
LoanId is a struct now.
* checks/errors/borrowck/rust-bir.h (class AbstractExpr): Use
new API, as we are getting a LoanId and not a loan itself.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Use FreeRegions inplace of `std::vector<FreeRegion>`
Kushal Pal [Thu, 8 Aug 2024 07:12:00 +0000 (07:12 +0000)] 
gccrs: Use FreeRegions inplace of `std::vector<FreeRegion>`

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-internal.h: Use
FreeRegions instead of making a temporary vector of FreeRegion.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
Likewise.
(points): Likewise.
* checks/errors/borrowck/rust-bir-free-region.h: Remove obsolete
set_from() helpers, add push_back().
* checks/errors/borrowck/rust-bir-place.h: Use FreeRegions
instead of making a temporary vector of Origin.
* typecheck/rust-tyty-variance-analysis-private.h: Change type
of `regions`.
* typecheck/rust-tyty-variance-analysis.cc (CrateCtx::query_type_regions):
Use new type.
(GenericTyPerCrateCtx::query_generic_variance): Likewise.
(TyVisitorCtx::add_constraints_from_generic_args): Likewise.
(FieldVisitorCtx::add_constraints_from_region): Likewise.
(FieldVisitorCtx::add_constrints_from_param): Likewise.
* typecheck/rust-tyty-variance-analysis.h: Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Strong type FreeRegion
Kushal Pal [Wed, 7 Aug 2024 05:19:28 +0000 (05:19 +0000)] 
gccrs: Strong type FreeRegion

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-internal.h: Use
STATIC_FREE_REGION, use value of FreeRegion for origin.
* checks/errors/borrowck/rust-bir-builder.h: Use free region
value.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit_scope):
Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (points):
Likewise.
* checks/errors/borrowck/rust-bir-free-region.h (struct FreeRegion):
Make FreeRegion a struct.
* checks/errors/borrowck/rust-bir-place.h: Use FreeRegion
instead of Origin in PlaceDB.
* typecheck/rust-tyty-variance-analysis.cc (FieldVisitorCtx::add_constraints_from_region):
Use value of FreeRegion for origin.
(FieldVisitorCtx::add_constrints_from_param): Likewise.
(Term::make_transform): Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Strong type PlaceId
Kushal Pal [Mon, 5 Aug 2024 10:50:55 +0000 (10:50 +0000)] 
gccrs: Strong type PlaceId

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc (renumber_places):
Use value of PlaceId as index.
(Dump::visit_place): Likewise.
(Dump::visit_scope): Likewise.
(Dump::go): Refill `place_map` with for loop instead of
using std::iota().
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Use
value as index.
* checks/errors/borrowck/rust-bir-place.h (struct PlaceId):
PlaceId is now a class holding a uint32_t value. Overloaded
comparision operators for easier comparision.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Avoid accidental insertion into map
Owen Avery [Thu, 5 Sep 2024 23:44:55 +0000 (19:44 -0400)] 
gccrs: Avoid accidental insertion into map

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-pattern.cc
(PatternDeclaration::check_bindings_consistency): Check if
outer_bindings_map contains an entry before indexing.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agogccrs: Fix v0-mangle1.rs test when run with ASAN
Owen Avery [Wed, 4 Sep 2024 02:49:15 +0000 (22:49 -0400)] 
gccrs: Fix v0-mangle1.rs test when run with ASAN

gcc/rust/ChangeLog:

* util/rust-canonical-path.h
(CanonicalPath::CanonicalPath): Properly initialize crate_num
with copy constructor.

gcc/testsuite/ChangeLog:

* rust/compile/v0-mangle1.rs: Make v0-mangle test more crate_num
agnostic.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agogccrs: Provide new asm test case for amd64
badumbatish [Sun, 1 Sep 2024 06:37:19 +0000 (23:37 -0700)] 
gccrs: Provide new asm test case for amd64

gcc/testsuite/ChangeLog:

* rust/execute/torture/inline_asm_mov_x_5.rs: Move to...
* rust/execute/torture/inline_asm_mov_x_5_ARM.rs: ...here.
* rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: New test.

4 months agogccrs: Rehaul, Apply code review from Arthur
badumbatish [Thu, 29 Aug 2024 17:07:19 +0000 (10:07 -0700)] 
gccrs: Rehaul, Apply code review from Arthur

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::visit):
Change API, public/private, comments, formatting from code
review
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::tree_codegen_asm): Likewise.
* backend/rust-compile-asm.h (class CompileAsm): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise.
(parse_options): Likewise.
(parse_asm_arg): Likewise.
(expand_inline_asm_strings): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise.
(expand_inline_asm_strings): Likewise.
(expand_inline_asm_string): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_typecheck.rs: Change comments

4 months agogccrs: Fix return type of asm mov 5 to i32:0, tortured
badumbatish [Wed, 28 Aug 2024 07:15:14 +0000 (00:15 -0700)] 
gccrs: Fix return type of asm mov 5 to i32:0, tortured

gcc/testsuite/ChangeLog:

* rust/execute/inline_asm_mov_x_5.rs: Move to...
* rust/execute/torture/inline_asm_mov_x_5.rs: ...here.

4 months agogccrs: Make inline mov compiles
badumbatish [Wed, 28 Aug 2024 01:15:26 +0000 (18:15 -0700)] 
gccrs: Make inline mov compiles

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Remove debug
* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings):
properly formatted via rust instead of c
(parse_asm): formatted comment
(parse_format_strings): formatted comment
* hir/tree/rust-hir-expr.h: fix is_simple_asm()

gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_parse_operand.rs: Fix format asm
* rust/compile/inline_asm_parse_output_operand.rs:
Fix format asm
* rust/execute/torture/inline_asm_mov_x_5.rs: Move to...
* rust/execute/inline_asm_mov_x_5.rs: ...here.

4 months agogccrs: Use's array type when constring string tree
badumbatish [Thu, 8 Aug 2024 21:22:05 +0000 (14:22 -0700)] 
gccrs: Use's array type when constring string tree

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Use's array type when constring string tree
(CompileAsm::asm_construct_string_tree):
Use's array type when constring string tree

4 months agogccrs: Added noreturn checking for nevertype, new test
badumbatish [Fri, 2 Aug 2024 18:36:04 +0000 (11:36 -0700)] 
gccrs: Added noreturn checking for nevertype, new test

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Added noreturn checking for nevertype

gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_typecheck.rs: New test.

4 months agogccrs: Perform lowering hir output operand to tree
badumbatish [Thu, 1 Aug 2024 23:22:32 +0000 (16:22 -0700)] 
gccrs: Perform lowering hir output operand to tree

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Add debug comment
(CompileAsm::asm_construct_outputs):
Perform lowering hir output operand to tree

4 months agogccrs: Perform type check on InlineAsm's operand
badumbatish [Thu, 1 Aug 2024 23:18:38 +0000 (16:18 -0700)] 
gccrs: Perform type check on InlineAsm's operand

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Perform type check on InlineAsm's operand
(typecheck_inline_asm_operand): Likewise

4 months agogccrs: Lower the HIR to tree with CompileExpr
badumbatish [Tue, 30 Jul 2024 04:59:13 +0000 (21:59 -0700)] 
gccrs: Lower the HIR to tree with CompileExpr

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs):
Lower the HIR to tree with CompileExpr
* backend/rust-compile-asm.h: Remove static from method

4 months agogccrs: Move strip double quotes, add scaffold expand
badumbatish [Sat, 27 Jul 2024 03:26:01 +0000 (20:26 -0700)] 
gccrs: Move strip double quotes, add scaffold expand

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (strip_double_quotes):
Move strip double quotes to parse phase
(CompileAsm::asm_construct_string_tree): Likewise
* backend/rust-compile-asm.h (strip_double_quotes): Likewise
* expand/rust-macro-builtins-asm.cc (strip_double_quotes):
Likewise
(expand_inline_asm): Renamed to expand_inline_asm_strings
(expand_inline_asm_strings): Renamed from expand_inline_asm
(parse_asm): Move strip double quotes to parse phase
(parse_format_strings): Likewise
* expand/rust-macro-builtins-asm.h (strip_double_quotes):
Likewise
(expand_inline_asm_strings): Inline asm expansion fn
(expand_inline_asm_string): Inline asm expansion fn

4 months agogccrs: Start work on expand inline asm
badumbatish [Fri, 26 Jul 2024 06:07:00 +0000 (23:07 -0700)] 
gccrs: Start work on expand inline asm

gcc/rust/ChangeLog:

* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Remove warnings
(parse_reg_operand_out): Remove warnings
(expand_inline_asm): New function for eventual expansion
(parse_asm): Use expand_inline_asm

gcc/testsuite/ChangeLog:

* rust/execute/torture/inline_asm_mov_x_5.rs: New test.

4 months agogccrs: Added counting to check for asm_construct_outputs
badumbatish [Wed, 24 Jul 2024 05:17:12 +0000 (22:17 -0700)] 
gccrs: Added counting to check for asm_construct_outputs

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs):
Set up counting to check

4 months agogccrs: Added new test for prep of output {}
badumbatish [Sun, 21 Jul 2024 22:13:25 +0000 (15:13 -0700)] 
gccrs: Added new test for prep of output {}

gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_parse_output_operand.rs: New test.

4 months agogccrs: Minor fix to asm codegen pr
badumbatish [Thu, 18 Jul 2024 14:34:43 +0000 (07:34 -0700)] 
gccrs: Minor fix to asm codegen pr

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Use expr's is_simple_asm and is_inline_asm
(CompileAsm::asm_is_simple): removed
(CompileAsm::asm_is_inline): removed
* backend/rust-compile-asm.h: Add docs to ASM_TREE_ARRAY_LENGTH
* hir/tree/rust-hir-expr.h: Add is_simple_asm, is_inline_asm
and remove #include tree

4 months agogccrs: Refactor compile-asm for first round review
badumbatish [Mon, 8 Jul 2024 05:03:12 +0000 (22:03 -0700)] 
gccrs: Refactor compile-asm for first round review

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (strip_double_quotes):
Refactor compile-asm for first round review
(CompileAsm::asm_build_asm_stmt): Likewise.
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::asm_get_locus): Likewise.
(CompileAsm::asm_construct_string_tree): Likewise.
(CompileAsm::asm_construct_outputs): Likewise.
(CompileAsm::asm_construct_inputs): Likewise.
(CompileAsm::asm_construct_clobber_tree): Likewise.
(CompileAsm::asm_construct_label_tree): Likewise.
(CompileAsm::asm_is_simple): Likewise.
(CompileAsm::asm_is_inline): Likewise.
* backend/rust-compile-asm.h (strip_double_quotes): Likewise.
(class CompileAsm): Likewise.

4 months agogccrs: Successfully produce pseudo-nop
badumbatish [Sat, 6 Jul 2024 20:17:00 +0000 (13:17 -0700)] 
gccrs: Successfully produce pseudo-nop

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::add_stmt):
Deleted
(CompileAsm::CompileAsm):
Successfully produce pseudo-nop
(CompileAsm::visit): Likewise
(CompileAsm::asm_build_asm_stmt): Likewise
(CompileAsm::asm_construct_string_tree): Likewise
(CompileAsm::asm_is_inline): Likewise
* backend/rust-compile-asm.h (class CompileAsm): Likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise

4 months agogccrs: Scaffolding code
badumbatish [Fri, 5 Jul 2024 17:03:56 +0000 (10:03 -0700)] 
gccrs: Scaffolding code

gcc/rust/ChangeLog:

* backend/rust-compile-asm.cc (CompileAsm::add_stmt):
Scaffolding code.
(CompileAsm::asm_build_asm_stmt): Likewise.
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::asm_construct_string_tree): Likewise.
* backend/rust-compile-asm.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.

4 months agogccrs: Scaffolding new compile-asm files
badumbatish [Sun, 30 Jun 2024 23:48:30 +0000 (16:48 -0700)] 
gccrs: Scaffolding new compile-asm files

gcc/rust/ChangeLog:

* Make-lang.in:
Scaffolding new compile-asm files
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise
* hir/tree/rust-hir-expr.h: Likewise
* backend/rust-compile-asm.cc: New file. Likewise
* backend/rust-compile-asm.h: New file. Likewise

4 months agogccrs: Setting up interfaces for codegen
jjasmine [Mon, 24 Jun 2024 02:47:17 +0000 (19:47 -0700)] 
gccrs: Setting up interfaces for codegen

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit):
Setting up interfaces for codegen
* hir/tree/rust-hir-expr.h: Likewise.

4 months agogccrs: Local testing for build_string and debug()
jjasmine [Sun, 23 Jun 2024 17:39:12 +0000 (10:39 -0700)] 
gccrs: Local testing for build_string and debug()

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit):
Local testing for build_string and debug()

4 months agogccrs: Make sure CompileExpr::visit is reached
jjasmine [Sat, 22 Jun 2024 21:33:47 +0000 (14:33 -0700)] 
gccrs: Make sure CompileExpr::visit is reached

gcc/rust/ChangeLog:

* hir/tree/rust-hir.cc (InlineAsm::accept_vis):
Make sure CompileExpr::visit is reached
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise
gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_compile_nop.rs: New test.

4 months agogccrs: Scaffolding asm codegen
jjasmine [Sat, 22 Jun 2024 18:56:50 +0000 (11:56 -0700)] 
gccrs: Scaffolding asm codegen

gcc/rust/ChangeLog:

* backend/rust-compile-block.h:
Scaffolding asm codegen
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.

4 months agogccrs: Fix the parser's operand and flags storage
badumbatish [Wed, 24 Jul 2024 05:17:12 +0000 (22:17 -0700)] 
gccrs: Fix the parser's operand and flags storage

gcc/rust/ChangeLog:

* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Fix parsing logic & reassignment logic
(parse_reg_operand_in): Fix parsing
(parse_reg_operand_out): Fix parsing
(parse_reg_operand_inout): Fix parsing
(parse_reg_operand_unexpected): Remove rust_unreachable()
(parse_asm_arg): Fix parsing logic

4 months agogccrs: Add pop guard for binder
badumbatish [Sat, 24 Aug 2024 05:21:05 +0000 (22:21 -0700)] 
gccrs: Add pop guard for binder

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check.h:
Add pop guard for binder

4 months agogccrs: Fix warnings from const auto& to const auto
badumbatish [Sun, 4 Aug 2024 19:43:09 +0000 (12:43 -0700)] 
gccrs: Fix warnings from const auto& to const auto

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve.cc (NameResolution::go):
Fix warnings from const auto& to const auto

4 months agogccrs: emit error code for E0758
Raiki Tamura [Wed, 28 Aug 2024 17:48:29 +0000 (02:48 +0900)] 
gccrs: emit error code for E0758

gcc/rust/ChangeLog:

* lex/rust-lex.cc (Lexer::build_token): Emit error code.
* lex/rust-lex.h: Fix comment.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
4 months agogccrs: Add typecheck for path patterns.
Raiki Tamura [Fri, 9 Aug 2024 14:56:55 +0000 (23:56 +0900)] 
gccrs: Add typecheck for path patterns.

gcc/rust/ChangeLog:

* hir/tree/rust-hir.cc (Item::item_kind_string): New function.
* hir/tree/rust-hir.h: New function.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Modify to check all arms in match expressions even if some of them
has errors.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add and fix check for path patterns.

gcc/testsuite/ChangeLog:

* rust/compile/issue-2324-2.rs: Fix error message.
* rust/compile/match9.rs: New test.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
4 months agorust: Add checking for union patterns
Raiki Tamura [Wed, 31 Jul 2024 07:09:30 +0000 (16:09 +0900)] 
rust: Add checking for union patterns

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add check for union patterns.

gcc/testsuite/ChangeLog:

* rust/compile/match8.rs: New test.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
4 months agogccrs: feature-gate: Cleanup visitor and constructor
Arthur Cohen [Wed, 21 Aug 2024 13:42:58 +0000 (15:42 +0200)] 
gccrs: feature-gate: Cleanup visitor and constructor

This commit turns a few of the fields into `tl::optional<T>` and cleanups
the constructor with a couple default parameters. We can also reuse the
variable that we are `switch`ing on, instead of repeating the enum variants
each time.

Most importantly, the `FeatureGate` visitor now uses the `DefaultAstVisitor`
correctly, and will now visit nested items. This means that we have to
fix a bunch of the testsuite as some feature attributes were missing.

gcc/rust/ChangeLog:

* checks/errors/rust-feature.cc (Feature::create): Reuse variable,
remove now optional parameters from constructor.
* checks/errors/rust-feature.h: Cleanup class definition.
* checks/errors/rust-feature-gate.cc (FeatureGate::gate): Use optional.
* checks/errors/rust-feature-gate.h: Cleanup visitor implementation.

gcc/testsuite/ChangeLog:

* rust/compile/assume.rs: Add missing feature attribute.
* rust/compile/issue-1901.rs: Likewise.
* rust/compile/issue-1981.rs: Likewise.
* rust/compile/sizeof-stray-infer-var-bug.rs: Likewise.
* rust/compile/torture/intrinsics-8.rs: Likewise.
* rust/compile/torture/transmute-size-check-1.rs: Likewise.
* rust/compile/torture/transmute1.rs: Likewise.
* rust/compile/torture/uninit-intrinsic-1.rs: Likewise.
* rust/execute/torture/issue-1436.rs: Likewise.
* rust/execute/torture/issue-2583.rs: Likewise.

4 months agogccrs: attributes: Start handling prelude_import properly
Arthur Cohen [Wed, 21 Aug 2024 13:09:23 +0000 (15:09 +0200)] 
gccrs: attributes: Start handling prelude_import properly

This commit adds basic handling for the `#[prelude_import]` attribute,
without doing anything functionality wise.

gcc/rust/ChangeLog:

* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Add base
feature gating for `#[feature(prelude_import)]`.
* checks/errors/rust-feature-gate.h: Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
* checks/errors/rust-feature.h: Likewise.
* util/rust-attribute-values.h: Add base handling for `#[prelude_import]`
attribute.
* util/rust-attributes.cc: Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/prelude_import.rs: New test.

4 months agogccrs: Fix the disorder struct and class in inline asm
badumbatish [Mon, 19 Aug 2024 23:39:11 +0000 (16:39 -0700)] 
gccrs: Fix the disorder struct and class in inline asm

gcc/rust/ChangeLog:

* ast/rust-ast-full-decls.h (struct InlineAsmOperand):
Change to class
(class InlineAsmOperand): Change from struct
* hir/tree/rust-hir-full-decls.h (struct InlineAsmRegOrRegClass):
Removed from decl, used from AST
(struct AnonConst): new decl from rust-hir-expr.h
(class InlineAsmOperand): new decl from rust-hir-expr.h

4 months agogccrs: ast: Introduce class hierarchy for lang item paths
Arthur Cohen [Mon, 24 Jun 2024 16:25:15 +0000 (18:25 +0200)] 
gccrs: ast: Introduce class hierarchy for lang item paths

Create a base Path class which is derived into two children classes for
regular paths and lang item paths. This allows it to hold either the
segments of a fully formed path, or the node ID of a lang-item path.
This is required in order to create these special paths
which do not have segments, and do not necessarily have a canonical
form - they only depend on where the item was defined.

gcc/rust/ChangeLog:

* ast/rust-ast-full-decls.h (class PathPattern): Rename PathPattern to...
(class Path): ...Path
* ast/rust-ast-collector.cc (TokenCollector::visit): Add required methods
for LangItemPath and RegularPath.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-path.cc (PathPattern::as_string): Likewise.
(RegularPath::as_string): Likewise.
(LangItemPath::as_string): Likewise.
(PathPattern::convert_to_simple_path): Likewise.
(RegularPath::convert_to_simple_path): Likewise.
(RegularPath::accept_vis): Likewise.
(LangItemPath::accept_vis): Likewise.
(PathInExpression::as_string): Likewise.
(QualifiedPathInExpression::as_string): Likewise.
* ast/rust-path.h (class PathPattern): Likewise.
(class Path): Likewise.
(class RegularPath): Likewise.
(class LangItemPath): Likewise.
(class PathInExpression): Likewise.
(class QualifiedPathInExpression): Likewise.
* ast/rust-pattern.h (class PathPattern): Likewise.
(class Path): Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.

4 months agogccrs: ast: Remove PathExpr abstract class
Arthur Cohen [Mon, 24 Jun 2024 15:04:13 +0000 (17:04 +0200)] 
gccrs: ast: Remove PathExpr abstract class

Inherit directly from ExprWithoutBlock instead.

gcc/rust/ChangeLog:

* ast/rust-ast.h (class PathExpr): Remove class.
* ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock.
(class QualifiedPathInExpression): Likewise.

4 months agogccrs: ast: PathPattern: Remove `remove_all_segments` method
Arthur Cohen [Mon, 24 Jun 2024 14:50:43 +0000 (16:50 +0200)] 
gccrs: ast: PathPattern: Remove `remove_all_segments` method

This method was used only for stripping PathPattern AST nodes during
`cfg-strip`, which seems like a misnomer and makes it a good candidate
for simplification.

gcc/rust/ChangeLog:

* ast/rust-path.h (class PathInExpression): Remove `remove_all_segments`
method, add a `marked_for_strip` flag instead.

4 months agogccrs: Attempted to access a nonexistent field [E0609]
Muhammad Mahad [Thu, 15 Aug 2024 16:44:55 +0000 (16:44 +0000)] 
gccrs: Attempted to access a nonexistent field [E0609]

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Add error code and update error message

gcc/testsuite/ChangeLog:

* rust/compile/nonexistent-field.rs: New test.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
4 months agogccrs: Move errors with locations
Kushal Pal [Mon, 12 Aug 2024 05:48:27 +0000 (05:48 +0000)] 
gccrs: Move errors with locations

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::report_move_errors): Specify
locations for code causing errors and related moves.

gcc/testsuite/ChangeLog:

* rust/borrowck/test_move.rs: Test rich-errors related to moves.
* rust/borrowck/test_move_conditional.rs: Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Subset errors with locations
Kushal Pal [Fri, 26 Jul 2024 07:40:58 +0000 (07:40 +0000)] 
gccrs: Subset errors with locations

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::report_subset_errors): Highlight
lifetime locations while reporting subset errors.
(BorrowCheckerDiagnostics::get_lifetime_param): Helper function
to fetch HIR::Lifetime node from Polonius::Origin.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.h:
Definition of helper function.

gcc/testsuite/ChangeLog:

* rust/borrowck/subset.rs: Better subset errors.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Map locations to placeholder regions
Kushal Pal [Thu, 25 Jul 2024 11:57:35 +0000 (11:57 +0000)] 
gccrs: Map locations to placeholder regions

Mapped placeholder regions to their respective HIR nodes so we can fetch
locations during error reporting.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder.h: Map regions to
their respective HIR nodes.
* checks/errors/borrowck/rust-bir.h (struct Function):
Add unordered_map to maintain the mapping.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Fixed testcase
Kushal Pal [Mon, 12 Aug 2024 05:48:27 +0000 (05:48 +0000)] 
gccrs: Fixed testcase

gcc/testsuite/ChangeLog:

* rust/borrowck/test_move.rs: Assigning `a` to `c` is the
correct way to test the behaviour.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: [gccrs#2324] Add error message for E0532
Liam Naddell [Sat, 3 Aug 2024 05:36:06 +0000 (01:36 -0400)] 
gccrs: [gccrs#2324] Add error message for E0532

gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc:
Emit E0532 when trying to reference a Tuple or Struct variant
using a non Tuple or Struct pattern.

gcc/testsuite/ChangeLog:
* rust/compile/issue-2324-1.rs:
add test for E0532 with tuple enum variant
* rust/compile/issue-2324-2.rs:
add test for E0532 with struct enum variant

Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
4 months agogccrs: Eager expansion for include* gccrs#1805 gccrs#1865
Liam Naddell [Sat, 27 Jul 2024 04:28:13 +0000 (00:28 -0400)] 
gccrs: Eager expansion for include* gccrs#1805 gccrs#1865

gcc/rust/ChangeLog:

* expand/rust-expand-visitor.h:
remove auto keyword
* expand/rust-macro-builtins-helpers.cc:
allow for changing macro invoc types on eager expansions to
semicoloned macros
* expand/rust-macro-builtins-helpers.h:
add default semicoloned argument
* expand/rust-macro-builtins-include.cc:
allow for eager expansion for include and include_bytes
allow for parsing include invocations as items instead of
expressions, which allows invocations at global scope
* expand/rust-macro-expand.cc:
push Expr type for eager invocations

gcc/testsuite/ChangeLog:

* rust/compile/macros/builtin/include1.rs:
add basic include test at global scope
* rust/compile/macros/builtin/include2.rs:
add basic include test at local scope with expression
* rust/compile/macros/builtin/include3.rs:
add eager expansion test at global scope
* rust/compile/macros/builtin/include4.rs:
add eager expansion test at local scope with expression
* rust/compile/macros/builtin/include_bytes.rs:
add eager expansion test at global scope
* rust/compile/macros/builtin/include_rs:
supporting test file with dummy function
* rust/compile/macros/builtin/include_rs2:
supporting test file with dummy string
* rust/compile/macros/builtin/include_str.rs:
add eager expansion test at global scope
* rust/execute/torture/builtin_macro_include_bytes.rs:
clean up old test logic, add permutations for eager expansion
* rust/execute/torture/builtin_macro_include_str.rs:
add eager expansion permutations

4 months agogccrs: Simplify construction of BIR::Statement
Kushal Pal [Wed, 31 Jul 2024 01:37:54 +0000 (01:37 +0000)] 
gccrs: Simplify construction of BIR::Statement

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-internal.h:
Use `make_*` functions to create BIR::Statements.
* checks/errors/borrowck/rust-bir.h: Make a complete constructor
and introduce `make_*` functions to create various
BIR::Statements.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Loan errors with locations
Kushal Pal [Thu, 18 Jul 2024 08:12:49 +0000 (08:12 +0000)] 
gccrs: Loan errors with locations

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::report_loan_errors): Add label to
where the borrow occurs and where the invalid access occurs.
(BorrowCheckerDiagnostics::get_statement):
Fetch BIR::Statement from Polonius::Point
(BorrowCheckerDiagnostics::get_loan):
Fetch BIR::Loan from Polonius::Loan
* checks/errors/borrowck/rust-borrow-checker-diagnostics.h:
Function definition of helpers.

gcc/testsuite/ChangeLog:

* rust/borrowck/reference.rs: Test rich errors for
borrow-checker.
* rust/borrowck/return_ref_to_local.rs: Likewise.
* rust/borrowck/tmp.rs: Likewise.
* rust/borrowck/use_while_mut.rs: Likewise.
* rust/borrowck/use_while_mut_fr.rs: Likewise.
* rust/borrowck/well_formed_function_inputs.rs: Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Add location to BIR::Statement of kind RETURN
Kushal Pal [Fri, 19 Jul 2024 07:30:03 +0000 (07:30 +0000)] 
gccrs: Add location to BIR::Statement of kind RETURN

This commit adds location_t to BIR::Statement where type is RETURN.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Add location parameter.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-internal.h: Add helper
function for pushing return statements.
* checks/errors/borrowck/rust-bir.h: Remove `expr` parameter as
it is only needed for ASSIGNMENT statements, for which we
already have a constructor.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Implement resolve expr for inline asm ast
badumbatish [Wed, 31 Jul 2024 03:22:48 +0000 (20:22 -0700)] 
gccrs: Implement resolve expr for inline asm ast

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
Implement resolve expr for inline asm ast
(translate_operand): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.

4 months agogccrs: Add location to BIR::Loan
Kushal Pal [Tue, 9 Jul 2024 10:37:27 +0000 (10:37 +0000)] 
gccrs: Add location to BIR::Loan

This commit adds location_t to BIR::Loan, this location will point to
location is source code where the borrow occured, this information will
be useful for reporting borrow-checking errors.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-internal.h:
Fill location for loan.
* checks/errors/borrowck/rust-bir-place.h (struct Loan):
Add location field.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Add location support to BIR::Statement
Kushal Pal [Thu, 27 Jun 2024 01:18:54 +0000 (01:18 +0000)] 
gccrs: Add location support to BIR::Statement

This commit adds location_t to BIR::Statement where type is ASSIGNMENT
this information will be later used for reporting borrow-checking
errors.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Added location parameter.
* checks/errors/borrowck/rust-bir-builder-internal.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h:
Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-bir.h: Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Turn to switch case, use new helper functions
badumbatish [Tue, 30 Jul 2024 16:13:15 +0000 (09:13 -0700)] 
gccrs: Turn to switch case, use new helper functions

gcc/rust/ChangeLog:

* hir/rust-ast-lower-expr.cc (translate_operand_in):
Turn to switch case, use new helper functions
(translate_operand_out): Likewise.
(translate_operand_inout): Likewise.
(translate_operand_split_in_out): Likewise.
(translate_operand_const): Likewise.
(translate_operand_sym): Likewise.
(translate_operand_label): Likewise.
(from_operand): Likewise.
(ASTLoweringExpr::visit): Likewise.

4 months agogccrs: Set up the hir lowering for operand
badumbatish [Sat, 27 Jul 2024 08:19:11 +0000 (01:19 -0700)] 
gccrs: Set up the hir lowering for operand

gcc/rust/ChangeLog:

* hir/rust-ast-lower-expr.cc (from_operand):
Set up the lowering for operand
(ASTLoweringExpr::visit): Likewise
* hir/tree/rust-hir-expr.h (struct InlineAsmRegOrRegClass):
Not necessary, kept from ast
(struct AnonConst): Set up lowering for operand
(class InlineAsmOperand): Likewise, add getters

4 months agogccrs: Improve compressed point bit manipulation
Kushal Pal [Wed, 31 Jul 2024 10:53:35 +0000 (10:53 +0000)] 
gccrs: Improve compressed point bit manipulation

gcc/rust/ChangeLog:

* checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint):
Added comments and made extraction of statement more verbose for
better understanding.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Use new constructors and control flow for operand
badumbatish [Tue, 30 Jul 2024 02:00:47 +0000 (19:00 -0700)] 
gccrs: Use new constructors and control flow for operand

gcc/rust/ChangeLog:

* ast/rust-expr.h (struct InlineAsmOperand): changed to class
(class InlineAsmOperand): Have appropriate constructor,
and getter
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Use the new implement constructors and new control flow.
(parse_reg_operand_in): Likewise
(parse_reg_operand_out): Likewise
(parse_reg_operand_inout): Likewise
(parse_reg_operand_const): Likewise

4 months agogccrs: Fix the parser's operand and flags storage
badumbatish [Wed, 24 Jul 2024 05:17:12 +0000 (22:17 -0700)] 
gccrs: Fix the parser's operand and flags storage

gcc/rust/ChangeLog:

* ast/rust-expr.h (struct InlineAsmOperand):
Add construction for register_type
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Fix parsing logic & reassignment logic
(parse_reg_operand_in): Fix parsing
(parse_reg_operand_out): Fix parsing
(parse_reg_operand_inout): Fix parsing
(parse_reg_operand_unexpected): Remove rust_unreachable()
(parse_asm_arg): Fix parsing logic
* expand/rust-macro-builtins-asm.h: Add = operator overloading

gcc/testsuite/ChangeLog:

* rust/compile/inline_asm_illegal_operands.rs: Test now passing
* rust/compile/inline_asm_parse_operand.rs: Remove _, not
supported right now

4 months agogccrs: Fixed bitwise operation in `extract_stmt`
Kushal Pal [Fri, 26 Jul 2024 07:51:43 +0000 (07:51 +0000)] 
gccrs: Fixed bitwise operation in `extract_stmt`

gcc/rust/ChangeLog:

* checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint):
This is the correct way of extracting the required bits.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
4 months agogccrs: Move mbe macro tests to their own directory
Pierre-Emmanuel Patry [Mon, 29 Jul 2024 12:27:32 +0000 (14:27 +0200)] 
gccrs: Move mbe macro tests to their own directory

gcc/testsuite/ChangeLog:

* rust/compile/macro-delim.rs: Move to...
* rust/compile/macros/mbe/macro-delim.rs: ...here.
* rust/compile/macro-issue1053-2.rs: Move to...
* rust/compile/macros/mbe/macro-issue1053-2.rs: ...here.
* rust/compile/macro-issue1053.rs: Move to...
* rust/compile/macros/mbe/macro-issue1053.rs: ...here.
* rust/compile/macro-issue1224.rs: Move to...
* rust/compile/macros/mbe/macro-issue1224.rs: ...here.
* rust/compile/macro-issue1233.rs: Move to...
* rust/compile/macros/mbe/macro-issue1233.rs: ...here.
* rust/compile/macro-issue1395-2.rs: Move to...
* rust/compile/macros/mbe/macro-issue1395-2.rs: ...here.
* rust/compile/macro-issue1395.rs: Move to...
* rust/compile/macros/mbe/macro-issue1395.rs: ...here.
* rust/compile/macro-issue1400-2.rs: Move to...
* rust/compile/macros/mbe/macro-issue1400-2.rs: ...here.
* rust/compile/macro-issue1400.rs: Move to...
* rust/compile/macros/mbe/macro-issue1400.rs: ...here.
* rust/compile/macro-issue2092.rs: Move to...
* rust/compile/macros/mbe/macro-issue2092.rs: ...here.
* rust/compile/macro-issue2192.rs: Move to...
* rust/compile/macros/mbe/macro-issue2192.rs: ...here.
* rust/compile/macro-issue2194.rs: Move to...
* rust/compile/macros/mbe/macro-issue2194.rs: ...here.
* rust/compile/macro-issue2229.rs: Move to...
* rust/compile/macros/mbe/macro-issue2229.rs: ...here.
* rust/compile/macro-issue2264.rs: Move to...
* rust/compile/macros/mbe/macro-issue2264.rs: ...here.
* rust/compile/macro-issue2268.rs: Move to...
* rust/compile/macros/mbe/macro-issue2268.rs: ...here.
* rust/compile/macro-issue2273.rs: Move to...
* rust/compile/macros/mbe/macro-issue2273.rs: ...here.
* rust/compile/macro-issue2653.rs: Move to...
* rust/compile/macros/mbe/macro-issue2653.rs: ...here.
* rust/compile/macro-issue2983_2984.rs: Move to...
* rust/compile/macros/mbe/macro-issue2983_2984.rs: ...here.
* rust/compile/macro1.rs: Move to...
* rust/compile/macros/mbe/macro1.rs: ...here.
* rust/compile/macro10.rs: Move to...
* rust/compile/macros/mbe/macro10.rs: ...here.
* rust/compile/macro11.rs: Move to...
* rust/compile/macros/mbe/macro11.rs: ...here.
* rust/compile/macro12.rs: Move to...
* rust/compile/macros/mbe/macro12.rs: ...here.
* rust/compile/macro13.rs: Move to...
* rust/compile/macros/mbe/macro13.rs: ...here.
* rust/compile/macro14.rs: Move to...
* rust/compile/macros/mbe/macro14.rs: ...here.
* rust/compile/macro15.rs: Move to...
* rust/compile/macros/mbe/macro15.rs: ...here.
* rust/compile/macro16.rs: Move to...
* rust/compile/macros/mbe/macro16.rs: ...here.
* rust/compile/macro17.rs: Move to...
* rust/compile/macros/mbe/macro17.rs: ...here.
* rust/compile/macro18.rs: Move to...
* rust/compile/macros/mbe/macro18.rs: ...here.
* rust/compile/macro19.rs: Move to...
* rust/compile/macros/mbe/macro19.rs: ...here.
* rust/compile/macro2.rs: Move to...
* rust/compile/macros/mbe/macro2.rs: ...here.
* rust/compile/macro20.rs: Move to...
* rust/compile/macros/mbe/macro20.rs: ...here.
* rust/compile/macro21.rs: Move to...
* rust/compile/macros/mbe/macro21.rs: ...here.
* rust/compile/macro22.rs: Move to...
* rust/compile/macros/mbe/macro22.rs: ...here.
* rust/compile/macro23.rs: Move to...
* rust/compile/macros/mbe/macro23.rs: ...here.
* rust/compile/macro25.rs: Move to...
* rust/compile/macros/mbe/macro25.rs: ...here.
* rust/compile/macro26.rs: Move to...
* rust/compile/macros/mbe/macro26.rs: ...here.
* rust/compile/macro27.rs: Move to...
* rust/compile/macros/mbe/macro27.rs: ...here.
* rust/compile/macro28.rs: Move to...
* rust/compile/macros/mbe/macro28.rs: ...here.
* rust/compile/macro29.rs: Move to...
* rust/compile/macros/mbe/macro29.rs: ...here.
* rust/compile/macro3.rs: Move to...
* rust/compile/macros/mbe/macro3.rs: ...here.
* rust/compile/macro30.rs: Move to...
* rust/compile/macros/mbe/macro30.rs: ...here.
* rust/compile/macro31.rs: Move to...
* rust/compile/macros/mbe/macro31.rs: ...here.
* rust/compile/macro32.rs: Move to...
* rust/compile/macros/mbe/macro32.rs: ...here.
* rust/compile/macro33.rs: Move to...
* rust/compile/macros/mbe/macro33.rs: ...here.
* rust/compile/macro34.rs: Move to...
* rust/compile/macros/mbe/macro34.rs: ...here.
* rust/compile/macro35.rs: Move to...
* rust/compile/macros/mbe/macro35.rs: ...here.
* rust/compile/macro36.rs: Move to...
* rust/compile/macros/mbe/macro36.rs: ...here.
* rust/compile/macro37.rs: Move to...
* rust/compile/macros/mbe/macro37.rs: ...here.
* rust/compile/macro38.rs: Move to...
* rust/compile/macros/mbe/macro38.rs: ...here.
* rust/compile/macro39.rs: Move to...
* rust/compile/macros/mbe/macro39.rs: ...here.
* rust/compile/macro4.rs: Move to...
* rust/compile/macros/mbe/macro4.rs: ...here.
* rust/compile/macro40.rs: Move to...
* rust/compile/macros/mbe/macro40.rs: ...here.
* rust/compile/macro41.rs: Move to...
* rust/compile/macros/mbe/macro41.rs: ...here.
* rust/compile/macro42.rs: Move to...
* rust/compile/macros/mbe/macro42.rs: ...here.
* rust/compile/macro43.rs: Move to...
* rust/compile/macros/mbe/macro43.rs: ...here.
* rust/compile/macro44.rs: Move to...
* rust/compile/macros/mbe/macro44.rs: ...here.
* rust/compile/macro45.rs: Move to...
* rust/compile/macros/mbe/macro45.rs: ...here.
* rust/compile/macro46.rs: Move to...
* rust/compile/macros/mbe/macro46.rs: ...here.
* rust/compile/macro47.rs: Move to...
* rust/compile/macros/mbe/macro47.rs: ...here.
* rust/compile/macro48.rs: Move to...
* rust/compile/macros/mbe/macro48.rs: ...here.
* rust/compile/macro49.rs: Move to...
* rust/compile/macros/mbe/macro49.rs: ...here.
* rust/compile/macro5.rs: Move to...
* rust/compile/macros/mbe/macro5.rs: ...here.
* rust/compile/macro50.rs: Move to...
* rust/compile/macros/mbe/macro50.rs: ...here.
* rust/compile/macro51.rs: Move to...
* rust/compile/macros/mbe/macro51.rs: ...here.
* rust/compile/macro52.rs: Move to...
* rust/compile/macros/mbe/macro52.rs: ...here.
* rust/compile/macro53.rs: Move to...
* rust/compile/macros/mbe/macro53.rs: ...here.
* rust/compile/macro54.rs: Move to...
* rust/compile/macros/mbe/macro54.rs: ...here.
* rust/compile/macro55.rs: Move to...
* rust/compile/macros/mbe/macro55.rs: ...here.
* rust/compile/macro56.rs: Move to...
* rust/compile/macros/mbe/macro56.rs: ...here.
* rust/compile/macro57.rs: Move to...
* rust/compile/macros/mbe/macro57.rs: ...here.
* rust/compile/macro6.rs: Move to...
* rust/compile/macros/mbe/macro6.rs: ...here.
* rust/compile/macro7.rs: Move to...
* rust/compile/macros/mbe/macro7.rs: ...here.
* rust/compile/macro8.rs: Move to...
* rust/compile/macros/mbe/macro8.rs: ...here.
* rust/compile/macro9.rs: Move to...
* rust/compile/macros/mbe/macro9.rs: ...here.
* rust/compile/macro_call_statement.rs: Move to...
* rust/compile/macros/mbe/macro_call_statement.rs: ...here.
* rust/compile/macro_export_1.rs: Move to...
* rust/compile/macros/mbe/macro_export_1.rs: ...here.
* rust/compile/macro_return.rs: Move to...
* rust/compile/macros/mbe/macro_return.rs: ...here.
* rust/compile/macro_rules_macro_rules.rs: Move to...
* rust/compile/macros/mbe/macro_rules_macro_rules.rs: ...here.
* rust/compile/macro_use1.rs: Move to...
* rust/compile/macros/mbe/macro_use1.rs: ...here.
* rust/compile/macros/mbe/mbe_macro.exp: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agogccrs: Move builtin macro tests to their own directory
Pierre-Emmanuel Patry [Mon, 29 Jul 2024 12:20:01 +0000 (14:20 +0200)] 
gccrs: Move builtin macro tests to their own directory

We need a finer grain to filter tests and organise them.

gcc/testsuite/ChangeLog:

* rust/compile/builtin_macro_compile_error.rs: Move to...
* rust/compile/macros/builtin/compile_error.rs: ...here.
* rust/compile/builtin_macro_concat.rs: Move to...
* rust/compile/macros/builtin/concat.rs: ...here.
* rust/compile/builtin_macro_eager1.rs: Move to...
* rust/compile/macros/builtin/eager1.rs: ...here.
* rust/compile/builtin_macro_eager2.rs: Move to...
* rust/compile/macros/builtin/eager2.rs: ...here.
* rust/compile/builtin_macro_eager3.rs: Move to...
* rust/compile/macros/builtin/eager3.rs: ...here.
* rust/compile/builtin_macro_env.rs: Move to...
* rust/compile/macros/builtin/env.rs: ...here.
* rust/compile/builtin_macro_include_bytes.rs: Move to...
* rust/compile/macros/builtin/include_bytes.rs: ...here.
* rust/compile/builtin_macro_include_bytes_location_info.rs: Move to...
* rust/compile/macros/builtin/include_bytes_location_info.rs: ...here.
* rust/compile/builtin_macro_include_str.rs: Move to...
* rust/compile/macros/builtin/include_str.rs: ...here.
* rust/compile/builtin_macro_include_str_location_info.rs: Move to...
* rust/compile/macros/builtin/include_str_location_info.rs: ...here.
* rust/compile/builtin_macro_not_found.rs: Move to...
* rust/compile/macros/builtin/not_found.rs: ...here.
* rust/compile/builtin_macro_recurse2.rs: Move to...
* rust/compile/macros/builtin/recurse2.rs: ...here.
* rust/compile/macros/builtin/builtin_macro.exp: New test.
* rust/compile/invalid_utf8: Move invalid-utf8 data to...
* rust/compile/macros/builtin/invalid_utf8: ...here.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>