aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
AgeCommit message (Collapse)AuthorFilesLines
4 daysgccrs: lower: Error out when lowering ErrorPropagationExprArthur Cohen4-197/+188
Adapt functions for lowering nodes that should never reach the lowering phase to cause an unreachable, and mark them as final so as it not possible to override them in other visitors. gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc: Adapt functions for ErrorPropagationExpr and MacroInvocation. * hir/rust-ast-lower-base.h: Mark them as final. * hir/rust-ast-lower-expr.cc: Remove previous definition for those overrides. * hir/rust-ast-lower-expr.h: Likewise.
4 daysgccrs: lower: Always crash when lowering macro invocationsArthur Cohen1-3/+8
gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add base implementation for visitor.
4 daysgccrs: hir-dump: Fix more segfaults in the HIR dumpArthur Cohen2-3/+25
gcc/rust/ChangeLog: * hir/rust-hir-dump.cc: Check unique_ptr members are present before visiting them. * hir/tree/rust-hir-path.h: Add `has_{type, trait}` methods to QualifiedPathInType.
4 daysgccrs: Add name resolution and HIR lowering for ImplTraitType'sPhilip Herron8-66/+39
Our AST has ImplTraitType for multiple bounds and a singular ImplTraitTypeOneBound, this patch desugars these into a simple HIR::ImplTraitType. It also does the name resolution for this. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-struct.h: remove HIR::ImplTraitTypeOneBound * checks/errors/borrowck/rust-function-collector.h: likewise * checks/errors/rust-const-checker.cc (ConstChecker::visit): likewise * checks/errors/rust-const-checker.h: likewise * checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit): likewise * checks/errors/rust-hir-pattern-analysis.h: likewise * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): likewise * checks/errors/rust-unsafe-checker.h: likewise * hir/rust-ast-lower-type.cc (ASTLoweringType::translate): likewise (ASTLoweringType::visit): likewise * hir/rust-ast-lower-type.h: cleanup * hir/rust-hir-dump.cc (Dump::visit): remove ImplTraitTypeOneBound * hir/rust-hir-dump.h: likewise * hir/tree/rust-hir-full-decls.h (class ImplTraitTypeOneBound): likewise * hir/tree/rust-hir-type.h (class ImplTraitTypeOneBound): likewise * hir/tree/rust-hir-visitor.h: likewise * hir/tree/rust-hir.cc (ImplTraitTypeOneBound::as_string): likewise (ImplTraitTypeOneBound::accept_vis): likewise * resolve/rust-ast-resolve-type.cc (ResolveType::go): likewise (ResolveType::visit): likewise * resolve/rust-ast-resolve-type.h: add name resolution * typecheck/rust-hir-type-check-type.h: likewise Signed-off-by: Philip Herron <herron.philip@googlemail.com>
4 daysgccrs: self paths are patterns but we dont have mappings for itPhilip Herron1-0/+1
With simple patterns we dont introduce any more inference varaibles as they are already declared in a specific way. This would only lead to more unconstrained inference varaibles than is required. Fixes Rust-GCC#3022 gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): add location mappings * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): check for self gcc/testsuite/ChangeLog: * rust/compile/issue-3022.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
4 daysgccrs: ast: Add DesugarForLoop classArthur Cohen1-1/+1
gcc/rust/ChangeLog: * ast/rust-desugar-for-loops.cc: New file. * ast/rust-desugar-for-loops.h: New file. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Make lowering of for-loops an unreachable. * Make-lang.in: Compile it. gcc/testsuite/ChangeLog: * rust/compile/for-loop1.rs: New test. * rust/compile/for-loop2.rs: New test. * rust/execute/torture/for-loop1.rs: New test. * rust/execute/torture/for-loop2.rs: New test. * rust/compile/nr2/exclude: Exclude for-loop1.rs
4 daysgccrs: hir: Add LangItem paths to PathPattern classArthur Cohen3-8/+104
gcc/rust/ChangeLog: * hir/tree/rust-hir-path.h: Adapt PathPattern to accept lang-item paths. * hir/tree/rust-hir-path.cc: Assert we are dealing with a segmented path, create lang-item constructors. * hir/tree/rust-hir.cc (PathPattern::convert_to_simple_path): Likewise.
4 daysgccrs: ast: More visitors to allow lang item paths in expressionsArthur Cohen1-22/+13
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Adapt visitor to lang item PathInExpressions. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): Likewise. (ASTLowerPathInExpression::visit): Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
4 daysgccrs: hir-dump: Improve handling of typepathsegments that are lang items.Arthur Cohen1-1/+4
gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::do_typepathsegment): Add handling for lang items.
4 daysgccrs: typecheck: Add basic handling for applying auto trait boundsArthur Cohen1-5/+6
gcc/rust/ChangeLog: * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Register auto traits in mappings. * util/rust-hir-map.cc (Mappings::insert_auto_trait): New. (Mappings::get_auto_traits): New. * util/rust-hir-map.h: Declare them. * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Add auto trait bounds when scanning. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Some parts of nr2.0 can't handle auto traits yet. * rust/compile/auto_traits3.rs: Removed in favor of... * rust/compile/auto_traits2.rs: ...this one. * rust/compile/auto_traits4.rs: New test.
7 daysgccrs: lower: Properly lower non-generic lang item type path segments.Arthur Cohen1-26/+14
gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Adapt code to lang item type path segments.
7 daysgccrs: ast: Refactor how lang item paths are handled.Arthur Cohen6-57/+91
Lang item typepaths were not handled properly, and required a complete overhaul. All old classes that concerned lang item paths are now modified to use a simpler version of `AST::LangItemPath`, which has been removed. TypePath segments can now be lang items, as this is requied for having generic lang item paths such as PhantomData<T>. gcc/rust/ChangeLog: * ast/rust-path.h: Rework how lang item paths are represented. * ast/rust-path.cc: Likewise. * ast/rust-item.h: Likewise. * ast/rust-ast.cc: Likewise. * ast/rust-ast-collector.cc: Adapt to new lang item path system. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * expand/rust-derive-copy.cc: Likewise. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Likewise. (ASTLowerTypePath::visit): Likewise. * hir/rust-ast-lower-type.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-type.h: Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise. * resolve/rust-late-name-resolver-2.0.h: Likewise. * hir/tree/rust-hir-path.cc (TypePathSegment::TypePathSegment): Likewise. (TypePathSegmentGeneric::TypePathSegmentGeneric): Likewise. * hir/tree/rust-hir-path.h: Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Likewise. * ast/rust-ast-builder.cc: Likewise. * ast/rust-ast-builder.h: Likewise.
7 daysgccrs: Add missing name resolution to static items in blocksPhilip Herron2-0/+7
We need to add name resolution and hir lowering for items as part of blocks in order to typecheck and compile them correctly. Fixes Rust-GCC#3350 gcc/rust/ChangeLog: * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): hir lowering * hir/rust-ast-lower-stmt.h: likewise * resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): name resolution * resolve/rust-ast-resolve-stmt.h: likewise gcc/testsuite/ChangeLog: * rust/compile/issue-3350.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
7 daysgccrs: 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>
7 daysgccrs: add support for lang_item eq and PartialEq traitPhilip Herron2-0/+8
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>
7 daysgccrs: 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>
7 daysgccrs: ast: Add new Kind enums for more precise downcastingArthur Cohen1-1/+5
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.
7 daysgccrs: lower: Correctly lower parenthesized typesArthur Cohen2-0/+21
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.
7 daysgccrs: Remove Rust::make_uniqueOwen Avery3-8/+8
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>
7 daysgccrs: hir: Lower lang-item pathsArthur Cohen2-11/+40
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.
7 daysgccrs: hir: Start adapting visitors to accept multiple kinds of PathsArthur Cohen2-0/+10
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.
7 daysgccrs: attributes: Add class for sharing methods on attributes.Arthur Cohen1-8/+2
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.
7 daysgccrs: fix crash in hir dumpPhilip Herron1-1/+2
gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value Signed-off-by: Philip Herron <herron.philip@googlemail.com>
7 daysgccrs: hir: Remove duplicate function in TraitItemFuncArthur Cohen1-2/+0
Both TraitItemFunc::has_definition() and TraitItemFunc::has_block_defined() were exactly the same implementation, so remove one. gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: Remove TraitItemFunc::has_block_defined() * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Call TraitItemFunc::has_definition() instead. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * typecheck/rust-hir-trait-resolve.cc (ResolveTraitItemToRef::visit): Likewise.
7 daysgccrs: fix crash in hir dump with missing guardsPhilip Herron1-4/+8
gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add missing null checks Signed-off-by: Philip Herron <herron.philip@googlemail.com>
7 daysgccrs: fix crashes in hir dump since move to referencesPhilip Herron1-4/+8
gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): add guards Signed-off-by: Philip Herron <herron.philip@googlemail.com>
7 daysgccrs: Clean up some system includesPierre-Emmanuel Patry1-1/+1
System includes shall use rust-system header instead. gcc/rust/ChangeLog: * ast/rust-stmt.h: Remove stdlib include and use rust-system instead. * backend/rust-compile-expr.cc: Likewise. * backend/rust-mangle-legacy.cc: Likewise. * backend/rust-mangle-v0.cc: Likewise. * hir/rust-hir-dump.cc: Likewise. * typecheck/rust-hir-type-check-type.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. * typecheck/rust-tyty.h: Likewise. * util/rust-common.h: Likewise. * util/rust-token-converter.cc: Likewise. * util/rust-token-converter.h: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Add optional template arguments to please GCC4.8Pierre-Emmanuel Patry2-5/+8
Clang on macos as well as GCC 4.8 complains when those templates are missing. gcc/rust/ChangeLog: * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Add template to tl::optional. * hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Refactor optional initializersPierre-Emmanuel Patry1-9/+11
Refactor some optional initializer in the lowering stage to make them more readable. gcc/rust/ChangeLog: * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Change the ternary expression with a more readable if. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Fix Generic type retrievalPierre-Emmanuel Patry4-20/+25
gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Forward an optional to the constructor. * hir/tree/rust-hir-item.cc (TypeParam::TypeParam): Use an optional in the constructor. (TypeParam::operator=): Ensure the TypeParam has a type properly. (TypeParam::get_type_mappings): Likewise. * hir/tree/rust-hir-item.h: Wrap the type smart pointer into an optional. * hir/tree/rust-hir.cc (TypeParam::as_string): Unwrap optional type correctly. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Fixes some tests appearing with a moved variantPierre-Emmanuel Patry7-46/+137
A variant being moved lead to a null being created and a segfault later down the line. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Call getter instead of size function. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Only check privacy if the type is present. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Use an optional. * hir/tree/rust-hir-generic-param.h: Assert type before getting it. * hir/tree/rust-hir-item.h: Assert pointers before dereference, fix has_type condition. * hir/tree/rust-hir-path.h: Add more assertions. * hir/tree/rust-hir-stmt.cc: Change constructor with optionals. * hir/tree/rust-hir-stmt.h: Use optionals over smart pointers to emphasize these fields might be missing. * hir/tree/rust-hir.cc (LetStmt::as_string): Use getters. * typecheck/rust-hir-type-check-expr.cc: Clone structures to prevent parent's fields from being nulled by the move operation. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Use optionals. * typecheck/rust-tyty.cc: Likewise. * typecheck/rust-tyty.h: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Refactor hir to avoid raw pointers and unneeded fwdPierre-Emmanuel Patry32-3413/+5175
Refactor the hir tree files to remove raw pointer usage and most forward declarations. Move implementation out of headers and split headers into smaller and more manageable units. gcc/rust/ChangeLog: * Make-lang.in: Add new files. * hir/tree/rust-hir-item.h: Move Item definition and remove implementations to their corresponding cc file. * hir/tree/rust-hir-expr.h: Move implementation to the corresponding cc file. * hir/tree/rust-hir-path.h: Likewise. * hir/tree/rust-hir-pattern.h: Likewise. * hir/tree/rust-hir-stmt.h: Likewise. * hir/tree/rust-hir-type.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * hir/tree/rust-hir.h: Likewise. * hir/tree/rust-hir.cc (Crate::Crate): Add implementations from Crate and remove ConstGenericParam implementations to move them to their own file. * hir/tree/rust-hir-attrs.h: New file. * hir/tree/rust-hir-bound-abstract.h: New file. * hir/tree/rust-hir-bound.h: New file. * hir/tree/rust-hir-expr-abstract.h: New file. * hir/tree/rust-hir-expr.cc: New file. * hir/tree/rust-hir-generic-param.cc: New file. * hir/tree/rust-hir-generic-param.h: New file. * hir/tree/rust-hir-item.cc: New file. * hir/tree/rust-hir-literal.h: New file. * hir/tree/rust-hir-node.h: New file. * hir/tree/rust-hir-path.cc: New file. * hir/tree/rust-hir-pattern-abstract.h: New file. * hir/tree/rust-hir-simple-path.h: New file. * hir/tree/rust-hir-stmt.cc: New file. * hir/tree/rust-hir-trait-bound.h: New file. * hir/tree/rust-hir-type-abstract.cc: New file. * hir/tree/rust-hir-type-abstract.h: New file. * hir/tree/rust-hir-type-no-bounds.h: New file. * hir/tree/rust-hir-type.cc: New file. * hir/tree/rust-hir-visibility.h: New file. * hir/tree/rust-hir-visitable.h: New file. * checks/lints/rust-lint-marklive.h: Use References. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Reformat vectors. * hir/rust-hir-dump.cc (Dump::visit): Use reference. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): Use references. * typecheck/rust-tyty-bounds.cc: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Refactor HIR with optionals, references & newtypesPierre-Emmanuel Patry3-3/+6
The HIR made heavy use of pair and other unamed types which can be difficult to read. gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Use FnParam getter. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-intrinsic.cc: Likewise. * backend/rust-compile-type.cc: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Only visit childrens if not missing. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Use a reference instead of a raw pointer. * hir/tree/rust-hir-expr.h: Add presence function for return expression. * hir/tree/rust-hir-item.h: Remove take_param_name. * hir/tree/rust-hir.h: Make mapping getter const. * typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): Use getter. * typecheck/rust-hir-type-check-expr.cc: Likewise. * typecheck/rust-hir-type-check-implitem.cc: Use FnParam vector instead of std::pair of Pattern and BaseType. * typecheck/rust-hir-type-check-item.cc: Likewise. * typecheck/rust-hir-type-check.cc: Likewise. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use getters. (TypeCheckMethodCallExpr::check): Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty.cc: Use FnParam. * typecheck/rust-tyty.h (class FnParam): Add FnParam to handle function parameters instead of handling std::pairs. * typecheck/rust-unify.cc (UnifyRules::expect_fndef): Use getters. (UnifyRules::expect_fnptr): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: Refactor HIR to reduce the amount of raw pointersPierre-Emmanuel Patry8-142/+140
Attempt to use references and smart pointers whenever possible. gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::compile_function_body): Remove usage of get function to retrieve a raw pointer. * backend/rust-compile-base.h: Change API usage from raw pointer to a reference. * backend/rust-compile-block.cc (CompileBlock::compile): Likewise. (CompileBlock::visit): Likewise. (CompileConditionalBlocks::visit): Likewise. * backend/rust-compile-block.h: Likewise. * backend/rust-compile-expr.cc (CompileExpr::Compile): Likewise. (CompileExpr::visit): Likewise. (check_match_scrutinee): Likewise. (CompileExpr::array_value_expr): Likewise. (CompileExpr::array_copied_expr): Likewise. (CompileExpr::generate_closure_function): Likewise. (CompileExpr::generate_possible_fn_trait_call): Likewise. * backend/rust-compile-expr.h: Likewise. * backend/rust-compile-fnparam.cc (CompileFnParam::compile): Likewise. (CompileFnParam::visit): Likewise. * backend/rust-compile-fnparam.h: Likewise. * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise. * backend/rust-compile-intrinsic.cc (compile_fn_params): Likewise. * backend/rust-compile-item.cc (CompileItem::visit): Likewise. * backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): Likewise. (compile_range_pattern_bound): Likewise. (CompilePatternBindings::visit): Likewise. (CompilePatternLet::visit): Likewise. * backend/rust-compile-pattern.h: Likewise. * backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Likewise. (HIRCompileBase::query_compile): Likewise. * backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise. * backend/rust-compile-struct-field-expr.cc (CompileStructExprField::Compile): Likewise. (CompileStructExprField::visit): Likewise. * backend/rust-compile-struct-field-expr.h: Likewise. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise. * backend/rust-compile-var-decl.h: Likewise. * backend/rust-compile.cc: Likewise. * backend/rust-mangle-v0.cc (v0_inherent_or_trait_impl_path): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise. * checks/errors/borrowck/rust-bir-builder-struct.h: Likewise. * checks/errors/borrowck/rust-bir-builder.h: Likewise. * checks/errors/borrowck/rust-function-collector.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_type_privacy): Likewise. (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise. * checks/lints/rust-lint-marklive.h: Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/tree/rust-hir-expr.h: Likewise. * hir/tree/rust-hir-item.h: Likewise. * hir/tree/rust-hir-path.h: Likewise. * hir/tree/rust-hir-pattern.h: Likewise. * hir/tree/rust-hir-stmt.h: Likewise. * hir/tree/rust-hir-type.h: Likewise. * hir/tree/rust-hir.h: Likewise. * typecheck/rust-autoderef.cc: 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_impl_item_candidate): Likewise. (PathProbeImplTrait::process_trait_impl_items_for_candidates): Likewise. * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Likewise. (TraitItemReference::resolve_item): Likewise. * typecheck/rust-hir-type-check-base.cc: Likewise. * typecheck/rust-hir-type-check-base.h: Likewise. * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::Resolve): Likewise. (TypeCheckEnumItem::visit): Likewise. * typecheck/rust-hir-type-check-enumitem.h: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve): Likewise. (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resolve_fn_trait_call): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::Resolve): Likewise. (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. (TypeCheckImplItemWithTrait::visit): Likewise. * typecheck/rust-hir-type-check-implitem.h: Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. (TypeCheckItem::resolve_impl_item): Likewise. (TypeCheckItem::resolve_impl_block_substitutions): Likewise. (TypeCheckItem::resolve_impl_block_self): Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resolve_segments): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::Resolve): Likewise. (TypeCheckPattern::visit): Likewise. (ClosureParamInfer::Resolve): Likewise. (ClosureParamInfer::visit): Likewise. * typecheck/rust-hir-type-check-pattern.h: Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::Resolve): Likewise. (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h: Likewise. * typecheck/rust-hir-type-check-struct-field.h: Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::TypeCheckStructExpr): Likewise. (TypeCheckStructExpr::Resolve): Likewise. (TypeCheckStructExpr::resolve): Likewise. (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckResolveGenericArguments::resolve): Likewise. (TypeCheckType::Resolve): Likewise. (TypeCheckType::visit): Likewise. (TypeCheckType::resolve_root_path): Likewise. (TypeResolveGenericParam::Resolve): Likewise. (TypeResolveGenericParam::visit): Likewise. (ResolveWhereClauseItem::visit): Likewise. * typecheck/rust-hir-type-check-type.h: Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. * typecheck/rust-hir-type-check.h: Likewise. * typecheck/rust-type-util.cc (query_type): Likewise. * typecheck/rust-typecheck-context.cc (TypeCheckContextItem::TypeCheckContextItem): Likewise. * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise. (TypeCheckBase::get_predicate_from_bound): Likewise. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. (TypeCheckMethodCallExpr::go): Likewise. (TypeCheckMethodCallExpr::check): Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Likewise. (VariantDef::VariantDef): Remove copy constructor. (VariantDef::operator=): Change to move operator. (VariantDef::get_discriminant): Replace return type to a reference instead of a reference to a unique pointer. (VariantDef::clone): Change to references. (VariantDef::monomorphized_clone): Likewise. (FnType::as_string): Likewise. (FnType::clone): Likewise. * typecheck/rust-tyty.h: Likewise. * util/rust-hir-map.cc (Mappings::insert_hir_impl_block): Likewise. * backend/rust-compile-asm.cc: Use a reference instead of the raw pointer value. * checks/errors/borrowck/rust-bir-builder-pattern.cc: Use references. * checks/errors/rust-hir-pattern-analysis.cc: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
7 daysgccrs: asm: Fix clang warningsArthur Cohen1-2/+2
Fixes a couple of warnings thrown by clang, with mismatched class/struct usages and unused members. gcc/rust/ChangeLog: * ast/rust-expr.h: Remove invalid usage of `struct`. * backend/rust-compile-asm.h: Remove unused `translated` member. * backend/rust-compile-asm.cc (CompileAsm::CompileAsm): Remove usage of `translated` member. * checks/errors/rust-unsafe-checker.h: Mark visitor as `override`. * hir/tree/rust-hir-expr.h (struct AnonConst): Remove unused `locus` member.
7 daysgccrs: hir: Mark AttrVec::get_outer_attrs as overrideArthur Cohen1-1/+1
gcc/rust/ChangeLog: * hir/tree/rust-hir.h: Add override qualifier to overriden method.
7 daysgccrs: Improve handling of implicit Self parameter in ASTOwen Avery1-0/+6
gcc/rust/ChangeLog: * ast/rust-item.h (Trait::self_param): Add. (Trait::Trait): Initialize self_param. (Trait::operator=): Copy self_param. (Trait::insert_implicit_self): Remove. (Trait::get_implicit_self): Add. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Make sure implicit self is still lowered to HIR. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adjust handling of implicit self. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Add commit to Trait visitor mentioning that implicit self is not visited. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Remove call to Trait::insert_implicit_self. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. * rust/link/generic_function_0.rs: No longer expect failure. * rust/link/trait_import_0.rs: Likewise. * rust/link/trait_import_1.rs (trait Sized): Add. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
7 daysrust: Desugar IfLet* into MatchExprMarc Poulhiès10-309/+126
Replace the "regular" AST->HIR lowering for IfLet* with a desugaring into a MatchExpr. Desugar a simple if let: if let Some(y) = some_value { bar(); } into: match some_value { Some(y) => {bar();}, _ => () } Same applies for IfLetExprConseqElse (if let with an else block). Desugar: if let Some(y) = some_value { bar(); } else { baz(); } into: match some_value { Some(y) => {bar();}, _ => {baz();} } Fixes https://github.com/Rust-GCC/gccrs/issues/1177 gcc/rust/ChangeLog: * backend/rust-compile-block.h: Adjust after removal of HIR::IfLetExpr and HIR::IfLetExprConseqElse. * backend/rust-compile-expr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-struct.h: Likewise. * checks/errors/borrowck/rust-function-collector.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h: Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.h: Likewise. * hir/rust-ast-lower-block.h (ASTLoweringIfLetBlock::translate): Change return type. * hir/rust-ast-lower.cc (ASTLoweringIfLetBlock::desugar_iflet): New. (ASTLoweringIfLetBlock::visit(AST::IfLetExpr &)): Adjust and use desugar_iflet. * hir/rust-ast-lower.h: Add comment. * hir/rust-hir-dump.cc (Dump::do_ifletexpr): Remove. (Dump::visit(IfLetExpr&)): Remove. (Dump::visit(IfLetExprConseqElse&)): Remove. * hir/rust-hir-dump.h (Dump::do_ifletexpr): Remove. (Dump::visit(IfLetExpr&)): Remove. (Dump::visit(IfLetExprConseqElse&)): Remove. * hir/tree/rust-hir-expr.h (class IfLetExpr): Remove. (class IfLetExprConseqElse): Remove. * hir/tree/rust-hir-full-decls.h (class IfLetExpr): Remove. (class IfLetExprConseqElse): Remove. * hir/tree/rust-hir-visitor.h: Adjust after removal of HIR::IfLetExpr and HIR::IfLetExprConseqElse. * hir/tree/rust-hir.cc (IfLetExpr::as_string): Remove. (IfLetExprConseqElse::as_string): Remove. (IfLetExpr::accept_vis): Remove. (IfLetExprConseqElse::accept_vis): Remove. * hir/tree/rust-hir.h: Adjust after removal of HIR::IfLetExpr and HIR::IfLetExprConseqElse. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit (IfLetExpr &)): Remove. (PatternChecker::visit (IfLetExprConseqElse &)): Remove. * checks/errors/rust-hir-pattern-analysis.h (visit(IfLetExpr &)): Remove. (visit(IfLetExprConseqElse &)): Remove. gcc/testsuite/ChangeLog: * rust/compile/if_let_expr.rs: Adjust. * rust/compile/if_let_expr_simple.rs: New test. * rust/compile/iflet.rs: New test. * rust/execute/torture/iflet.rs: New test. * rust/compile/nr2/exclude: Add iflet.rs and if_let_expr_simple.rs Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
9 daysgccrs: rust fix ICE when hir lowering qualified path expressions without an asPhilip Herron1-2/+9
Qualified path expressions usually are <X as Y>::... but the as is optional this adds the extra checking in hir lowering to not hit that nullptr. Fixes #3082 gcc/rust/ChangeLog: * hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit): check for valid as segment gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3082.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
9 daysgccrs: adjust hir dump of BlockExprMarc Poulhiès1-0/+2
Add tail_reachable and label fields to the dump. gcc/rust/ChangeLog: * hir/rust-hir-dump.cc (Dump::visit): Add missing fields. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
9 daysrust: negative polarity removes restrictions on validation of impl blocksPhilip Herron1-2/+2
Negative polarity means we can just ignore if any trait items are not implemented. Fxies #3030 gcc/rust/ChangeLog: * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): the polarity was reversed * typecheck/rust-hir-type-check-item.cc: check the polarity gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3030.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
9 daysgccrs: [gccrs#3141] Fix incorrect handling of overflow in numeric typesJoanVC1-0/+9
Fixes gccrs#3141. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc: Fix range checking for both integers and floats. * hir/tree/rust-hir-expr.h: Add "negative_number" boolean to LiteralExpr class. gcc/testsuite/ChangeLog: * rust/compile/issue-3141.rs: New test. Signed-off-by: Joan Vilardaga <github-91yu@joanvc.cat>
9 daysgccrs: Rehaul, Apply code review from Arthurbadumbatish1-2/+2
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::visit): Change API, public/private, comments, formatting from code review (CompileAsm::asm_build_expr): Likewise. (CompileAsm::tree_codegen_asm): Likewise. * backend/rust-compile-asm.h (class CompileAsm): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise. (parse_options): Likewise. (parse_asm_arg): Likewise. (expand_inline_asm_strings): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise. (expand_inline_asm_strings): Likewise. (expand_inline_asm_string): Likewise. * hir/tree/rust-hir-expr.h: Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_typecheck.rs: Change comments
9 daysgccrs: Make inline mov compilesbadumbatish1-2/+2
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Remove debug * expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): properly formatted via rust instead of c (parse_asm): formatted comment (parse_format_strings): formatted comment * hir/tree/rust-hir-expr.h: fix is_simple_asm() gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: Fix format asm * rust/compile/inline_asm_parse_output_operand.rs: Fix format asm * rust/execute/torture/inline_asm_mov_x_5.rs: Move to... * rust/execute/inline_asm_mov_x_5.rs: ...here.
9 daysgccrs: Minor fix to asm codegen prbadumbatish1-1/+11
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Use expr's is_simple_asm and is_inline_asm (CompileAsm::asm_is_simple): removed (CompileAsm::asm_is_inline): removed * backend/rust-compile-asm.h: Add docs to ASM_TREE_ARRAY_LENGTH * hir/tree/rust-hir-expr.h: Add is_simple_asm, is_inline_asm and remove #include tree
9 daysgccrs: Scaffolding new compile-asm filesbadumbatish1-35/+0
gcc/rust/ChangeLog: * Make-lang.in: Scaffolding new compile-asm files * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise * hir/tree/rust-hir-expr.h: Likewise * backend/rust-compile-asm.cc: New file. Likewise * backend/rust-compile-asm.h: New file. Likewise
9 daysgccrs: Setting up interfaces for codegenjjasmine1-0/+26
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Setting up interfaces for codegen * hir/tree/rust-hir-expr.h: Likewise.
9 daysgccrs: Make sure CompileExpr::visit is reachedjjasmine1-1/+3
gcc/rust/ChangeLog: * hir/tree/rust-hir.cc (InlineAsm::accept_vis): Make sure CompileExpr::visit is reached * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_compile_nop.rs: New test.
9 daysgccrs: Scaffolding asm codegenjjasmine2-0/+11
gcc/rust/ChangeLog: * backend/rust-compile-block.h: Scaffolding asm codegen * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-expr.h: Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise.
9 daysgccrs: Add typecheck for path patterns.Raiki Tamura2-0/+40
gcc/rust/ChangeLog: * hir/tree/rust-hir.cc (Item::item_kind_string): New function. * hir/tree/rust-hir.h: New function. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Modify to check all arms in match expressions even if some of them has errors. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add and fix check for path patterns. gcc/testsuite/ChangeLog: * rust/compile/issue-2324-2.rs: Fix error message. * rust/compile/match9.rs: New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>