aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
AgeCommit message (Collapse)AuthorFilesLines
2024-07-13Daily bump.GCC Administrator1-0/+5
2024-07-12Fix Xcode 16 build break with NULL != nullptrDaniel Bertalan1-1/+1
As of Xcode 16 beta 2 with the macOS 15 SDK, each re-inclusion of the stddef.h header causes the NULL macro in C++ to be re-defined to an integral constant (__null). This makes the workaround in d59a576b8 ("Redefine NULL to nullptr") ineffective, as other headers that are typically included after system.h (such as obstack.h) do include stddef.h too. This can be seen by running the sample below through `clang++ -E` #include <stddef.h> #define NULL nullptr #include <stddef.h> NULL The relevant libc++ change is here: https://github.com/llvm/llvm-project/commit/2950283dddab03c183c1be2d7de9d4999cc86131 Filed as FB14261859 to Apple and added a comment about it on LLVM PR 86843. This fixes the cases in --enable-languages=c,c++,objc,obj-c++,rust build where NULL being an integral constant instead of a null pointer literal (therefore no longer implicitly converting to a pointer when used as a template function's argument) caused issues. gcc/value-pointer-equiv.cc:65:43: error: no viable conversion from `pair<typename __unwrap_ref_decay<long>::type, typename __unwrap_ref_decay<long>::type>' to 'const pair<tree, tree>' 65 | const std::pair <tree, tree> m_marker = std::make_pair (NULL, NULL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ As noted in the previous commit though, the proper solution would be to phase out the usages of NULL in GCC's C++ source code. gcc/analyzer/ChangeLog: * diagnostic-manager.cc (saved_diagnostic::saved_diagnostic): Change NULL to nullptr. (struct null_assignment_sm_context): Likewise. * infinite-loop.cc: Likewise. * infinite-recursion.cc: Likewise. * varargs.cc (va_list_state_machine::on_leak): Likewise. gcc/rust/ChangeLog: * metadata/rust-imports.cc (Import::try_package_in_directory): Change NULL to nullptr. gcc/ChangeLog: * value-pointer-equiv.cc: Change NULL to nullptr. Signed-off-by: Daniel Bertalan <dani@danielbertalan.dev>
2024-06-26Daily bump.GCC Administrator1-0/+6
2024-06-25rust: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZEKewen Lin1-3/+3
Joseph pointed out "floating types should have their mode, not a poorly defined precision value" in the discussion[1], as he and Richi suggested, the existing macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE will be replaced with a hook mode_for_floating_type. To be prepared for that, this patch is to replace use of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in rust with TYPE_PRECISION of {float,{,long_}double}_type_node. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/rust/ChangeLog: * rust-gcc.cc (float_type): Use TYPE_PRECISION of {float,double,long_double}_type_node to replace {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
2024-06-12Daily bump.GCC Administrator1-0/+5
2024-06-11rust: Do not link with libdl and libpthread unconditionallyArthur Cohen1-1/+4
ChangeLog: * Makefile.tpl: Add CRAB1_LIBS variable. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Check if -ldl and -lpthread are needed, and if so, add them to CRAB1_LIBS. gcc/rust/ChangeLog: * Make-lang.in: Remove overazealous LIBS = -ldl -lpthread line, link crab1 against CRAB1_LIBS.
2024-04-16Daily bump.GCC Administrator1-0/+18
2024-04-15Inline 'gcc/rust/Make-lang.in:RUST_LIBDEPS' into single userThomas Schwinge1-3/+1
gcc/rust/ * Make-lang.in (RUST_LIBDEPS): Inline into single user.
2024-04-15Add 'gcc/rust/Make-lang.in:LIBPROC_MACRO_INTERNAL'Thomas Schwinge1-2/+4
... to avoid verbatim repetition. gcc/rust/ * Make-lang.in (LIBPROC_MACRO_INTERNAL): New. (RUST_LIBDEPS, crab1$(exeext)): Use it.
2024-04-15Inline 'gcc/rust/Make-lang.in:RUST_LDFLAGS' into single userThomas Schwinge1-2/+1
gcc/rust/ * Make-lang.in (RUST_LDFLAGS): Inline into single user.
2024-04-15Remove 'libgrust/libproc_macro_internal' from ↵Thomas Schwinge1-1/+1
'gcc/rust/Make-lang.in:RUST_LDFLAGS' This isn't necessary, as the full path to 'libproc_macro_internal.a' is specified elsewhere. gcc/rust/ * Make-lang.in (RUST_LDFLAGS): Remove 'libgrust/libproc_macro_internal'.
2024-04-10Daily bump.GCC Administrator1-0/+4
2024-04-09rust: Add rust.install-dvi and rust.install-html rulesChristophe Lyon1-0/+2
rust has the (empty) rust.dvi and rust.html rules, but lacks the (empty) rust.install-dvi and rust.install-html ones. 2024-04-04 Christophe Lyon <christophe.lyon@linaro.org> gcc/rust/ * Make-lang.in (rust.install-dvi, rust.install-html): New rules.
2024-03-05Daily bump.GCC Administrator1-0/+4
2024-03-04Regenerate opt.urlsMark Wielaard1-0/+3
There were several commits that didn't regenerate the opt.urls files. Fixes: 438ef143679e ("rs6000: Neuter option -mpower{8,9}-vector") Fixes: 50c549ef3db6 ("gccrs: enable -Winfinite-recursion warnings by default") Fixes: 25bb8a40abd9 ("Move docs for -Wuse-after-free and -Wuseless-cast") Fixes: 48448055fb70 ("AVR: Support .rodata in Flash for AVR64* and AVR128*") Fixes: 42503cc257fb ("AVR: Document option -mskip-bug") Fixes: 7de5bb642c12 ("i386: [APX] Document inline asm behavior and new switch") Fixes: 49a14ee488b8 ("Add -mevex512 into invoke.texi") Fixes: 4666cbde5e6d ("Sort warning options in c-family/c.opt.") Fixes: cda383616183 ("AVR: target/114100 - Better indirect accesses for reduced Tiny") gcc/c-family/ChangeLog: * c.opt.urls: Regenerate. gcc/ChangeLog: * common.opt.urls: Regenerate. * config/avr/avr.opt.urls: Likewise. * config/i386/i386.opt.urls: Likewise. * config/pru/pru.opt.urls: Likewise. * config/riscv/riscv.opt.urls: Likewise. * config/rs6000/rs6000.opt.urls: Likewise. gcc/rust/ChangeLog: * lang.opt.urls: Regenerate.
2024-02-22Daily bump.GCC Administrator1-0/+47
2024-02-21Update copyright years.Sahil Yeole74-75/+75
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
2024-02-21gccrs: Add variadic check on function params0xn4utilus1-4/+8
gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add variadic check on all parameters. gcc/testsuite/ChangeLog: * rust/compile/issue-2850.rs: New test. Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
2024-02-21gccrs: Fix lookup of TuplePattern sub-pattern typesOwen Avery1-6/+6
gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Lookup type of sub-pattern, not tuple pattern itself. gcc/testsuite/ChangeLog: * rust/compile/issue-2847-b.rs: New test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-02-21gccrs: add powi intrinsicsMarc Poulhiès2-3/+29
gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::register_rust_mappings): Add powi and reformat. * backend/rust-builtins.h: Add missing copyright header. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-math.rs: Adjust pow test, add test for powi. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-02-21gccrs: expand: Fix formatting for "macro not found" errorArthur Cohen1-3/+3
gcc/rust/ChangeLog: * expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix formatting of emitted error.
2024-02-21gccrs: Fix rebinding importsOwen Avery2-93/+109
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (flatten_glob): Use Import class. (flatten_rebind): Likewise. (flatten_list): Likewise. (flatten): Likewise. (flatten_use_dec_to_paths): Likewise. (flatten_use_dec_to_imports): Likewise. (ResolveItem::visit): Likewise. (Import::add_prefix): New. (rust_flatten_nested_glob): Adjust test. (rust_flatten_glob): Likewise. (rust_flatten_rebind_none): Likewise. (rust_flatten_rebind): Likewise. (rust_flatten_rebind_nested): Likewise. (rust_flatten_list): Likewise. * resolve/rust-ast-resolve-item.h (class Import): New. gcc/testsuite/ChangeLog: * rust/compile/use_2.rs: New test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-02-21gccrs: Fix typo in RegionConstraints instanceArthur Cohen1-1/+1
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-implitem.h: Fix typo in field (region_costraints -> region_constraints).
2024-02-08Daily bump.GCC Administrator1-0/+315
2024-02-07gccrs: Fix macro parsing for trait items.Kushal Pal1-18/+19
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_trait_item): Handle macros in trait items similar to how its handled for trait implementation items. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-02-07gccrs: Remove obsolete classes and functions.Kushal Pal30-1302/+0
Trait functions now use AST::Function class, so classes AST::TraitItemFunc, AST::TraitItemMethod, AST::TraitFunctionDecl, AST::TraitMethodDecl and their related functions can be removed. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Remove obsolete classes and functions. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-full-decls.h (class TraitFunctionDecl): Likewise. (class TraitItemFunc): Likewise. (class TraitMethodDecl): Likewise. (class TraitItemMethod): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * ast/rust-ast.cc (TraitItemFunc::TraitItemFunc): Likewise. (TraitItemFunc::operator=): Likewise. (TraitItemFunc::as_string): Likewise. (TraitFunctionDecl::as_string): Likewise. (TraitItemMethod::TraitItemMethod): Likewise. (TraitItemMethod::operator=): Likewise. (TraitItemMethod::as_string): Likewise. (TraitMethodDecl::as_string): Likewise. (TraitItemFunc::accept_vis): Likewise. (TraitItemMethod::accept_vis): Likewise. * ast/rust-item.h (class TraitFunctionDecl): Likewise. (class TraitItemFunc): Likewise. (class TraitMethodDecl): Likewise. (class TraitItemMethod): Likewise. * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Likewise. * checks/errors/rust-ast-validation.h: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_trait_function_decl): Likewise. (CfgStrip::maybe_strip_trait_method_decl): Likewise. (CfgStrip::visit): Likewise. * expand/rust-cfg-strip.h: Likewise. * expand/rust-derive.h: Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::expand_trait_function_decl): Likewise. (ExpandVisitor::expand_trait_method_decl): Likewise. (ExpandVisitor::visit): Likewise. * expand/rust-expand-visitor.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Likewise. * hir/rust-ast-lower-implitem.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-ast-resolve-implitem.h (visit): Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. * resolve/rust-ast-resolve-item.h: Likewise. * resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise. * resolve/rust-default-resolver.h: Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.h: Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-02-07gccrs: Parse trait functions as `AST::Function`.Kushal Pal1-125/+2
To use AST::Function for trait functions, we can parse trait functions using available parse_function(). gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_trait_item): Use parse_function() to parse trait functions. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-02-07gccrs: Add missing visitors for AST::Function.Kushal Pal5-0/+196
To use AST::Function instead of AST::TraitItemFunc and AST::TraitItemMethod, we need to provide similar visitors during lowering and resolving phase. gcc/rust/ChangeLog: * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Provide visitor for AST::Function. * hir/rust-ast-lower-implitem.h: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. * resolve/rust-ast-resolve-item.h: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-02-07gccrs: Add checks for Trait functionsKushal Pal1-7/+11
Since we want to use AST::Function class for trait functions as well, we need to check against specific conditions in ASTValidation phase. gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add checks for Trait functions. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-02-07gccrs: Use AssociatedItem in place of TraitItemKushal Pal5-16/+17
gcc/rust/ChangeLog: * ast/rust-ast.h: Replace TraitItem with AssociatedItem. * ast/rust-item.h (class Trait): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_trait): Likewise. * parse/rust-parse.h: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-02-07gccrs: fix bug in pattern check for tuplesPhilip Herron1-2/+4
We can point to generic parent types which means we need to do the shallow resolve thing that rustc does. We have destructure which is similar to get what the parameter type points to. Fixes #2775 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): use destructure gcc/testsuite/ChangeLog: * rust/compile/issue-2775.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-02-07gccrs: Move the Implementation of implitem lowering into its own file.Nobel Singh3-396/+439
This patch moves the implementation of the implitem lowering from rust-ast-lower-implitem.h into the rust-ast-lower-implitem.cc file. gcc/rust/ChangeLog: * Make-lang.in: Add rust-ast-lower-implitem.cc to list of objects. * hir/rust-ast-lower-implitem.h (RUST_AST_LOWER_IMPLITEM_H): Remove implementation. * hir/rust-ast-lower-implitem.cc: Copy implementation from header. Signed-off-by: Nobel Singh <Nobel2073@gmail.com>
2024-02-07gccrs: refactor inference variable computation into a seperate methodPhilip Herron3-33/+44
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): refactor * typecheck/rust-hir-type-check.h: new prototype * typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables): x
2024-02-07gccrs: remove similar hack in type paths as we had in path expressionsPhilip Herron1-16/+0
This keeps the resolution code in line with paths. Addresses #2723 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc: remove hack
2024-02-07gccrs: remove old generics hack to reuse generic symbols from previous segPhilip Herron1-19/+2
This patch introduces one regression because generics are getting better understood over time. The code here used to apply generics with the same symbol from previous segments which was a bit of a hack with out limited inference variable support. The regression looks like it will be related to another issue which needs to default integer inference variables much more aggresivly to default integer. Fixes #2723 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack gcc/testsuite/ChangeLog: * rust/compile/issue-1773.rs: Moved to... * rust/compile/issue-1773.rs.bak: ...here. * rust/compile/issue-2723-1.rs: New test. * rust/compile/issue-2723-2.rs: New test.
2024-02-07gccrs: Fix ICE accessing empty vector without checkPhilip Herron1-1/+2
Fixes #2747 gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): fix gcc/testsuite/ChangeLog: * rust/compile/issue-2747.rs: New test.
2024-02-07gccrs: Set the default ABI to C for extern blocks and extern functionsNobel Singh1-2/+2
Previously, the default ABI was set to Rust, which is not correct for extern blocks and extern functions. This patch changes the default ABI to C for these cases. gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): Change default ABI to C for extern functions (ASTLoweringBase::lower_extern_block): Likewise Signed-off-by: Nobel Singh <nobel2073@gmail.com>
2024-02-07gccrs: TyTy: Store reference to type before any substitutionsJakub Dupak2-2/+11
gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (BaseType::BaseType): Store orig ref. (BaseType::get_orig_ref): Add getter. * typecheck/rust-tyty.h: Store orig ref. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-02-07gccrs: TyTy: Store region constraintsJakub Dupak12-53/+151
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Add region constraints. (TypeCheckImplItem::visit): Add region constraints. * typecheck/rust-hir-type-check-implitem.h: Add region constraints. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelf): Add region constraints. (TypeCheckItem::visit): Add region constraints. (TypeCheckItem::resolve_impl_item): Add region constraints. (TypeCheckItem::resolve_impl_block_substitutions): Add region constraints. * typecheck/rust-hir-type-check-item.h: Add region constraints. * typecheck/rust-hir-type-check-type.cc (ResolveWhereClauseItem::Resolve): Add region constraints. (ResolveWhereClauseItem::visit): Add region constraints. * typecheck/rust-hir-type-check-type.h (class ResolveWhereClauseItem): Add region constraints. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Add region constraints. * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): Add region constraints. * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_region_constraints): Add region constraints. * typecheck/rust-tyty-subst.h (class BaseType): Add region constraints. (struct RegionConstraints): Add region constraints. * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Add region constraints. (ADTType::clone): Add region constraints. (FnType::clone): Add region constraints. (ProjectionType::clone): Add region constraints. * typecheck/rust-tyty.h: Add region constraints. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-02-07gccrs: Typecheck: add regions (lifetimes) to TyTyJakub Dupak18-177/+585
gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc: add regions * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): add regions, resolve generic lifetimes * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): add regions * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): add regions, resolve lifetimes (TypeCheckImplItem::visit): add regions, resove lifetimes * typecheck/rust-hir-type-check-implitem.h: add default value for result * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): add regions, resove lifetimes (TypeCheckItem::resolve_impl_block_substitutions): add regions, resove lifetimes * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add regions, resove lifetimes (TypeCheckExpr::resolve_root_path): add regions, resove lifetimes (TypeCheckExpr::resolve_segments): add regions, resove lifetimes * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): add regions, resove lifetimes (TypeCheckType::resolve_root_path): add regions, resove lifetimes (ResolveWhereClauseItem::Resolve): add regions, resove lifetimes (ResolveWhereClauseItem::visit): add regions, resove lifetimes * typecheck/rust-hir-type-check.cc (TypeCheckContext::LifetimeResolver::resolve): add regions, resolve lifetimes (TraitItemReference::get_type_from_fn): add regions, resove lifetimes * typecheck/rust-hir-type-check.h: add regions, resove lifetimes * typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): add regions, resove lifetimes (SubstMapper::Resolve): add regions, resove lifetimes (SubstMapper::InferSubst): add regions, resove lifetimes (SubstMapper::visit): add regions, resove lifetimes * typecheck/rust-substitution-mapper.h: add regions, resove lifetimes * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): lifetime resolution (TypeCheckContext::regions_from_generic_args): lifetime resolution helper * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): add regions, resove lifetimes (TypeBoundPredicate::operator=): add regions, resove lifetimes (TypeBoundPredicate::apply_generic_arguments): add regions, resove lifetimes (TypeBoundPredicateItem::get_tyty_for_receiver): add regions, resove lifetimes * typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::get_regions): add regions, resove lifetimes (SubstitutionArgumentMappings::get_mut_regions): getter (SubstitutionArgumentMappings::error): split error and empty (SubstitutionArgumentMappings::empty): split error and empty (SubstitutionArgumentMappings::find_symbol): helper (SubstitutionRef::get_num_lifetime_params): getter (SubstitutionRef::get_num_type_params): getter (SubstitutionRef::needs_substitution): extend to regions (SubstitutionRef::get_mappings_from_generic_args): helper (SubstitutionRef::infer_substitions): add regions * typecheck/rust-tyty-subst.h (class RegionParamList): region param handler * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): add regions, resove lifetimes (InferType::default_type): add regions, resove lifetimes (FnType::clone): add regions, resove lifetimes (ReferenceType::ReferenceType): add regions (ReferenceType::get_region): getter (ReferenceType::clone): add regions * typecheck/rust-tyty.h: add regions, resove Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-02-07gccrs: HIR: Add mising getterJakub Dupak1-0/+5
gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: Add missing getter Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-02-07gccrs: TyTy: Region (lifetime) representationJakub Dupak1-0/+110
gcc/rust/ChangeLog: * typecheck/rust-tyty-region.h: New file. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-02-07gccrs: Typecheck: lifetime interning and resolution toolJakub Dupak2-1/+279
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h (class Lifetime): add interned lifetime class * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): add resolution tool (TypeCheckContext::intern_lifetime): add method to intern lifetime from tyctx (TypeCheckContext::lookup_lifetime): add method to lookup lifetime from tyctx (TypeCheckContext::intern_and_insert_lifetime): add a helper method Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-02-07gccrs: Implement quick-check for UnicodeRaiki Tamura7-82/+280
gcc/rust/ChangeLog: * rust-lang.cc (run_rust_tests): Add test. * rust-system.h: Add <algorithm>. * util/make-rust-unicode.py: Output NFC_Quick_Check table. * util/rust-codepoint.h (struct Codepoint): Add is_supplementary method. * util/rust-unicode-data.h: Generated. * util/rust-unicode.cc (binary_search_sorted_array): Removed. (lookup_cc): Remove namespace. (is_alphabetic): Use std::binary_search (nfc_quick_check): New function. (nfc_normalize): Use nfc_quick_check. (is_nfc_qc_maybe): New function. (is_nfc_qc_no): New function. (rust_nfc_qc_test): New test. * util/rust-unicode.h (is_nfc_qc_no): New function. (is_nfc_qc_maybe): New function. (enum class): New enum class. (nfc_quick_check): New function. (rust_nfc_qc_test): New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-02-07gccrs: Parse normal functions with `self` parameter correctlyKushal Pal1-2/+2
Fixes #2812 gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_function): Skip token if its a COMMA. gcc/testsuite/ChangeLog: * rust/compile/issue-2812.rs: New test. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-01-31Daily bump.GCC Administrator1-0/+839
2024-01-30gccrs: Remove TraitImplItemOwen Avery8-42/+26
gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (class TraitImplItem): Remove forward declaration. (class AssociatedItem): Add forward declaration. * ast/rust-ast.h (class TraitImplItem): Remove. (class TraitItem): Inherit from AssociatedItem. (SingleASTNode::take_trait_impl_item): Return std::unique_ptr<AssociatedItem> instead of std::unique_ptr<TraitImplItem>. * ast/rust-item.h (class Function): Inherit from AssociatedItem instead of TraitImplItem. (class TypeAlias): Likewise. (class ConstantItem): Likewise. (class TraitImpl): Store items as AssociatedItem. * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Return std::unique_ptr<AssociatedItem>. (DeriveClone::clone_impl): Take std::unique_ptr<AssociatedItem>. * expand/rust-derive-clone.h (DeriveClone::clone_fn): Return std::unique_ptr<AssociatedItem>. (DeriveClone::clone_impl): Take std::unique_ptr<AssociatedItem>. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Handle changes to SingleASTNode::take_trait_impl_item. * parse/rust-parse-impl.h (Parser::parse_impl): Parse TraitImpl as containing AssociatedItem. (Parser::parse_trait_impl_item): Return std::unique_ptr<AssociatedItem>. (Parser::parse_trait_impl_function_or_method): Likewise. * parse/rust-parse.h (Parser::parse_trait_impl_item): Return std::unique_ptr<AssociatedItem>. (Parser::parse_trait_impl_function_or_method): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-30gccrs: Add improved error when no fields in initializerRobert Goss3-3/+72
If a struct type with a variant that has fields is initialized with some fields the expression HIR StructExprStructFields is checked that all the fields are assigned. However, if no fields are initialized the HIR StructExprStruct is generated. This doesn't check if the struct is a unit during typechekc and only fails at the compile stage with a ICE. Add a check at the typecheck stage that makes sure the struct does not have a variant with fields and give an error message based on the rustc one. We have also updated the message given in the case where one field was present to list the missing fields and match more closely the new message. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit) Add additional check * typecheck/rust-hir-type-check-struct-field.h: A helper method to make error added * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve) Update message gcc/testsuite/ChangeLog: * rust/compile/missing_constructor_fields.rs: Added case with no initializers Signed-off-by: Robert Goss <goss.robert@gmail.com>
2024-01-30gccrs: AST: Fix for lifetime loweringJakub Dupak1-4/+17
gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): fix for lifetimes (ASTLowerWhereClauseItem::visit): fix for lifetimes Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
2024-01-30gccrs: AST: Fix for lifetime parsingJakub Dupak2-16/+27
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_where_clause): fix parsing (Parser::parse_where_clause_item): fix parsing (Parser::parse_type_bound_where_clause_item): fix parsing (Parser::parse_trait_bound): fix parsing * parse/rust-parse.h: fix parsing Signed-off-by: Jakub Dupak <dev@jakubdupak.com>