aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-01-10gccrs: add two more tests to test try-catch (unwind) code generationliushuyu2-0/+41
gcc/testsuite/ChangeLog: * rust/compile/try-catch-unwind-old.rs: add a test to test the older try intrinsics from plain old Rust to v1.78.0 * rust/compile/try-catch-unwind-new.rs: add a test to test the newer catch_unwind instrinsics since Rust v1.78.0
2025-01-10rust/intrinsic: add new "catch_unwind" variant of APIliushuyu1-10/+47
gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: add the new `catch_unwind` variant of the `try` intrinsic: this variant can be seen on Rust 1.78+ and returns `()` instead of `i32`.
2025-01-10rust/intrinsic: add try intrinsic and panic strategy optionsliushuyu5-0/+104
gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: add `try` intrinsic handler. * lang.opt: add `-frust-panic` option. * rust-lang.cc: enable exception handler code generation. * rust-session-manager.cc: add getter and setter for panic strategy option. * rust-session-manager.h: Likewise. Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
2025-01-10gccrs: match arms are a LUBPhilip Herron3-14/+16
Unify rules are not the same as coercion rules. The coercion of ! is allowed to any type but not for a unify site which is different. Match arms are another least upper bound coercion. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): implement coercion * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): this is an LUB * typecheck/rust-unify.cc (UnifyRules::go): remove unify ! coercion Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-01-10Allow float type to be casted as integer typeNobel2-0/+16
gccrs now should be able to cast float types as numeric. gcc/rust/ChangeLog: * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule. gcc/testsuite/ChangeLog: * rust/compile/cast_float_as_integer.rs: New test. Signed-off-by: Nobel Singh <nobel2073@gmail.com>
2025-01-10gccrs: cleanup our enum type layout to be closer to rustcPhilip Herron5-79/+128
This changes our enum type layout so for example: enum Foo { A, B, C(char), D { x: i32, y: i32 }, } Used to get layed out like this in gccrs: union { struct A { int RUST$ENUM$DISR; }; struct B { int RUST$ENUM$DISR; }; struct C { int RUST$ENUM$DISR; char __0; }; struct D { int RUST$ENUM$DISR; i64 x; i64 y; }; } This has some issues notably with the constexpr because this is just a giant union it means its not simple to constify what enum variant we are looking at because the discriminant is a mess. This now gets layed out as: struct { int RUST$ENUM$DISR; union { struct A { }; struct B { }; struct C { char __0; }; struct D { i64 x; i64 y; }; } payload; } This layout is much cleaner and allows for our constexpr to work properly. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): new layout * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): likewise (CompilePatternBindings::visit): likewise * backend/rust-compile-resolve-path.cc: likewise * backend/rust-compile-type.cc (TyTyResolveCompile::visit): implement new layout * rust-gcc.cc (constructor_expression): get rid of useless assert Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-01-08nr2.0: Resolve Self inside impl blocksOwen Avery3-3/+28
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert a definition for Self when visiting InherentImpl and TraitImpl instances. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Add visitors for InherentImpl and TraitImpl. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-01-07gccrs: fix ICE with hir dump on closurePhilip Herron1-2/+6
Return type and parameter types are optional on closures. gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add null guard Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-01-07gccrs: add support for lang_item eq and PartialEq traitPhilip Herron11-13/+194
The Eq and Partial Ord are very similar to the operator overloads we support for add/sub/etc... but they differ in that usually the function call name matches the name of the lang item. This time we need to have support to send in a new path for the method call on the lang item we want instead of just the name of the lang item. NOTE: this test case doesnt work correctly yet we need to support the derive of partial eq on enums to generate the correct comparison code for that. Fixes Rust-GCC#3302 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): handle partial_eq possible call * backend/rust-compile-expr.h: handle case where lang item calls differ from name * hir/tree/rust-hir-expr.cc (OperatorExprMeta::OperatorExprMeta): new helper * hir/tree/rust-hir-expr.h: likewise * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): handle partial_eq (TypeCheckExpr::resolve_operator_overload): likewise * typecheck/rust-hir-type-check-expr.h: likewise * util/rust-lang-item.cc (LangItem::ComparisonToLangItem): map comparison to lang item (LangItem::ComparisonToSegment): likewise * util/rust-lang-item.h: new lang items PartialOrd and Eq * util/rust-operators.h (enum class): likewise gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/cmp1.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-01-07gccrs: fix ICE in borrows to invalid expressionsPhilip Herron5-10/+33
We need to check if the borrowed value is valid before creating the reference type. Otherwise this will lead to an ICE. Fixes Rust-GCC#3140 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): check for error * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): likewise and remove debug error gcc/testsuite/ChangeLog: * rust/compile/issue-3046.rs: remove old error message * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3140.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-01-07nr2.0: Improve default, top-level, and late resolversOwen Avery7-65/+41
gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Make sure to scope visitation of the children of type definition items. * resolve/rust-default-resolver.h (DefaultResolver::visit): Add overrides for TupleStruct, Union, and TypeAlias. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove override for Enum. * resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Rely more on DefaultResolver::visit. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Remove override for BlockExpr. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-01-06gccrs: fix ICE during HIR dumpPhilip Herron1-3/+6
These hir nodes have optional expressions which need guarded gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::do_qualifiedpathtype): add guard (Dump::do_traitfunctiondecl): likewise (Dump::visit): likewise Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2025-01-06gccrs: use StackedContexts for block contextPrajwal S N5-35/+15
Replaces the DIY vector stack with a StackedContexts object for block scopes in the type checker context. Fixes #3284. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h (class TypeCheckContext): add header file and use StackedContexts for blocks * typecheck/rust-typecheck-context.cc: update methods * typecheck/rust-hir-trait-resolve.cc: refactor function calls * typecheck/rust-hir-type-check-implitem.cc: refactor function calls * typecheck/rust-hir-type-check-type.cc: refactor function calls Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-01-06ast: Add new Kind enums for more precise downcastingArthur Cohen11-55/+229
This commit adds things like Item::Kind, Expr::Kind, etc, and implements the associated `get_*_kind` functions. It also removes the more generic AST::Kind enum we were using, which was incomplete and painful to use. gcc/rust/ChangeLog: * ast/rust-ast.h: Add new Kind enums, remove Node class. * ast/rust-builtin-ast-nodes.h: Use new Kind enums. * ast/rust-expr.h (class LoopLabel): Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.h: Likewise. * expand/rust-macro-builtins-helpers.cc: Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise. * resolve/rust-early-name-resolver.cc: Likewise. * hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Likewise.
2025-01-06nr2.0: Resolve type aliases inside trait definitionsOwen Avery3-5/+10
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add visitor for TraitItemType. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-01-03tychk: Add more support for additional trait bounds in functionsArthur Cohen7-3/+78
This commit correctly lowers and typechecks parenthesized types, which are used for trait objects with additional bounds. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveType::visit): New visitor to handle ParenthesizedType. * resolve/rust-ast-resolve-type.h: Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise. * typecheck/rust-hir-type-check-type.h: Likewise. gcc/testsuite/ChangeLog: * rust/compile/auto_traits2.rs: New test. * rust/compile/auto_traits3.rs: New test. * rust/compile/nr2/exclude: Add auto_traits2 test.
2025-01-03lower: Correctly lower parenthesized typesArthur Cohen3-0/+48
This is useful for handling multiple trait bounds, and required for better handling of auto traits. gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Add implementation for ParenthesizedType. * hir/rust-ast-lower-type.h: Declare that new visitor. gcc/testsuite/ChangeLog: * rust/compile/auto_traits1.rs: New test.
2025-01-03Remove Rust::make_uniqueOwen Avery22-94/+50
Since our bootstrap requirement has been bumped to C++14, we don't need a custom implementation of std::make_unique anymore. gcc/rust/ChangeLog: * ast/rust-ast-builder-type.cc: Remove inclusion of rust-make-unique.h. * ast/rust-ast-builder.cc: Likewise. (Builder::array): Use std::make_unique instead of Rust::make_unique. * ast/rust-ast.cc (Attribute::get_traits_to_derive): Likewise. * ast/rust-macro.h: Remove inclusion of rust-make-unique.h. (MacroRulesDefinition::mbe): Use std::make_unique instead of Rust::make_unique. (MacroRulesDefinition::decl_macro): Likewise. * ast/rust-path.h (PathInExpression::PathInExpression): Likewise. (QualifiedPathInExpression::QualifiedPathInExpression): Likewise. * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): Likewise. * expand/rust-derive-copy.cc (DeriveCopy::copy_impl): Likewise. * expand/rust-expand-format-args.cc (expand_format_args): Likewise. * expand/rust-macro-builtins-asm.cc: Remove inclusion of rust-make-unique.h. (parse_asm): Use std::make_unique instead of Rust::make_unique. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. * hir/tree/rust-hir-expr.cc (StructExprStructFields::StructExprStructFields): Likewise. (StructExprStructFields::operator=): Likewise. * hir/tree/rust-hir.cc (TypePath::to_trait_bound): Likewise. * lex/rust-token.h: Remove inclusion of rust-make-unique.h. (Token::Token): Use std::make_unique instead of Rust::make_unique. * metadata/rust-import-archive.cc: Remove inclusion of rust-make-unique.h. (Import::find_archive_export_data): Use std::make_unique instead of Rust::make_unique. * metadata/rust-imports.cc: Remove inclusion of rust-make-unique.h. (Import::find_export_data): Use std::make_unique instead of Rust::make_unique. (Import::find_object_export_data): Likewise. * parse/rust-parse-impl.h: Remove inclusion of rust-make-unique.h. (Parser::parse_function_param): Use std::make_unique instead of Rust::make_unique. (Parser::parse_self_param): Likewise. (Parser::parse_array_expr): Likewise. * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise. * typecheck/rust-hir-type-check.cc: Remove inclusion of rust-make-unique.h. (TraitItemReference::get_type_from_fn): Use std::make_unique instead of Rust::make_unique. * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Likewise. * util/rust-make-unique.h: Removed. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-01-03ast: Add EnumItem::KindArthur Cohen1-0/+52
gcc/rust/ChangeLog: * ast/rust-item.h: Add EnumItem::Kind for differentiating all variants that may be used inside an enum declaration.
2025-01-02nr2.0: Handle "Self" properly in trait definitionsOwen Avery5-7/+18
gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit implicit Self parameters of traits. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Resolve implicit Self parameters of traits. * resolve/rust-late-name-resolver-2.0.h: (Late::visit): Add trait visitor. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert resolutions for Self type parameters as well. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2025-01-02Fix NR2.0 compiler ICE caused by Generics in EnumsLiam Naddell4-0/+27
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc: Change the late name resolver to enter proper lexical scope during typechecking * resolve/rust-late-name-resolver-2.0.h: Add needed prototype to header * resolve/rust-toplevel-name-resolver-2.0.cc: Add generic parameters to enum's scoped RIB to allow for proper name resolution on types. gcc/testsuite/ChangeLog: * rust/compile/issue-3304.rs: Add small test for generics+enums combination for NR2.0 Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
2024-12-31ast-builder: Add more methodsArthur Cohen2-0/+121
This commit adds new methods for building pattern nodes, match expressions and more precise call expressions. gcc/rust/ChangeLog: * ast/rust-ast-builder.cc: Add new functions. * ast/rust-ast-builder.h: Declare them.
2024-12-31ast: Add new constructors for PathInExpressionArthur Cohen1-1/+20
This commit adds two new constructors for AST::PathInExpression: One using a provided lang-item, and one with an already built std::unique_ptr<Path> gcc/rust/ChangeLog: * ast/rust-path.h: Add two new constructors.
2024-12-31lang-items: Collect trait functions that are lang itemsArthur Cohen2-0/+9
gcc/rust/ChangeLog: * ast/rust-collect-lang-items.cc (CollectLangItems::visit): Add visitor for collecting functions that might be lang items. * ast/rust-collect-lang-items.h: Likewise.
2024-12-31lang-item: Add Option::{None, Some}, Iterator::next, IntoIter::into_iterArthur Cohen2-0/+15
gcc/rust/ChangeLog: * util/rust-lang-item.h: Add new lang items. * util/rust-lang-item.cc: Likewise.
2024-12-31lang-item: Add Sync traitArthur Cohen2-0/+2
gcc/rust/ChangeLog: * util/rust-lang-item.h: Add Sync marker trait. * util/rust-lang-item.cc: Likewise.
2024-12-31typecheck: Add note about erorring out on additional trait bounds.Arthur Cohen1-0/+5
If additional trait bounds aren't auto traits, then the typechecker must error out (Rust-GCC#3008) gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc: Add TODO note.
2024-12-31resolve: Name resolve trait bounds properlyArthur Cohen6-4/+87
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): Resolve additional trait bounds. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Error out properly on unresolved type-path instead of crashing. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Exclude additional-trait-bounds2 for different error message. * rust/compile/additional-trait-bounds1.rs: New test. * rust/compile/additional-trait-bounds2.rs: New test. * rust/compile/additional-trait-bounds2nr2.rs: New test.
2024-12-31parser: Add testcases for multiline stringsArthur Cohen2-0/+29
Regression checks for Rust-GCC#1399 gcc/testsuite/ChangeLog: * rust/compile/multiline-string.rs: New test. * rust/execute/torture/multiline-string.rs: New test.
2024-12-24typecheck-path: Fix typo (reciever -> receiver)Arthur Cohen3-8/+8
gcc/rust/ChangeLog: * typecheck/rust-hir-path-probe.cc: Fix typos. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-type-check-path.cc: Likewise.
2024-12-23add ptr to int and int to ptr type cast rulesNobel2-2/+43
Added rules to allow type casting pointer as integer types (u*,i*) and integer types to be casted as pointer. gcc/rust/ChangeLog: * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule. gcc/testsuite/ChangeLog: * rust/compile/ptr_int_cast.rs: New test. Signed-off-by: Nobel Singh <nobel2073@gmail.com>
2024-12-19gccrs: disable macos github workflowPhilip Herron1-58/+58
Its broken at the moment. ChangeLog: * .github/workflows/ccpp.yml: comment it out Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-12-19gccrs: Made changes to AST::TraitImpl constructor for TypePathSri Ganesh Thota1-7/+6
gcc/rust/ChangeLog: * ast/rust-item.h: I have changed helper constructor for typepath to be a delegating constructor. Signed-off-by: Sri Ganesh Thota <sriganeshthota12345@gmail.com>
2024-12-13gccrs: implement the TuplePattern and use it for function patternsPhilip Herron5-14/+117
In order to handle the tuple pattern of: fn test ((x _) : (i32, i32)) -> i32 { x } we need to recognize that ABI wise this function still takes a tuple as the parameter to this function its just how we can address the "pattern" of the tuple changes. So reall if this was C it would look like: void test (struct tuple_type __prameter) { return __parameter.0 } The code here reuses our existing pattern code so that we generate these implicit bindings of the paramter with a field access so any time x is referenced it's really just emplacing __parameter.0 for the field access into the struct which is a tuple. Fixes Rust-GCC#2847 gcc/rust/ChangeLog: * backend/rust-compile-fnparam.cc (CompileFnParam::visit): compile tuple patterns (CompileSelfParam::compile): update return type (CompileFnParam::create_tmp_param_var): return Bvariable not tree to stop ICE * backend/rust-compile-fnparam.h: update prototype * backend/rust-compile-pattern.cc (CompilePatternBindings::visit): implement TuplePattern * backend/rust-compile-pattern.h: update prototype gcc/testsuite/ChangeLog: * rust/compile/issue-2847.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-12-13gccrs: fix bad not expression in rustPhilip Herron1-1/+1
Fixes Rust-GCC#3229 gcc/rust/ChangeLog: * rust-gcc.cc (operator_to_tree_code): ! expressions are BIT_NOT_EXPR Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-12-10ci: update warnings after C++14 changeSam James2-2/+2
ChangeLog: * .github/glibcxx_ubuntu64b_log_expected_warnings: Update. * .github/log_expected_warnings: Update.
2024-12-10build: update bootstrap req to C++14Jason Merrill3-76/+795
We moved to a bootstrap requirement of C++11 in GCC 11, 8 years after support was stable in GCC 4.8. It is now 8 years since C++14 was the default mode in GCC 6 (and 9 years since support was complete in GCC 5), and we have a few bits of optional C++14 code in the compiler, so it seems a good time to update the bootstrap requirement again. The big benefit of the change is the greater constexpr power, but C++14 also added variable templates, generic lambdas, lambda init-capture, binary literals, and numeric literal digit separators. C++14 was feature-complete in GCC 5, and became the default in GCC 6. 5.4.0 bootstraps trunk correctly; trunk stage1 built with 5.3.0 breaks in eh_data_format_name due to PR69995. gcc/ChangeLog: * doc/install.texi (Prerequisites): Update to C++14. ChangeLog: * configure.ac: Update requirement to C++14. * configure: Regenerate.
2024-12-09lang-item: Remove unused NodeId from LangItemPathArthur Cohen1-39/+37
gcc/rust/ChangeLog: * ast/rust-path.h: Adapt children of Path to fix some NodeId issues.
2024-12-09nr2.0: Resolve lang item paths properly.Arthur Cohen2-0/+21
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): New. * resolve/rust-late-name-resolver-2.0.h: New.
2024-12-09hir: Lower lang-item pathsArthur Cohen3-14/+43
gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt to handle lang item paths. (ASTLowerTypePath::visit): Likewise. (ASTLowerTypePath::translate_type_path): New. (ASTLowerTypePath::translate_lang_item_type_path): New. * hir/rust-ast-lower-type.h: Adapt to handle lang item paths. * resolve/rust-ast-resolve-type.h: Likewise.
2024-12-09nr1.0: Resolve lang item paths properly.Arthur Cohen2-9/+32
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt resolver to lang item paths. * resolve/rust-ast-resolve-type.h: Likewise.
2024-12-09hir: Start adapting visitors to accept multiple kinds of PathsArthur Cohen6-3/+47
gcc/rust/ChangeLog: * ast/rust-item.h: Add new method to specifically get a type-path. * ast/rust-path.cc (LangItemPath::as_string): Implement properly. * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt visitor to use the new LangItemPath. * hir/rust-ast-lower-type.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-type.h: Likewise.
2024-12-09derive(Copy): Use new LangItemPathArthur Cohen1-2/+4
gcc/rust/ChangeLog: * expand/rust-derive-copy.cc: Use new LangItemPath for derive(Copy).
2024-12-09ast: Add LangItemPath classArthur Cohen3-34/+71
This commit adds a new kind of Path, changes the base Path class and turns TypePath into a child of the base Path class. gcc/rust/ChangeLog: * ast/rust-path.h (class LangItemPath): New. (class TypePath): Adapt to accomodate LangItemPath. * ast/rust-ast.cc (TraitImpl::as_string): Use new checks for lang items. (QualifiedPathType::as_string): Likewise. (FormatArgs::set_outer_attrs): Likewise. * ast/rust-item.h (class TraitImpl): Likewise.
2024-12-09ci: Update expected warnings list for 32 bits build.Arthur Cohen1-23/+3
ChangeLog: * .github/alpine_32bit_log_warnings: Update with new warnings.
2024-12-09Fix ForeverStack::find_starting_point output parameterOwen Avery2-7/+9
gcc/rust/ChangeLog: * resolve/rust-forever-stack.h (ForeverStack::find_starting_point): Use type 'std::reference_wrapper<Node> &' instead of 'Node &' for parameter starting_point. * resolve/rust-forever-stack.hxx (ForeverStack::find_starting_point): Likewise. (ForeverStack::resolve_path): Handle change to ForeverStack::find_starting_point. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-12-05type-check: Remove unused capture in nr2.0Arthur Cohen1-3/+3
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Remove unused capture in lambda.
2024-12-04attributes: Add class for sharing methods on attributes.Arthur Cohen4-20/+18
gcc/rust/ChangeLog: * util/rust-attributes.h (class Attributes): New. * util/rust-attributes.cc: Implement Attributes::is_known(). * ast/rust-collect-lang-items.cc (is_known_attribute): Remove. (get_lang_item_attr): Call Attributes::is_known() instead. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise. (ASTLoweringBase::is_known_attribute): Remove.
2024-12-04lang-items: Add lang-items AST collectorArthur Cohen4-1/+160
gcc/rust/ChangeLog: * Make-lang.in: Add new object file. * rust-session-manager.cc (Session::compile_crate): Call CollectLangItems. * ast/rust-collect-lang-items.cc: New file. * ast/rust-collect-lang-items.h: New file.
2024-12-04lang-items: Store NodeId mappings for lang itemsArthur Cohen2-0/+30
gcc/rust/ChangeLog: * util/rust-hir-map.h: Keep a NodeId mappings for lang items. * util/rust-hir-map.cc (Mappings::insert_lang_item_node): New function. (Mappings::lookup_lang_item_node): Likewise.