]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
14 months agoRemove useless cstddef header from rust-fmt
jjasmine [Sun, 19 May 2024 02:58:51 +0000 (19:58 -0700)] 
Remove useless cstddef header from rust-fmt

gcc/rust/ChangeLog:

* ast/rust-fmt.h:  Remove useless cstddef header from rust-fmt

14 months agoChange lookup_ast_item's return type
Pierre-Emmanuel Patry [Sat, 4 May 2024 02:10:08 +0000 (04:10 +0200)] 
Change lookup_ast_item's return type

Wrap the function's return type within an optional.

gcc/rust/ChangeLog:

* metadata/rust-export-metadata.cc (ExportContext::emit_trait):
Adapt call site to the new return type.
(ExportContext::emit_function): Likewise.
(ExportContext::emit_macro): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_ast_item): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_visibility's return type
Pierre-Emmanuel Patry [Sat, 4 May 2024 01:44:35 +0000 (03:44 +0200)] 
Change lookup_visibility's return type

Wrap the return type within an optional.

gcc/rust/ChangeLog:

* checks/errors/privacy/rust-privacy-reporter.cc: Change call site
to accomodate new return type.
* checks/errors/privacy/rust-pub-restricted-visitor.cc: Likewise.
* util/rust-hir-map.cc (Mappings::lookup_visibility): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_macro_invocation's return type
Pierre-Emmanuel Patry [Sat, 4 May 2024 01:21:27 +0000 (03:21 +0200)] 
Change lookup_macro_invocation's return type

Wrap the function's return type within an optional and remove the out
reference argument.

gcc/rust/ChangeLog:

* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Adapt
the function call to match its new prototype.
* resolve/rust-early-name-resolver-2.0.cc (Early::insert_once):
Likewise.
(Early::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_macro_invocation): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_macro_def return type
Pierre-Emmanuel Patry [Sat, 4 May 2024 00:42:10 +0000 (02:42 +0200)] 
Change lookup_macro_def return type

Wrap the function's return type within an optional.

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::insert_once): Change
call site to accomodate the new return type.
(Early::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_macro_def): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_canonical_path's return path
Pierre-Emmanuel Patry [Fri, 3 May 2024 21:17:43 +0000 (23:17 +0200)] 
Change lookup_canonical_path's return path

Change the function's return type to wrap it within an optional.

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc: Change call site to accomodate new
return type.
* backend/rust-compile-base.h: Change parameter to use a reference.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Change call site for new return type.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit):
Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit):
Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit):
Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* util/rust-hir-map.h: Update the function's prototype and change the
function's return type.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_pattern return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 18:55:01 +0000 (20:55 +0200)] 
Change lookup_hir_pattern return type

Wrap the function's return type within an optional in order to
differentiate between a null pointer and a missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_pattern): Change call site
in order to accomodate new return type.
(Mappings::lookup_hir_pattern): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_struct_field return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 18:48:10 +0000 (20:48 +0200)] 
Change lookup_hir_struct_field return type

Wrap the function's return type within an optional to differentiate
between a null pointer and a missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_struct_field): Change
call site to accomodate new return type.
(Mappings::lookup_hir_struct_field): Change the function's return
type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_self_param return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 18:42:06 +0000 (20:42 +0200)] 
Change lookup_hir_self_param return type

Wrap the function's return type within an optional in order to
differentiate null pointers from missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_self_param): Adapt call
site to new return type.
(Mappings::lookup_hir_self_param): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_param return type with optional
Pierre-Emmanuel Patry [Fri, 3 May 2024 18:34:58 +0000 (20:34 +0200)] 
Change lookup_hir_param return type with optional

Wrap the function's return type within an optional to differentiate
between a null ppointer and a missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_param): Change call site
to accomodate new return type.
(Mappings::lookup_hir_param): Change the function's return type.
* util/rust-hir-map.h: Updat ethe function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_smt's return type with optional
Pierre-Emmanuel Patry [Fri, 3 May 2024 18:17:16 +0000 (20:17 +0200)] 
Change lookup_hir_smt's return type with optional

Wrap the function's return type within an optional in order to
differentiate missing values from null pointers.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_stmt): Change call site
to accomodate new return type.
(Mappings::lookup_hir_stmt): Change the function's return type.
(Mappings::resolve_nodeid_to_stmt): Adapt call site to new return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_type return type with an optional
Pierre-Emmanuel Patry [Fri, 3 May 2024 18:08:14 +0000 (20:08 +0200)] 
Change lookup_hir_type return type with an optional

Wrap the function's return type with an optional in order to tell
appart a null pointer from a missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_type): Change call site
to accomodate the new return type.
(Mappings::lookup_hir_type): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_generic_param return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 17:59:43 +0000 (19:59 +0200)] 
Change lookup_hir_generic_param return type

Wrap the function's return type with an optional.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_generic_param): Change
call site to accomodate the new return type.
(Mappings::lookup_hir_generic_param): Wrap the function's return type
with an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_path_expr_seg return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 17:49:44 +0000 (19:49 +0200)] 
Change lookup_hir_path_expr_seg return type

Make the function's return type optional in order to differentiate
between null pointers and missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_hir_path_expr_seg): Change
call site to accomodate the new return type.
(Mappings::lookup_hir_path_expr_seg): Wrap the function's return type
with an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_expr return type to optional
Pierre-Emmanuel Patry [Fri, 3 May 2024 17:40:18 +0000 (19:40 +0200)] 
Change lookup_hir_expr return type to optional

Wrap the function's return type with an optional in order to
differentiate missing values from null pointers.

gcc/rust/ChangeLog:

* backend/rust-mangle-v0.cc (v0_path): Adapt call site to new returned
type.
* util/rust-hir-map.cc (Mappings::lookup_hir_expr): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_implitem return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 14:30:06 +0000 (16:30 +0200)] 
Change lookup_hir_implitem return type

Wrap the return type within an optional. Now return the parent id within
a pair instead of taking an out reference.

gcc/rust/ChangeLog:

* backend/rust-compile-item.cc (CompileItem::visit): Change call site
to accept new return type.
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_implitem): Likewise.
(Mappings::lookup_hir_implitem): Change return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type to optional in get_lang_item
Pierre-Emmanuel Patry [Fri, 3 May 2024 12:54:06 +0000 (14:54 +0200)] 
Change return type to optional in get_lang_item

Wrap the function's return type with an optional.

gcc/rust/ChangeLog:

* typecheck/rust-autoderef.cc: Adapt calling code to new return type.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_operator_overload): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_builtin_candidate):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::get_lang_item): Change return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_module function return type
Pierre-Emmanuel Patry [Fri, 3 May 2024 11:25:20 +0000 (13:25 +0200)] 
Change lookup_module function return type

Wrap the return type into an optional.

gcc/rust/ChangeLog:

* checks/errors/privacy/rust-visibility-resolver.cc: Update function
call to match the new return type.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
* util/rust-hir-map.cc (Mappings::insert_module): Likewise.
(Mappings::lookup_module): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_extern_item return type
Pierre-Emmanuel Patry [Thu, 2 May 2024 11:44:10 +0000 (13:44 +0200)] 
Change lookup_hir_extern_item return type

Wrap the return type with an optional and make the return type a pair
with the parent hid.

gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt code around new return type.
* checks/errors/rust-const-checker.cc (ConstChecker::check_function_call):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_use_of_static):
Likewise.
(UnsafeChecker::check_function_call): Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_extern_item): Likewise.
(Mappings::lookup_hir_extern_item): Change return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of lookup trait defid functions.
Pierre-Emmanuel Patry [Thu, 2 May 2024 10:33:20 +0000 (12:33 +0200)] 
Change return type of lookup trait defid functions.

Wrap the return type with an optional.

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Update code around lookup return type.
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output):
Likewise.
* util/rust-hir-map.cc (Mappings::insert_defid_mapping): Likewise.
(Mappings::lookup_trait_item_defid): Update return type with an
optional.
(Mappings::get_lang_item): Likewise.
* util/rust-hir-map.h: Update the functions prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_local_defid return type to optional
Pierre-Emmanuel Patry [Thu, 2 May 2024 09:43:02 +0000 (11:43 +0200)] 
Change lookup_local_defid return type to optional

Make the API more convenient by changing the function's return type. We
can now differentiate between a stored null pointer and a missing value.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::insert_defid_mapping): Adapt call
to new return type.
(Mappings::insert_local_defid_mapping): Likewise.
(Mappings::lookup_local_defid): Change return type to wrap it with an
optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of lookup_defid
Pierre-Emmanuel Patry [Fri, 26 Apr 2024 10:02:53 +0000 (12:02 +0200)] 
Change return type of lookup_defid

Change the return type to an optional.

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Change calling code to accomodate new return type.
* checks/errors/privacy/rust-privacy-reporter.cc:
Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate):
Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_builtin_candidate):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_defid): Change function's
return type.
* util/rust-hir-map.h: Update function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange crate name retrieval function return types
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 14:34:44 +0000 (16:34 +0200)] 
Change crate name retrieval function return types

Change their return type to a const reference in order to avoid copies
when possible. Also wrap this new return type into an optional.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Adapt the code to the new return types.
* resolve/rust-ast-resolve.cc (NameResolution::go): Likewise.
* util/rust-hir-map.cc (Mappings::get_crate_name): Change return type
to const string reference optional.
(Mappings::get_current_crate_name): Likewise.
* util/rust-hir-map.h: Update function prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange crate_num_to_nodeid return type
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 14:15:42 +0000 (16:15 +0200)] 
Change crate_num_to_nodeid return type

Change the function's return type to an optional.

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-toplevel.h: Adapt the code to the new
return type.
* rust-session-manager.cc (Session::load_extern_crate): Likewise.
* util/rust-hir-map.cc (Mappings::crate_num_to_nodeid): Change the
return type.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of lookup_crate_name
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 14:00:23 +0000 (16:00 +0200)] 
Change return type of lookup_crate_name

Change the function's return type to use an optional.

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-toplevel.h: Adapt the code to the new
return type.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* rust-session-manager.cc (Session::load_extern_crate): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_crate_name): Change the return
type to an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of lookup_impl_block_type
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 13:39:33 +0000 (15:39 +0200)] 
Change return type of lookup_impl_block_type

Change the return type to an optional.

gcc/rust/ChangeLog:

* typecheck/rust-type-util.cc (query_type): Adapt code to accomodate
the new return type.
* util/rust-hir-map.cc (Mappings::lookup_impl_block_type): Change
the function's return type and remove the out pointer argument.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type for lookup_hir_impl_block
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 13:28:32 +0000 (15:28 +0200)] 
Change return type for lookup_hir_impl_block

Change the return type to an optiona. This allows to differentiate
between missing hir impl block and null pointers.

gcc/rust/ChangeLog:

* typecheck/rust-type-util.cc (query_type): Change call to the function
in order to accomodate the new return type.
* util/rust-hir-map.cc (Mappings::lookup_hir_impl_block): Change the
function's return type to an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of lookup_hir_extern_block
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 13:14:36 +0000 (15:14 +0200)] 
Change return type of lookup_hir_extern_block

Change the return type to an optional in order to easily differentiate
between a null pointer and an missing value.

gcc/rust/ChangeLog:

* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_function_call):
Adapt function call to new return type.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_extern_block): Likewise.
(Mappings::lookup_hir_extern_block): Change return type to an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of lookup_hir_trait_item
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 12:54:23 +0000 (14:54 +0200)] 
Change return type of lookup_hir_trait_item

Change the return type to an optional instead of returning a null
pointer. This allows easier tracking of rogue null pointers in the
map. This commit also fixes a bug in trait associated function mangling,
the function was using an already invalidated pointer.

gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt return type to new optional.
* backend/rust-mangle-v0.cc (v0_function_path): Change prototype to use
the generic arguments vector instead of the whole HIR function.
(v0_path): Fix a bug with a null pointer being used to create the
trait function mangling.
* util/rust-hir-map.cc (Mappings::insert_hir_trait_item): Adapt code
to new return type.
(Mappings::lookup_hir_trait_item): Change the return type of the
function to an optional.
* util/rust-hir-map.h: Update the function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type for lookup_hir_item to optional
Pierre-Emmanuel Patry [Thu, 25 Apr 2024 08:48:47 +0000 (10:48 +0200)] 
Change return type for lookup_hir_item to optional

gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt function call to new return type.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::check_function_call):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_use_of_static):
Likewise.
(UnsafeChecker::check_function_call): Likewise.
(UnsafeChecker::check_function_attr): Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_item): Likewise.
(Mappings::lookup_hir_item): Change function return type to use
optional.
* util/rust-hir-map.h: Update function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange return type of resolve_nodeid_to_stmt
Pierre-Emmanuel Patry [Wed, 24 Apr 2024 21:21:57 +0000 (23:21 +0200)] 
Change return type of resolve_nodeid_to_stmt

Change the return type to an optional.

gcc/rust/ChangeLog:

* util/rust-hir-map.cc (Mappings::resolve_nodeid_to_stmt): Change the
return type and remove pointer out argument.
* util/rust-hir-map.h: Update function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_hir_to_node return type to optional
Pierre-Emmanuel Patry [Wed, 24 Apr 2024 20:32:54 +0000 (22:32 +0200)] 
Change lookup_hir_to_node return type to optional

Optional are more convenient to use and avoid uninitialized data.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
Adapt code for new optional return type.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_hir_to_node): Change return
type to an optional.
* util/rust-hir-map.h: Adapt function prototype with the new return
type.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoChange lookup_node_to_hir return type to optional
Pierre-Emmanuel Patry [Wed, 24 Apr 2024 19:27:26 +0000 (21:27 +0200)] 
Change lookup_node_to_hir return type to optional

Previous API was using a boolean and a pointer, this was not practical
and could be replaced with an optional.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): Change call to use
the returned optional.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc:
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise.
(MarkLive::visit_path_segment): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_node_to_hir): Return an
optional instead of a boolean.
* util/rust-hir-map.h: Change function prototype to match the new
return type.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
14 months agoVisit constant items without expressions properly
Owen Avery [Thu, 29 Feb 2024 01:19:04 +0000 (20:19 -0500)] 
Visit constant items without expressions properly

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc
(DefaultResolver::visit):
Verify constant item has expression before attempting to visit
the later.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
14 months agoImprove matching on non-enum ADTs
Owen Avery [Fri, 3 May 2024 00:58:49 +0000 (20:58 -0400)] 
Improve matching on non-enum ADTs

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc
(check_match_scrutinee): Add assertion.
* backend/rust-compile-pattern.cc
(CompilePatternCheckExpr::visit):
Handle HIR::PathInExpression matching a non-enum.

gcc/testsuite/ChangeLog:

* rust/compile/match-struct-path.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
14 months agoAdd testcases for handling struct as scrutinee for match expr
Nobel Singh [Tue, 23 Apr 2024 20:22:52 +0000 (02:07 +0545)] 
Add testcases for handling struct as scrutinee for match expr

gcc/testsuite/ChangeLog:

* rust/compile/issue-2906.rs: New test.
* rust/execute/torture/issue-2906.rs: New test.

Signed-off-by: Nobel Singh <nobel2073@gmail.com>
14 months agoHandle structs as scrutinee for match expressions
Nobel Singh [Sun, 21 Apr 2024 18:41:12 +0000 (00:26 +0545)] 
Handle structs as scrutinee for match expressions

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (check_match_scrutinee): Handle structs

Signed-off-by: Nobel Singh <nobel2073@gmail.com>
14 months agoRemove unused Context parameter for some backend methods
Owen Avery [Thu, 25 Apr 2024 16:19:51 +0000 (12:19 -0400)] 
Remove unused Context parameter for some backend methods

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc
(HIRCompileBase::compile_function_body):
Adjust unit_expression calls.
(HIRCompileBase::unit_expression):
Remove unused Context parameter.
* backend/rust-compile-base.h
(HIRCompileBase::unit_expression): Likewise.
* backend/rust-compile-block.cc
(CompileBlock::visit): Adjust unit_expression calls.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Likewise.
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::attempt_constructor_expression_lookup):
Likewise.
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.
(TyTyResolveCompile::visit):
Adjust get_implicit_enumeral_node_type and get_unit_type calls.
* backend/rust-compile-type.h
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
14 months agolibformat_parser: Lower minimum Rust version to 1.49
Arthur Cohen [Tue, 23 Apr 2024 12:13:21 +0000 (14:13 +0200)] 
libformat_parser: Lower minimum Rust version to 1.49

libgrust/ChangeLog:

* libformat_parser/Cargo.toml: Change Rust edition from 2021 to 2018.
* libformat_parser/generic_format_parser/Cargo.toml: Likewise.
* libformat_parser/generic_format_parser/src/lib.rs: Remove usage of
then-unstable std features and language constructs.
* libformat_parser/src/lib.rs: Likewise, plus provide extension trait
for String::leak.

15 months agoChange singleton returned type to a reference
Pierre-Emmanuel Patry [Wed, 24 Apr 2024 08:51:13 +0000 (10:51 +0200)] 
Change singleton returned type to a reference

We do not need a raw pointer for this singleton,
nor we need having it on the heap through a
smart pointer.

gcc/rust/ChangeLog:

* ast/rust-ast.h: Change dereference from a pointer to a reference
accessor.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Likewise.
* backend/rust-compile-context.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.
* backend/rust-compile-intrinsic.cc (Intrinsics::compile): Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
(HIRCompileBase::query_compile): Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
(TyTyResolveCompile::create_dyn_obj_record): Likewise.
* backend/rust-compile.cc (HIRCompileBase::coerce_to_dyn_object):
Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
(v0_mangle_item): Likewise.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Likewise.
* checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve):
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::ConstChecker):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::UnsafeChecker):
Likewise.
* checks/lints/rust-lint-marklive-base.h: Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
(MarkLive::visit_path_segment): Likewise.
* checks/lints/rust-lint-marklive.h: Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Change mapping
from pointer to a reference.
* expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Replace
pointer accessor with reference accessor.
(AttributeProcMacro::AttributeProcMacro): Likewise.
(CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_lifetime):
Likewise.
(ASTLoweringBase::lower_loop_label): Likewise.
(ASTLoweringBase::lower_path_expr_seg): Likewise.
(ASTLoweringBase::lower_self): Likewise.
(ASTLoweringBase::handle_lang_item_attribute): Likewise.
(ASTLoweringBase::lower_extern_block): Likewise.
(ASTLoweringBase::lower_macro_definition): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-block.h: Likewise.
* hir/rust-ast-lower-enumitem.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise.
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate):
Likewise.
(ASTLowerImplItem::visit): Likewise.
(ASTLowerTraitItem::translate): Likewise.
(ASTLowerTraitItem::visit): Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise.
(ASTLoweringItem::visit): Likewise.
(ASTLoweringSimplePath::lower): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate):
Likewise.
(ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): Likewise.
(ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-struct-field-expr.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::translate): Likewise.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::translate): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
* hir/rust-ast-lower.cc (ASTLowering::go): Likewise.
(ASTLoweringBlock::visit): Likewise.
(ASTLoweringIfBlock::visit): Likewise.
(ASTLoweringIfLetBlock::visit): Likewise.
(ASTLowerStructExprField::visit): Likewise.
(ASTLoweringExprWithBlock::visit): Likewise.
(ASTLowerPathInExpression::visit): Likewise.
(ASTLoweringBase::lower_qual_path_type): Likewise.
(ASTLowerQualPathInExpression::visit): Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_trait):
Likewise.
(ExportContext::emit_function): Likewise.
(ExportContext::emit_macro): Likewise.
(PublicInterface::PublicInterface): Likewise.
(PublicInterface::expected_metadata_filename): Likewise.
* metadata/rust-export-metadata.h: Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::visit): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::NameResolution):
Likewise.
(NameResolution::go): Likewise.
* resolve/rust-ast-resolve.h: Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver):
Likewise.
* resolve/rust-late-name-resolver-2.0.cc (next_node_id): Likewise.
(next_hir_id): Likewise.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::NameResolutionContext):
Likewise.
* resolve/rust-name-resolver.cc (Resolver::Resolver): Likewise.
(Resolver::generate_builtins): Likewise.
(Resolver::setup_builtin): Likewise.
* resolve/rust-name-resolver.h: Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
(TopLevel::handle_use_glob): Likewise.
* rust-session-manager.cc (Session::get_instance): Likewise.
(Session::handle_input_files): Likewise.
(Session::handle_crate_name): Likewise.
(Session::compile_crate): Likewise.
(Session::load_extern_crate): Likewise.
* rust-session-manager.h: Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_unsize_type): Likewise.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion):
Likewise.
(TypeCoercionRules::coerce_unsafe_ptr): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
(TypeCoercionRules::coerce_unsized): Likewise.
* typecheck/rust-coercion.h: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::process_enum_item_for_candiates):
Likewise.
(PathProbeType::process_impl_items_for_candidates): Likewise.
(PathProbeImplTrait::process_trait_impl_items_for_candidates):
Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
(TraitItemReference::get_parent_trait_mappings): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal):
Likewise.
(TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit):
Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_operator_overload): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::emit_pattern_size_error):
Likewise.
(ClosureParamInfer::Resolve): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
(TypeResolveGenericParam::visit): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::override_context):
Likewise.
(SubstitutionRef::monomorphize): Likewise.
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_infer_var):
Likewise.
(TyVar::monomorphized_clone): Likewise.
(TyWithLocation::TyWithLocation): Likewise.
* typecheck/rust-tyty.cc (BaseType::satisfies_bound): Likewise.
(InferType::clone): Likewise.
(ADTType::handle_substitions): Likewise.
(TupleType::handle_substitions): Likewise.
(FnType::handle_substitions): Likewise.
(ClosureType::setup_fn_once_output): Likewise.
(ArrayType::handle_substitions): Likewise.
(SliceType::handle_substitions): Likewise.
(ReferenceType::handle_substitions): Likewise.
(PointerType::handle_substitions): Likewise.
(ParamType::handle_substitions): Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-unify.cc (UnifyRules::UnifyRules): Likewise.
(UnifyRules::commit): Likewise.
* util/rust-hir-map.cc: Change getter return type to a reference.
* util/rust-hir-map.h: Update function's prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
15 months agoRemove unnecessary SIDE_EFFECTS/READONLY macros
Mael Cravero [Tue, 30 Apr 2024 10:04:50 +0000 (12:04 +0200)] 
Remove unnecessary SIDE_EFFECTS/READONLY macros

Closes #2357

gcc/rust/ChangeLog:

* rust-gcc.cc: remove unnecessary TREE_SIDE_EFFECTS and TREE_READONLY
macros used in arithmetic overflow checks.

Signed-off-by: Mael Cravero <mael.cravero@embecosm.com>
15 months agoborrowck: Use std::ignore
Jakub Dupak [Wed, 24 Apr 2024 12:32:48 +0000 (14:32 +0200)] 
borrowck: Use std::ignore

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Use std::ignore.

15 months agoborrowck: Testsuite
Jakub Dupak [Wed, 24 Apr 2024 11:47:20 +0000 (13:47 +0200)] 
borrowck: Testsuite

gcc/testsuite/ChangeLog:

* rust/borrowck/borrowck.exp: New test.
* rust/borrowck/position_dependant_outlives.rs: New test.
* rust/borrowck/reference.rs: New test.
* rust/borrowck/return_ref_to_local.rs: New test.
* rust/borrowck/subset.rs: New test.
* rust/borrowck/test_move.rs: New test.
* rust/borrowck/test_move_behind_reference.rs: New test.
* rust/borrowck/test_move_conditional.rs: New test.
* rust/borrowck/tmp.rs: New test.
* rust/borrowck/use_while_mut.rs: New test.
* rust/borrowck/use_while_mut_fr.rs: New test.
* rust/borrowck/well_formed_function_inputs.rs: New test.

15 months agoborrowck: Polonius error reporting
Jakub Dupak [Tue, 27 Feb 2024 23:01:28 +0000 (00:01 +0100)] 
borrowck: Polonius error reporting

gcc/rust/ChangeLog:

* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: Error reporting.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Error reporting.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h (struct FactsView):
Error reporting.
(struct Output): Error reporting.
* checks/errors/borrowck/polonius/rust-polonius.h (struct Facts): Error reporting.
* checks/errors/borrowck/rust-borrow-checker.cc: Error reporting.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
15 months agoborrowck: Link Polonius and run it
Jakub Dupak [Tue, 27 Feb 2024 22:59:36 +0000 (23:59 +0100)] 
borrowck: Link Polonius and run it

gcc/rust/ChangeLog:

* Make-lang.in: Link Polonius.
* checks/errors/borrowck/rust-borrow-checker.cc: Run Polonius.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
15 months agoborrowck: Build Polonius automatically
Jakub Dupak [Tue, 27 Feb 2024 23:08:01 +0000 (00:08 +0100)] 
borrowck: Build Polonius automatically

This is minimalistic version to build Polonius with Cargo.

gcc/rust/ChangeLog:

* Make-lang.in: Build Polonius.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
15 months agoborrowck: Polonius dump
Jakub Dupak [Tue, 27 Feb 2024 22:52:53 +0000 (23:52 +0100)] 
borrowck: Polonius dump

gcc/rust/ChangeLog:

* checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint):
Polonius facts dump.
(struct Facts): Polonius facts dump.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go):
Polonius facts dump.
(Dump::visit): Polonius facts dump.
(Dump::visit_place): Polonius facts dump.
(Dump::visit_move_place): Polonius facts dump.
(Dump::visit_scope): Polonius facts dump.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Polonius facts dump.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
15 months agoRemoved obsolete objects
Kushal Pal [Wed, 24 Apr 2024 06:04:53 +0000 (06:04 +0000)] 
Removed obsolete objects

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): Lines
removed as the objects are unused.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
15 months agoPin macos CI to version 13
Pierre-Emmanuel Patry [Tue, 30 Apr 2024 11:16:36 +0000 (13:16 +0200)] 
Pin macos CI to version 13

Latest macos environment runs on arm and is thus
incompatible with gcc.

ChangeLog:

* .github/workflows/ccpp.yml: Pin macos runner
version.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
15 months agoRemove redundant macro definition
zhanghe9702 [Sun, 24 Mar 2024 08:48:56 +0000 (16:48 +0800)] 
Remove redundant macro definition

gcc/rust/ChangeLog:
* backend/rust-tree.h: removing the CLASSTYPE_VBASECLASSES macro
which is duplicated three times.

Signed-off-by: Zhang He <zhanghe9702@163.com>
15 months agoAdd a test for inherent impl type name resolve
Pierre-Emmanuel Patry [Thu, 18 Apr 2024 20:39:47 +0000 (22:39 +0200)] 
Add a test for inherent impl type name resolve

A previous bug with name resolution 2.0 was caused by an incorrectly
resolved inherent impl name. This test shall highlight the behavior
and prevent regression.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
15 months agoVisit type during resolution of inherent impl
Pierre-Emmanuel Patry [Thu, 18 Apr 2024 20:30:56 +0000 (22:30 +0200)] 
Visit type during resolution of inherent impl

Inherent impl has a type it applies to. This type
was not visited and thus not resolved.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
inherent impl type.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
15 months agoRust: Move 'libformat_parser' build into libgrust
Thomas Schwinge [Thu, 29 Feb 2024 07:44:49 +0000 (08:44 +0100)] 
Rust: Move 'libformat_parser' build into libgrust

Addresses #2883.

contrib/
* gcc_update (files_and_dependencies): Update for
'libformat_parser' in libgrust.
gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser'
build in libgrust.
(%.toml:, $(LIBFORMAT_PARSER):): Remove.
libgrust/
* libformat_parser/Makefile.am: New.
* Makefile.am [!TARGET_LIBRARY] (SUBDIRS): Add 'libformat_parser'.
* configure.ac: Handle it.
(TARGET_LIBRARY): New 'AM_CONDITIONAL'.
* libformat_parser/Makefile.in: Generate.
* Makefile.in: Regenerate.
* configure: Likewise.

15 months agoRust: Move 'libformat_parser' build into the GCC build directory
Thomas Schwinge [Wed, 28 Feb 2024 22:26:39 +0000 (23:26 +0100)] 
Rust: Move 'libformat_parser' build into the GCC build directory

Fixes #2883.

* .gitignore: Remove 'libgrust/*/target/'.
gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build
directory.
* ($(LIBFORMAT_PARSER)): Build in the GCC build directory.

15 months agoRust: Don't cache 'libformat_parser.a'
Thomas Schwinge [Wed, 28 Feb 2024 22:02:19 +0000 (23:02 +0100)] 
Rust: Don't cache 'libformat_parser.a'

gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact.
($(LIBFORMAT_PARSER)): Don't cache it.

15 months agoInline 'gcc/rust/Make-lang.in:RUST_LIBDEPS'
Thomas Schwinge [Wed, 28 Feb 2024 22:06:25 +0000 (23:06 +0100)] 
Inline 'gcc/rust/Make-lang.in:RUST_LIBDEPS'

gcc/rust/
* Make-lang.in (RUST_LIBDEPS): Inline into all users.

15 months agoAdd 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER'
Thomas Schwinge [Wed, 28 Feb 2024 21:51:24 +0000 (22:51 +0100)] 
Add 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER'

... to avoid verbatim repetition.

gcc/rust/
* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
(RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it.

15 months agoAdd 'gcc/rust/Make-lang.in:LIBPROC_MACRO_INTERNAL'
Thomas Schwinge [Wed, 28 Feb 2024 21:51:24 +0000 (22:51 +0100)] 
Add 'gcc/rust/Make-lang.in:LIBPROC_MACRO_INTERNAL'

... to avoid verbatim repetition.

gcc/rust/
* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
(RUST_LIBDEPS, crab1$(exeext)): Use it.

15 months agoInline 'gcc/rust/Make-lang.in:RUST_LDFLAGS'
Thomas Schwinge [Wed, 28 Feb 2024 21:45:18 +0000 (22:45 +0100)] 
Inline 'gcc/rust/Make-lang.in:RUST_LDFLAGS'

Unused.

gcc/rust/
* Make-lang.in (RUST_LDFLAGS): Inline into all users.

15 months agoRemove 'libgrust/libproc_macro_internal' from 'gcc/rust/Make-lang.in:RUST_LDFLAGS'
Thomas Schwinge [Wed, 28 Feb 2024 21:41:42 +0000 (22:41 +0100)] 
Remove 'libgrust/libproc_macro_internal' from 'gcc/rust/Make-lang.in:RUST_LDFLAGS'

This isn't necessary, as the full path to 'libproc_macro_internal.a' is
specified.

gcc/rust/
* Make-lang.in (RUST_LDFLAGS): Remove
'libgrust/libproc_macro_internal'.

15 months agoRemove 'libgrust/librustc_format_parser' from 'gcc/rust/Make-lang.in:RUST_LDFLAGS'
Thomas Schwinge [Wed, 28 Feb 2024 21:39:52 +0000 (22:39 +0100)] 
Remove 'libgrust/librustc_format_parser' from 'gcc/rust/Make-lang.in:RUST_LDFLAGS'

That directory doesn't even exist.

gcc/rust/
* Make-lang.in (RUST_LDFLAGS): Remove
'libgrust/librustc_format_parser'.

15 months agochore: Fix Remark CI
Arthur Cohen [Fri, 12 Apr 2024 15:10:40 +0000 (17:10 +0200)] 
chore: Fix Remark CI

ChangeLog:

* CONTRIBUTING.md: Fix invalid line length.
* README.md: Likewise.

15 months agorust: Add --offline flag to cargo when building Rust components.
Arthur Cohen [Tue, 9 Apr 2024 11:43:01 +0000 (13:43 +0200)] 
rust: Add --offline flag to cargo when building Rust components.

gcc/rust/ChangeLog:

* Make-lang.in: Add --offline flag to cargo invocation.

15 months agolibgrust: Vendor Rust dependencies
Arthur Cohen [Tue, 9 Apr 2024 11:32:31 +0000 (13:32 +0200)] 
libgrust: Vendor Rust dependencies

This commits vendors and locks our dependencies so that our Rust components
do not need internet access to be built anymore. Tested in a docker container
with no network access.

We can think about merging the vendor directory once we have more than one
Rust component, e.g. when we add polonius to the mix.

libgrust/ChangeLog:

* libformat_parser/.cargo/config: New file.
* libformat_parser/vendor.NOTES: New file.
* libformat_parser/vendor/libc/.cargo-checksum.json: New file.
* libformat_parser/vendor/libc/CONTRIBUTING.md: New file.
* libformat_parser/vendor/libc/Cargo.toml: New file.
* libformat_parser/vendor/libc/LICENSE-APACHE: New file.
* libformat_parser/vendor/libc/LICENSE-MIT: New file.
* libformat_parser/vendor/libc/README.md: New file.
* libformat_parser/vendor/libc/build.rs: New file.
* libformat_parser/vendor/libc/rustfmt.toml: New file.
* libformat_parser/vendor/libc/src/fixed_width_ints.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/align.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/mod.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/no_align.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/hermit/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/hermit/mod.rs: New file.
* libformat_parser/vendor/libc/src/hermit/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/lib.rs: New file.
* libformat_parser/vendor/libc/src/macros.rs: New file.
* libformat_parser/vendor/libc/src/psp.rs: New file.
* libformat_parser/vendor/libc/src/sgx.rs: New file.
* libformat_parser/vendor/libc/src/solid/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/solid/arm.rs: New file.
* libformat_parser/vendor/libc/src/solid/mod.rs: New file.
* libformat_parser/vendor/libc/src/switch.rs: New file.
* libformat_parser/vendor/libc/src/teeos/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/aix/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/aix/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/long_array.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/b32.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/native.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/b32.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/lfs64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/lfs64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/espidf/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/generic.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/horizon/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/powerpc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/vita/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/neutrino.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/redox/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/compat.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/illumos.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/solaris.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/x86_common.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/arm.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/mod.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/x86.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/wasi.rs: New file.
* libformat_parser/vendor/libc/src/windows/gnu/align.rs: New file.
* libformat_parser/vendor/libc/src/windows/gnu/mod.rs: New file.
* libformat_parser/vendor/libc/src/windows/mod.rs: New file.
* libformat_parser/vendor/libc/src/windows/msvc/mod.rs: New file.
* libformat_parser/vendor/libc/src/xous.rs: New file.
* libformat_parser/vendor/libc/tests/const_fn.rs: New file.
* libformat_parser/vendor/unicode-xid/.cargo-checksum.json: New file.
* libformat_parser/vendor/unicode-xid/COPYRIGHT: New file.
* libformat_parser/vendor/unicode-xid/Cargo.toml: New file.
* libformat_parser/vendor/unicode-xid/LICENSE-APACHE: New file.
* libformat_parser/vendor/unicode-xid/LICENSE-MIT: New file.
* libformat_parser/vendor/unicode-xid/README.md: New file.
* libformat_parser/vendor/unicode-xid/benches/xid.rs: New file.
* libformat_parser/vendor/unicode-xid/src/lib.rs: New file.
* libformat_parser/vendor/unicode-xid/src/tables.rs: New file.
* libformat_parser/vendor/unicode-xid/src/tests.rs: New file.
* libformat_parser/vendor/unicode-xid/tests/exhaustive_tests.rs: New file.

15 months agoMerge commit '013b520529d5f1bddec27dd921eab5e917663693' into HEAD [#2944]
Thomas Schwinge [Wed, 10 Apr 2024 13:49:21 +0000 (15:49 +0200)] 
Merge commit '013b520529d5f1bddec27dd921eab5e917663693' into HEAD [#2944]

This resolves #2802 "Merge gcc/trunk into us".

15 months agoAdjust '.github/bors_log_expected_warnings'
Thomas Schwinge [Wed, 10 Apr 2024 12:34:26 +0000 (14:34 +0200)] 
Adjust '.github/bors_log_expected_warnings'

15 months agoMerge commit 'f5a805d82902fe2d6e0a7af8c0e6519f9d25a8f3' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 09:07:18 +0000 (11:07 +0200)] 
Merge commit 'f5a805d82902fe2d6e0a7af8c0e6519f9d25a8f3' into HEAD

15 months agoMerge commit '767698ff6c8f07047ad90bef89f3dc4c4515f0df' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 09:05:52 +0000 (11:05 +0200)] 
Merge commit '767698ff6c8f07047ad90bef89f3dc4c4515f0df' into HEAD

15 months agoMerge commit '8534cc772def8142379c0e72ab6392d40f3f60f6^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 09:05:29 +0000 (11:05 +0200)] 
Merge commit '8534cc772def8142379c0e72ab6392d40f3f60f6^' into HEAD

15 months agoMerge commit 'f0b1cf01782ba975cfda32800c91076df78058d6' into HEAD [#2857]
Thomas Schwinge [Wed, 10 Apr 2024 09:02:28 +0000 (11:02 +0200)] 
Merge commit 'f0b1cf01782ba975cfda32800c91076df78058d6' into HEAD [#2857]

15 months agoMerge commit 'f0b1cf01782ba975cfda32800c91076df78058d6^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 09:01:28 +0000 (11:01 +0200)] 
Merge commit 'f0b1cf01782ba975cfda32800c91076df78058d6^' into HEAD

15 months agoMerge commit 'af3f0482367232d2d655e51bee382e98ddbfb117' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:56:34 +0000 (10:56 +0200)] 
Merge commit 'af3f0482367232d2d655e51bee382e98ddbfb117' into HEAD

15 months agoMerge commit 'f89186f962421f6d972035fc4b4c20490e7b1c5b^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:55:56 +0000 (10:55 +0200)] 
Merge commit 'f89186f962421f6d972035fc4b4c20490e7b1c5b^' into HEAD

15 months agoMerge commit '2a9881565c7b48d04cf891666a66a1a2e560bce8' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:55:46 +0000 (10:55 +0200)] 
Merge commit '2a9881565c7b48d04cf891666a66a1a2e560bce8' into HEAD

15 months agoMerge commit 'ceed844b5284aeabbdfe25ccf099e7ebeeb14a9b^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:55:10 +0000 (10:55 +0200)] 
Merge commit 'ceed844b5284aeabbdfe25ccf099e7ebeeb14a9b^' into HEAD

15 months agoMerge commit '2341df1cb9b3681bfefe29207887b2b3dc271a95' into HEAD [#2801]
Thomas Schwinge [Wed, 10 Apr 2024 08:52:58 +0000 (10:52 +0200)] 
Merge commit '2341df1cb9b3681bfefe29207887b2b3dc271a95' into HEAD [#2801]

15 months agoMerge commit '2341df1cb9b3681bfefe29207887b2b3dc271a95^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:51:48 +0000 (10:51 +0200)] 
Merge commit '2341df1cb9b3681bfefe29207887b2b3dc271a95^' into HEAD

15 months agoMerge commit 'e621b174d7c622aa4b677a4c812e5061e311cc5c' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:48:27 +0000 (10:48 +0200)] 
Merge commit 'e621b174d7c622aa4b677a4c812e5061e311cc5c' into HEAD

15 months agoMerge commit 'a5258f3a11ab577835ef5e93be5cb65ec9e44132^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:45:56 +0000 (10:45 +0200)] 
Merge commit 'a5258f3a11ab577835ef5e93be5cb65ec9e44132^' into HEAD

15 months agoMerge commit '4bd09ce06f50d266c992c984cc993384d5e6655e' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:45:29 +0000 (10:45 +0200)] 
Merge commit '4bd09ce06f50d266c992c984cc993384d5e6655e' into HEAD

15 months agoMerge commit '7a6906c8d80e437a97c780370a8fec4e00561c7b' into HEAD [#2288]
Thomas Schwinge [Wed, 10 Apr 2024 08:43:34 +0000 (10:43 +0200)] 
Merge commit '7a6906c8d80e437a97c780370a8fec4e00561c7b' into HEAD [#2288]

15 months agoMerge commit 'fc59a3995cb46c190c0efb0431ad204e399975c4' into HEAD [#2183]
Thomas Schwinge [Wed, 10 Apr 2024 08:34:02 +0000 (10:34 +0200)] 
Merge commit 'fc59a3995cb46c190c0efb0431ad204e399975c4' into HEAD [#2183]

15 months agoMerge commit 'fc59a3995cb46c190c0efb0431ad204e399975c4^' into HEAD
Thomas Schwinge [Wed, 10 Apr 2024 08:20:22 +0000 (10:20 +0200)] 
Merge commit 'fc59a3995cb46c190c0efb0431ad204e399975c4^' into HEAD

15 months agoFix grammar as pointed out by Marc
Jasmine Tang [Fri, 5 Apr 2024 09:25:48 +0000 (02:25 -0700)] 
Fix grammar as pointed out by Marc

ChangeLog:

* README.md (gccrs-workspace]): like-wise.

15 months agoAdd an alternative solution on MacOS
Jasmine Tang [Fri, 5 Apr 2024 03:02:26 +0000 (20:02 -0700)] 
Add an alternative solution on MacOS

For #2937.
ChangeLog:

* README.md (gccrs-workspace]): like-wise.

16 months agoborrowck: Bump copyright notice
Jakub Dupak [Wed, 3 Apr 2024 08:30:15 +0000 (10:30 +0200)] 
borrowck: Bump copyright notice

gcc/rust/ChangeLog:

* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Bump copyright.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Bump copyright.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h: Bump copyright.
* checks/errors/borrowck/polonius/rust-polonius.h: Bump copyright.
* checks/errors/borrowck/rust-bir-dump.cc: Bump copyright.
* checks/errors/borrowck/rust-bir-fact-collector.h: Bump copyright.
* checks/errors/borrowck/rust-bir-free-region.h: Bump copyright.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Remove block braces to satisfy GNU style
Jakub Dupak [Mon, 1 Apr 2024 12:06:33 +0000 (14:06 +0200)] 
borrowck: Remove block braces to satisfy GNU style

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc (renumber_places):
Remove unecessary braces.
(Dump::go): Remove unecessary braces.
(Dump::visit): Remove unecessary braces.
(Dump::visit_scope): Remove unecessary braces.
* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
Remove unecessary braces.
(points): Remove unecessary braces.
* checks/errors/borrowck/rust-bir-free-region.h: Remove unecessary braces.
* checks/errors/borrowck/rust-bir-place.h: Remove unecessary braces.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Remove unecessary braces.
* checks/errors/borrowck/rust-function-collector.h: Remove unecessary braces.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Fact collector
Jakub Dupak [Tue, 27 Feb 2024 22:19:41 +0000 (23:19 +0100)] 
borrowck: Fact collector

This is the main Polonius based logic which creates the information
Polonius needs from BIR. It is largly guessed and rever engineered, so
some aspects are probably wrong.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-fact-collector.h: New file.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Enable fact collection.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Regions in BIR
Jakub Dupak [Tue, 27 Feb 2024 22:01:14 +0000 (23:01 +0100)] 
borrowck: Regions in BIR

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-place.h (struct Lifetime):
Extended regions and loans.
(struct Loan): Representation of loan (result of borrowing)
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Fix let stmt handling.
* checks/errors/borrowck/rust-bir-builder-pattern.h: improved
pattern translation
* checks/errors/borrowck/rust-bir-builder-internal.h: region binding
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h (class ExprStmtBuilder):
Region support.
(class RenumberCtx): Region support.
* checks/errors/borrowck/rust-bir-builder.h (class Builder): Region support.
* checks/errors/borrowck/rust-bir-dump.cc (get_lifetime_name): Region support.
(renumber_places): Region support.
(Dump::go): Region support.
(Dump::visit): Region support.
(Dump::visit_lifetime): Region support.
(Dump::visit_scope): Region support.
* checks/errors/borrowck/rust-bir.h (class AbstractExpr): Region support.
(struct Function): Region support.
(class BorrowExpr): Region support.
(class CallExpr): Region support.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: extract regions from types using VA
Jakub Dupak [Tue, 27 Feb 2024 20:31:07 +0000 (21:31 +0100)] 
borrowck: extract regions from types using VA

Biggybag on variance analysis to extract regions of fields from ADT
regions.

gcc/rust/ChangeLog:

* typecheck/rust-tyty-variance-analysis-private.h (class FieldVisitorCtx):
Region extraction.
* typecheck/rust-tyty-variance-analysis.cc (query_field_regions): Region extraction.
(FieldVisitorCtx::collect_regions): Region extraction.
(FieldVisitorCtx::add_constraints_from_ty): Region extraction.
(FieldVisitorCtx::add_constraints_from_region): Region
extraction.
(FieldVisitorCtx::add_constrints_from_param): Region extraction.
* typecheck/rust-tyty-variance-analysis.h (query_field_regions):
Region extraction.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Free region representation
Jakub Dupak [Tue, 27 Feb 2024 20:07:03 +0000 (21:07 +0100)] 
borrowck: Free region representation

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-free-region.h: New file.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Polonius FFI
Jakub Dupak [Tue, 27 Feb 2024 19:59:58 +0000 (20:59 +0100)] 
borrowck: Polonius FFI

Rust part is not build and not invoked at this point.

gcc/rust/ChangeLog:

* checks/errors/borrowck/ffi-polonius/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: New file.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: New file.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: New file.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h: New file.
* checks/errors/borrowck/polonius/rust-polonius.h: New file.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: BIR: make BIR visitor const
Jakub Dupak [Tue, 27 Feb 2024 19:22:17 +0000 (20:22 +0100)] 
borrowck: BIR: make BIR visitor const

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): const
visitor
* checks/errors/borrowck/rust-bir-dump.h: const visitor
* checks/errors/borrowck/rust-bir-visitor.h: const visitor
* checks/errors/borrowck/rust-bir.h: const getter

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: BIR: emit moves
Jakub Dupak [Fri, 2 Feb 2024 13:47:14 +0000 (14:47 +0100)] 
borrowck: BIR: emit moves

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Emit moves.
* checks/errors/borrowck/rust-bir-builder-internal.h: Emit moves.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Emit moves.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit_move_place): Emit moves.
(Dump::visit): Emit moves.
* checks/errors/borrowck/rust-bir-place.h (struct Place): Emit moves.
* checks/errors/borrowck/rust-bir-visitor.h: Emit moves.
* checks/errors/borrowck/rust-bir.h (enum class): Emit moves.
(class AbstractExpr): Emit moves.
(BasicBlock::is_terminated): Emit moves.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: BIR: scope handling
Jakub Dupak [Fri, 2 Feb 2024 13:38:59 +0000 (14:38 +0100)] 
borrowck: BIR: scope handling

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::setup_loop):
Loop handling.
(ExprStmtBuilder::visit): Handle scopes.
* checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext):
Handle scopes.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Dump scopes.
(Dump::visit): Add scopes dump.
(Dump::indent): Add indentation logic.
(Dump::visit_scope): Dump scope.
* checks/errors/borrowck/rust-bir-dump.h: Dump methods.
* checks/errors/borrowck/rust-bir-place.h (std::numeric_limits::max): Scope constants.
(struct Scope): Scope representation.
(class PlaceDB): Scope tracking.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: BIR: Place tree traverse API
Jakub Dupak [Fri, 2 Feb 2024 13:36:26 +0000 (14:36 +0100)] 
borrowck: BIR: Place tree traverse API

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-place.h:
Create place tree traverse API.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: BIR: use callable API
Jakub Dupak [Fri, 2 Feb 2024 13:33:56 +0000 (14:33 +0100)] 
borrowck: BIR: use callable API

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Use callable API

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Unify BIR terminilogy (node->statement)
Jakub Dupak [Sat, 4 Nov 2023 15:52:27 +0000 (16:52 +0100)] 
borrowck: Unify BIR terminilogy (node->statement)

gcc/rust/ChangeLog:

* checks/errors/borrowck/bir-design-notes.md (nodes): Rename node to statement.
(Nodes): Rename node to statement.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Rename node to statement.
* checks/errors/borrowck/rust-bir-builder-internal.h: Rename node to statement.
* checks/errors/borrowck/rust-bir-builder.h: Rename node to statement.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Rename node to statement.
(Dump::visit): Rename node to statement.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Rename node to statement.
* checks/errors/borrowck/rust-bir-visitor.h (class Node): Rename node to statement.
(class Statement): Rename node to statement.
* checks/errors/borrowck/rust-bir.h (class Node): Rename node to statement.
(class Statement): Rename node to statement.
(class AbstractExpr): Rename node to statement.
(struct Function): Rename node to statement.
(struct BasicBlock): Rename node to statement.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoborrowck: Use rust-system.h
Jakub Dupak [Fri, 22 Mar 2024 15:24:30 +0000 (16:24 +0100)] 
borrowck: Use rust-system.h

Replace direct usage of system headers.

gcc/rust/ChangeLog:

* checks/errors/borrowck/rust-bir-dump.cc: Use rust-system.h
* checks/errors/borrowck/rust-bir-dump.h (RUST_BIR_DUMP_H): Use rust-system.h
* checks/errors/borrowck/rust-bir-place.h (RUST_BIR_PLACE_H): Use rust-system.h
* checks/errors/borrowck/rust-function-collector.h: Use rust-system.h
* rust-system.h: Use rust-system.h
* typecheck/rust-hir-type-check.h: Use rust-system.h
* typecheck/rust-tyty-subst.cc: Use rust-system.h
* typecheck/rust-tyty-subst.h: Use rust-system.h
* typecheck/rust-tyty.h: Use rust-system.h

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agounify: Always coerce `!` to the target type.
Arthur Cohen [Wed, 6 Mar 2024 15:19:46 +0000 (16:19 +0100)] 
unify: Always coerce `!` to the target type.

Never can... never... exist, so it should always be coerced to the type
it is being matched against. This is useful for breaking off of a loop
from inside a match, or an if condition, for example.

gcc/rust/ChangeLog:

* typecheck/rust-unify.cc (UnifyRules::go): Always unify to `ltype` if
we are matching against a `Never` in `rtype`.
(UnifyRules::expect_never): Always unify to the expected type.

gcc/testsuite/ChangeLog:

* rust/compile/match-never-ltype.rs: New test.
* rust/compile/match-never-rtype.rs: New test.