]> gcc.gnu.org Git - gcc.git/log
gcc.git
2 months agoChange singleton returned type to a reference devel/rust/master
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>
2 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>
2 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.

2 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.

2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
3 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>
3 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>
3 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>
3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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'.

3 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'.

3 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.

3 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.

3 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.

3 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".

3 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'

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

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

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

3 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]

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

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

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

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

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

3 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]

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

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

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

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

3 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]

3 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]

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

3 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.

3 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.

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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.

3 months agoraw-strings: Remove dg-excess-error directive
Arthur Cohen [Fri, 29 Mar 2024 11:19:10 +0000 (12:19 +0100)]
raw-strings: Remove dg-excess-error directive

The error is actually expected and uses the correct location.

gcc/testsuite/ChangeLog:

* rust/compile/raw-byte-string-loc.rs: Use dg-error instead of
dg-excess-error.
* rust/compile/raw-string-loc.rs: Likewise.

3 months agoImprove parsing of raw string literals
Owen Avery [Wed, 27 Mar 2024 01:10:05 +0000 (21:10 -0400)]
Improve parsing of raw string literals

gcc/rust/ChangeLog:

* lex/rust-lex.cc
(Lexer::parse_raw_string):
Bring handling of edge cases to par with parse_raw_byte_string.

gcc/testsuite/ChangeLog:

* rust/compile/raw-string-loc.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
3 months agoAvoid parsing const unsafe/extern functions as async
Owen Avery [Tue, 26 Mar 2024 19:58:48 +0000 (15:58 -0400)]
Avoid parsing const unsafe/extern functions as async

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h
(Parser::parse_vis_item):
Call parse_function instead of parse_async_item when finding
UNSAFE or EXTERN_KW during lookahead.

gcc/testsuite/ChangeLog:

* rust/compile/func-const-unsafe.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
3 months agoRecognize unstable as a builtin attribute
Owen Avery [Tue, 26 Mar 2024 23:28:53 +0000 (19:28 -0400)]
Recognize unstable as a builtin attribute

gcc/rust/ChangeLog:

* util/rust-attribute-values.h
(Attributes::UNSTABLE): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::UNSTABLE.

gcc/testsuite/ChangeLog:

* rust/compile/unstable-fn.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
3 months agoRecognize rustc_deprecated as a builtin attribute
Owen Avery [Wed, 27 Mar 2024 01:57:17 +0000 (21:57 -0400)]
Recognize rustc_deprecated as a builtin attribute

gcc/rust/ChangeLog:

* util/rust-attribute-values.h
(Attributes::RUSTC_DEPRECATED): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::RUSTC_DEPRECATED.

gcc/testsuite/ChangeLog:

* rust/compile/deprecated-fn.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
3 months agoImprove parsing of raw byte string literals
Owen Avery [Wed, 27 Mar 2024 00:16:08 +0000 (20:16 -0400)]
Improve parsing of raw byte string literals

gcc/rust/ChangeLog:

* lex/rust-lex.cc
(Lexer::parse_raw_byte_string):
Bring handling of edge cases to par with parse_byte_string.

gcc/testsuite/ChangeLog:

* rust/compile/raw-byte-string-loc.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
4 months agoChange dfs function return type to support gcc 4.8
Pierre-Emmanuel Patry [Tue, 26 Mar 2024 15:32:31 +0000 (16:32 +0100)]
Change dfs function return type to support gcc 4.8

GCC 4.8 does not handle pair with references correctly. We need to use a
properly typed struct instead.

gcc/rust/ChangeLog:

* resolve/rust-forever-stack.h: Change dfs function prototype and
declare dfs return type structure.
* resolve/rust-forever-stack.hxx: Adapt dfs function to the new return
type.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd globbing name resolution 2.0 test
Pierre-Emmanuel Patry [Tue, 26 Mar 2024 09:58:53 +0000 (10:58 +0100)]
Add globbing name resolution 2.0 test

Add a few test for globbing to highlight function call ambiguities.

gcc/testsuite/ChangeLog:

* rust/compile/name_resolution23.rs: New test.
* rust/compile/name_resolution24.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agonr2.0: Add new test cases.
Arthur Cohen [Wed, 23 Aug 2023 15:19:28 +0000 (17:19 +0200)]
nr2.0: Add new test cases.

gcc/testsuite/ChangeLog:

* rust/compile/name_resolution13.rs: Add new module and remove compile
step.
* rust/compile/name_resolution14.rs: New test.
* rust/compile/name_resolution15.rs: New test.
* rust/compile/name_resolution16.rs: New test.
* rust/compile/name_resolution17.rs: New test.
* rust/compile/name_resolution18.rs: New test.
* rust/compile/name_resolution19.rs: New test.
* rust/compile/name_resolution20.rs: New test.
* rust/compile/name_resolution21.rs: New test.

4 months agocompile: resolve-path-ref: properly resolve nodeId with nr2.0
Arthur Cohen [Fri, 22 Mar 2024 13:31:24 +0000 (14:31 +0100)]
compile: resolve-path-ref: properly resolve nodeId with nr2.0

gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc: Attempt to resolve names
also using new name resolution context.
* backend/rust-compile-resolve-path.h: Add new declaration.

4 months agoFix use rebind name resolution.
Pierre-Emmanuel Patry [Thu, 21 Mar 2024 18:25:52 +0000 (19:25 +0100)]
Fix use rebind name resolution.

Name resolution for rebind were missing.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Change function prototype to use a reference instead.
(TopLevel::handle_use_dec): Likewise.
(TopLevel::handle_rebind): Add name resolution on rebind use
declarations.
(flatten_rebind): Change prototype to accept a pair of path/alias.
(flatten_list): Adapt call to flatten_rebind.
(flatten): Adapt call to flatten_rebind.
(flatten_glob): Remove unused part.
(TopLevel::visit): Add rebind resolution.
* resolve/rust-toplevel-name-resolver-2.0.h: Adapt function prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd mappings for struct base and struct fields
Pierre-Emmanuel Patry [Thu, 21 Mar 2024 18:16:02 +0000 (19:16 +0100)]
Add mappings for struct base and struct fields

Definition/usage mapping during name resolution was missing.

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add mapping
implementation.
* resolve/rust-late-name-resolver-2.0.h: Add function visitor prototype
override.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoFix quoted string format
Pierre-Emmanuel Patry [Wed, 13 Mar 2024 16:18:58 +0000 (17:18 +0100)]
Fix quoted string format

This format dialog triggered a warning.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec):
Replace the string format %<%s%> with the proper %qs format.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoPrevent getting immutable context with classic nr
Pierre-Emmanuel Patry [Wed, 13 Mar 2024 15:44:00 +0000 (16:44 +0100)]
Prevent getting immutable context with classic nr

Immutable name resolution context is not initialized when the classic
name resolution is in use. It can therefore not be used, the getter would
error out.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Only get immutable name resolution context when name resolution 2.0 is
used.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoUpdate assignment operator with cratenum
Pierre-Emmanuel Patry [Wed, 13 Mar 2024 15:21:44 +0000 (16:21 +0100)]
Update assignment operator with cratenum

Crate number was not assigned with the other fields in the assignment
operator overload of a CannonicalPath.

gcc/rust/ChangeLog:

* util/rust-canonical-path.h: Also assign crate number.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoReinject Self parameter in new resolver
Pierre-Emmanuel Patry [Wed, 7 Feb 2024 11:51:28 +0000 (12:51 +0100)]
Reinject Self parameter in new resolver

The old resolver injected a Self generic parameter in order to help the
trait solver. This is clearly sketchy at best and should be fixed in
the future.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
Self generic parameter injection and a warning.
* resolve/rust-toplevel-name-resolver-2.0.h: Add function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoUse new name resolver to compile constant items
Pierre-Emmanuel Patry [Tue, 6 Feb 2024 16:21:45 +0000 (17:21 +0100)]
Use new name resolver to compile constant items

Constant items were handled only by the old resolver, this lead to an
ICE when using the new resolver on some rust code containing a constant
item as the new and the old resolver cannot be used at the same time.

gcc/rust/ChangeLog:

* backend/rust-compile-item.cc (CompileItem::visit): Check the resolver
flag and use the new one when required.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoRemove unsafe block empty visit function
Pierre-Emmanuel Patry [Tue, 6 Feb 2024 14:13:17 +0000 (15:13 +0100)]
Remove unsafe block empty visit function

We need to visit subcomponents in unsafe elements, this means we can
leverage the default ast visitor's code instead of duplicating it.

gcc/rust/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoRemove extern block scoping
Pierre-Emmanuel Patry [Tue, 6 Feb 2024 14:10:44 +0000 (15:10 +0100)]
Remove extern block scoping

Remove extern block scoping visit function, use the default visitor visit
function instead. We do not need scoping for extern block as their
element shall be visible from the extern block scope.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
visitor implementation and scoping.
* resolve/rust-default-resolver.h: Remove function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd constant identifiers to the value namespace
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 16:11:59 +0000 (17:11 +0100)]
Add constant identifiers to the value namespace

Constants could not be resolved without their identifier in the right
scope.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
constant identifiers to the resolver.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoStruct are types, not values
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 16:10:42 +0000 (17:10 +0100)]
Struct are types, not values

We shall search in the right namespace. The correct namespace for struct
is type namespace.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Change
search location for struct types.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoChange enum namespace from value to type
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 16:08:05 +0000 (17:08 +0100)]
Change enum namespace from value to type

The enum type shall be in type namespace, not value namespace.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Change enum type namespace.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd tuple struct to the type namespace
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 16:06:56 +0000 (17:06 +0100)]
Add tuple struct to the type namespace

Only tuple struct constructor was added to the resolver.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Add tuple struct type to the resolver's context.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoUnit struct constructor shall be resolved
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 16:04:51 +0000 (17:04 +0100)]
Unit struct constructor shall be resolved

Unit struct have a special constructor that should be added to the struct
namespace in order to be resolved later when called. As it is a function
it should be added in the value namespace.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Add the struct constructor when the struct is a unit.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoValues shall be inserted in the value namespace
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 16:00:29 +0000 (17:00 +0100)]
Values shall be inserted in the value namespace

Values were inserted in the label namespace instead of the value
namespace this lead to several bugs.

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change the
namespace for values from "label" to "values".

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoRaw pointer type visitor didn't require overload
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 15:57:37 +0000 (16:57 +0100)]
Raw pointer type visitor didn't require overload

This overload did not dispatch the visitor to sub members of a raw
pointer like the default one. It is therefore useless as pointed type
shall be visited to be resolved correctly.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
function implementation.
* resolve/rust-default-resolver.h: Remove function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoVisit constant item type in default resolver
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 15:50:27 +0000 (16:50 +0100)]
Visit constant item type in default resolver

The type of constant item expression was not properly visited in the
default resolver.

gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
constant item's types.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoVisit function return type in default resolver
Pierre-Emmanuel Patry [Wed, 24 Jan 2024 15:47:50 +0000 (16:47 +0100)]
Visit function return type in default resolver

Function return type was not properly visited in the default resolver
visitor pattern.

gcc/rust/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoChange error message to match test
Pierre-Emmanuel Patry [Wed, 17 Jan 2024 12:53:21 +0000 (13:53 +0100)]
Change error message to match test

Error message did not match the test from the previous name resolver when
a given path cannot be resolved.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Change error message to match old resolver and test case.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd tuple struct constructor to value namespace
Pierre-Emmanuel Patry [Wed, 17 Jan 2024 12:02:51 +0000 (13:02 +0100)]
Add tuple struct constructor to value namespace

A tuple struct constructor should be inserted in the value namespace
during name resolution in order to reject multiple definitions of the
function.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
the struct constructor to the value namespace.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd support for ambiguous use declarations
Pierre-Emmanuel Patry [Tue, 16 Jan 2024 12:55:02 +0000 (13:55 +0100)]
Add support for ambiguous use declarations

Glob use declarations may lead to ambiguous situation where two
definitions with the same name are imported in a given scope. The
compiler now handles shadowable items inserted after non shadowable
items. An error is now thrown when multiple shadowable items are imported
and used in the same rib.

gcc/rust/ChangeLog:

* resolve/rust-early-name-resolver-2.0.cc (Early::visit): Adapt
resolved type to the new API.
(Early::visit_attributes): Retrieve the node id from the definition.
* resolve/rust-forever-stack.h: Change the return type of getter
functions. Those functions now return a definition type instead of a
node id.
* resolve/rust-forever-stack.hxx: Change member function implementation
in the forever stack to accomodate it's API changes.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Use internal
node id. Emit an error when resolving multiple ambiguous values.
* resolve/rust-rib.cc (Rib::Definition::Definition): Add a default
constructor.
(Rib::Definition::is_ambiguous): Add a new function to determine
whether a function definition is ambiguous or not.
(Rib::Definition::to_string): Add a member function to convert a given
definition to a string.
(Rib::insert): Add new rules for value insertion in a rib. Insertion
order does not impact the result anymore: inserting a shadowable value
after a non shadowable one does not trigger an error anymore. All
shadowable values inserted in a rib are kepts until being replaced by a
non shadowable one.
(Rib::get): Return a definition instead of a node id.
* resolve/rust-rib.h: Update function prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Update return value container to match the new function's prototype.
(TopLevel::handle_use_dec): Likewise.
(flatten_glob): Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoMake globbing definition shadowable by default
Pierre-Emmanuel Patry [Mon, 15 Jan 2024 15:34:36 +0000 (16:34 +0100)]
Make globbing definition shadowable by default

Elements from glob use declaration shall be shadowable by default.

gcc/rust/ChangeLog:

* resolve/rust-forever-stack.h: Add a new function prototype to insert
a shadowable definition.
* resolve/rust-forever-stack.hxx: Add the new insert_shadowable
function to insert shadowable definition into the forever stack.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::insert_shadowable):
Likewise with the name resolution context.
* resolve/rust-name-resolution-context.h: Add name resolution context
insert_shadowable member function prototype.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert shadowable definition into the forever stack for glob use
declaration.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd call to globbing visitor
Pierre-Emmanuel Patry [Mon, 15 Jan 2024 12:41:01 +0000 (13:41 +0100)]
Add call to globbing visitor

Globbing visitor did not visit subitems.

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add a check
for missing item.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go):
Add a new function in the visitor to dispatch the visitor to items in
the given module.
(TopLevel::handle_use_glob): Change call to visitor to use the pointer.
* resolve/rust-toplevel-name-resolver-2.0.h: Add prototype for new
member function.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoShape up name resolver for normal direct calls
Pierre-Emmanuel Patry [Wed, 10 Jan 2024 15:44:09 +0000 (16:44 +0100)]
Shape up name resolver for normal direct calls

Direct function calls did not work anymore due to the transition to the
new resolver.

gcc/rust/ChangeLog:

* checks/lints/rust-lint-marklive.cc (MarkLive::find_ref_node_id):
Add code path for the resolver 2.0
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove failing
label context resolve call.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd name resolution for on globbing use decl
Pierre-Emmanuel Patry [Tue, 9 Jan 2024 12:51:35 +0000 (13:51 +0100)]
Add name resolution for on globbing use decl

This is the first part of the code required to enable globbing on use
declarations.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert names into their namespace.
(TopLevel::visit): Insert ast module.
(TopLevel::handle_use_dec): Resolve use declaration.
(TopLevel::handle_use_glob): Use globbing visitor.
(flatten_list): Use globbing path vector.
(flatten_glob): Likewise.
(flatten): Likewise.
(prefix_subpaths): Add a function to prefix subpath.
* resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor):
Add globbing visitor.
* util/rust-hir-map.cc (Mappings::insert_ast_module): Add function to
insert module in module hashmap.
(Mappings::lookup_ast_module): Add function to retrieve ast module.
* util/rust-hir-map.h: Add module map and getter/setter prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoAdd modules to type namespace
Pierre-Emmanuel Patry [Mon, 8 Jan 2024 14:18:36 +0000 (15:18 +0100)]
Add modules to type namespace

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Module
should be added to the type namespace in order to be retrieved later.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agolate: Add bool builtin type
Arthur Cohen [Wed, 8 Nov 2023 23:39:46 +0000 (00:39 +0100)]
late: Add bool builtin type

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::setup_builtin_types):
Setup bool as builtin type.

4 months agoPrevent error emission on resolver reentry
Pierre-Emmanuel Patry [Mon, 18 Sep 2023 13:34:24 +0000 (15:34 +0200)]
Prevent error emission on resolver reentry

The resolver was emitting an error when meeting the same symbol twice.
What is important here is the origin of the resolved symbol, we should
emit an error when the name is similar but the symbol isn't be not when
the resolver is simply meeting the exact same symbol.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (insert_macros): Add
constraint over the ast node id.
(TopLevel::visit): Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
4 months agoChange error message on unresolved import
Pierre-Emmanuel Patry [Sun, 24 Mar 2024 21:23:03 +0000 (22:23 +0100)]
Change error message on unresolved import

The error message did not match rustc's.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Change
error message.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This page took 0.105151 seconds and 5 git commands to generate.