aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
AgeCommit message (Collapse)AuthorFilesLines
2024-01-16gccrs: Move Backend::error_variable to Bvariable::error_variableOwen Avery2-2/+2
gcc/rust/ChangeLog: * rust-backend.h (Backend::error_variable): Remove. (Gcc_backend::error_variable): Move to ... * rust-gcc.cc (Bvariable::error_variable): ... here ... * rust-gcc.h (Bvariable::error_variable): ... and declare here. (Gcc_backend::global_variable): Update error_variable call. (Gcc_backend::local_variable): Likewise. (Gcc_backend::parameter_variable): Likewise. (Gcc_backend::static_chain_variable): Likewise. (Gcc_backend::temporary_variable): Likewise. * backend/rust-compile-extern.h (CompileExternItem::visit): Likewise. * backend/rust-compile-fnparam.cc (CompileFnParam::CompileFnParam): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Remove Backend::bool_type and Backend::char_typeOwen Avery1-4/+2
gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Inline Backend::bool_type call. * rust-backend.h (Backend::bool_type): Remove. (Backend::char_type): Remove. (Gcc_backend::bool_type): Remove. (Gcc_backend::char_type): Remove. * rust-gcc.cc (Gcc_backend::char_constant_expression): Inline Backend::char_type call. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: New Error Code FrameworkMuhammad Mahad1-1/+1
Updated ErrorCode struct to enum class to enforce proper error codes, similiar to rustc. For converting the enum to the respective error code, I used a map and updated make_description & make_url function accordingly and also removes the memory leak from the previous frame- work. Also, added macro to safely convert the enum number to string. gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (Intrinsics::compile): Formatted according to enum class. * checks/errors/rust-feature-gate.cc (FeatureGate::gate): likewise. * checks/errors/rust-unsafe-checker.cc (check_unsafe_call): likewise. * hir/rust-ast-lower-base.cc (struct_field_name_exists): likewise. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): likewise. (PatternDeclaration::add_new_binding): likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): likewise. * resolve/rust-ast-verify-assignee.h: likewise. * rust-diagnostics.cc: updated make_desc & url function for enum class. * rust-diagnostics.h (struct ErrorCode): removed struct to switch to enum. (enum class): Switched from errorcode struct to enum class. (XSTR): Macro for converting enum to string. (STR): macro Used by XSTR for converting to string. (ERROR_CODE): macro used by map for check. (TABLE_TO_MAP): macro used by map for check * typecheck/rust-casts.cc (TypeCastRules::emit_cast_error): Formatted according to enum class. * typecheck/rust-hir-path-probe.h: likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): likewise. (TypeCheckImplItemWithTrait::visit): likewise. * typecheck/rust-hir-type-check-item.cc: likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): likewise. (emit_invalid_field_error): likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): likewise. * typecheck/rust-tyty-call.cc (emit_unexpected_argument_error): likewise. (TypeCheckCallExpr::visit): likewise. * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): likewise. * typecheck/rust-tyty.cc (BaseType::bounds_compatible): likewise. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16gccrs: Replace Location with location_t in unnamed function parametersOwen Avery1-1/+1
gcc/rust/ChangeLog: * backend/rust-compile-base.h: Replace Location with location_t. * metadata/rust-imports.h: Likewise. * resolve/rust-name-resolver.cc: Likewise. * resolve/rust-name-resolver.h: Likewise. * rust-backend.h: Likewise. * rust-gcc.cc: Likewise. * rust-gcc.h: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Continue to replace usages of Location with location_tOwen Avery3-4/+4
gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Replace Location with location_t. * backend/rust-compile-base.h: Likewise. * backend/rust-compile-expr.cc: Likewise. * lex/rust-token.h: Likewise. * metadata/rust-import-archive.cc: Likewise. * metadata/rust-imports.cc: Likewise. * metadata/rust-imports.h: Likewise. * rust-backend.h: Likewise. * rust-diagnostics.cc: Likewise. * rust-diagnostics.h: Likewise. * rust-gcc.cc: Likewise. * rust-linemap.cc: Likewise. * util/rust-token-converter.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Replace Location with location_t in gccrs backendOwen Avery15-75/+78
gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Replace Location with location_t. * backend/rust-compile-base.h: Likewise. * backend/rust-compile-block.cc: Likewise. * backend/rust-compile-expr.cc: Likewise. * backend/rust-compile-expr.h: Likewise. * backend/rust-compile-extern.h: Likewise. * backend/rust-compile-implitem.h: Likewise. * backend/rust-compile-intrinsic.cc: Likewise. * backend/rust-compile-item.h: Likewise. * backend/rust-compile-pattern.h: Likewise. * backend/rust-compile-resolve-path.cc: Likewise. * backend/rust-compile-stmt.cc: Likewise. * backend/rust-compile-type.cc: Likewise. * backend/rust-compile.cc: Likewise. * backend/rust-constexpr.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Replace some usages of Location with location_tOwen Avery11-46/+48
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc: Replace Location with location_t. * ast/rust-ast.cc: Likewise. * ast/rust-ast.h: Likewise. * ast/rust-expr.h: Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.cc: Likewise. * ast/rust-path.h: Likewise. * ast/rust-pattern.h: Likewise. * ast/rust-stmt.h: Likewise. * ast/rust-type.h: Likewise. * backend/rust-compile-base.cc: Likewise. * backend/rust-compile-base.h: Likewise. * backend/rust-compile-block.cc: Likewise. * backend/rust-compile-expr.cc: Likewise. * backend/rust-compile-expr.h: Likewise. * backend/rust-compile-fnparam.cc: Likewise. * backend/rust-compile-fnparam.h: Likewise. * backend/rust-compile-intrinsic.cc: Likewise. * backend/rust-compile-pattern.cc: Likewise. * backend/rust-compile-resolve-path.h: Likewise. * backend/rust-compile.cc: Likewise. * checks/errors/rust-const-checker.cc: Likewise. * checks/errors/rust-const-checker.h: Likewise. * checks/errors/rust-unsafe-checker.cc: Likewise. * checks/errors/rust-unsafe-checker.h: Likewise. * expand/rust-macro-builtins.cc: Likewise. * expand/rust-macro-expand.h: Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-implitem.h: Likewise. * hir/rust-ast-lower-item.cc: 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.cc: Likewise. * hir/tree/rust-hir.h: Likewise. * lex/rust-token.h: Likewise. * metadata/rust-extern-crate.cc: Likewise. * metadata/rust-extern-crate.h: Likewise. * parse/rust-parse-impl.h: Likewise. * parse/rust-parse.h: Likewise. * resolve/rust-ast-resolve-expr.cc: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-pattern.h: Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * resolve/rust-ast-resolve-type.h: Likewise. * resolve/rust-name-resolver.cc: Likewise. * resolve/rust-name-resolver.h: Likewise. * rust-diagnostics.cc: Likewise. * rust-diagnostics.h: Likewise. * rust-gcc.cc: Likewise. * rust-session-manager.cc: Likewise. * rust-session-manager.h: Likewise. * typecheck/rust-casts.cc: Likewise. * typecheck/rust-casts.h: Likewise. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-coercion.h: Likewise. * typecheck/rust-hir-path-probe.cc: Likewise. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-trait-reference.cc: Likewise. * typecheck/rust-hir-trait-reference.h: Likewise. * typecheck/rust-hir-trait-resolve.cc: Likewise. * typecheck/rust-hir-type-check-base.cc: Likewise. * typecheck/rust-hir-type-check-base.h: Likewise. * typecheck/rust-hir-type-check-item.cc: Likewise. * typecheck/rust-hir-type-check-item.h: Likewise. * typecheck/rust-hir-type-check-path.cc: Likewise. * typecheck/rust-hir-type-check-pattern.cc: Likewise. * typecheck/rust-hir-type-check-pattern.h: Likewise. * typecheck/rust-hir-type-check-type.cc: Likewise. * typecheck/rust-hir-type-check-type.h: Likewise. * typecheck/rust-hir-type-check.cc: Likewise. * typecheck/rust-hir-type-check.h: Likewise. * typecheck/rust-substitution-mapper.cc: Likewise. * typecheck/rust-substitution-mapper.h: Likewise. * typecheck/rust-type-util.cc: Likewise. * typecheck/rust-typecheck-context.cc: Likewise. * typecheck/rust-tyty-bounds.cc: Likewise. * typecheck/rust-tyty-call.h: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty-subst.h: Likewise. * typecheck/rust-tyty-util.cc: Likewise. * typecheck/rust-tyty-util.h: Likewise. * typecheck/rust-tyty.cc: Likewise. * typecheck/rust-tyty.h: Likewise. * typecheck/rust-unify.cc: Likewise. * typecheck/rust-unify.h: Likewise. * util/rust-hir-map.cc: Likewise. * util/rust-hir-map.h: Likewise. * util/rust-identifier.h: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Remove Linemap::predeclared_locationOwen Avery1-27/+20
gcc/rust/ChangeLog: * rust-linemap.h (Linemap::predeclared_location): Remove. * backend/rust-compile-type.cc: Replace Linemap::predeclared_location with BUILTINS_LOCATION. * resolve/rust-name-resolver.cc: Likewise. * typecheck/rust-hir-type-check-type.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: rust-unreachable: Add specific behavior for rust_unreachableArthur Cohen7-39/+39
As discussed during the community call, rust_unreachable() should always trigger an internal compiler error and should not offer the behavior of __builtin_unreachable when asserts are disabled, unlike gcc_unreachable(). gcc/rust/ChangeLog: * rust-system.h (rust_unreachable): Change definition to fancy_abort * ast/rust-ast-collector.cc (TokenCollector::visit): Use rust_unreachable instead of gcc_unreachable. (get_delimiters): Likewise. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast-formatting.cc (get_string_in_delims): Likewise. (get_mode_dump_desc): Likewise. * ast/rust-ast.cc (Visibility::as_string): Likewise. (UseTreeGlob::as_string): Likewise. * ast/rust-ast.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.h: Likewise. * backend/rust-compile-expr.cc (sort_tuple_patterns): Likewise. (CompileExpr::visit): Likewise. (CompileExpr::generate_closure_fntype): Likewise. * backend/rust-compile-intrinsic.cc (op_with_overflow_inner): Likewise. * backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise. (CompilePatternLet::visit): Likewise. * backend/rust-constexpr.cc (base_field_constructor_elt): Likewise. (eval_array_reference): Likewise. (label_matches): Likewise. (eval_store_expression): Likewise. (eval_call_expression): Likewise. (build_data_member_initialization): Likewise. (array_index_cmp): Likewise. (get_array_or_vector_nelts): Likewise. (eval_bit_field_ref): Likewise. (eval_loop_expr): Likewise. (potential_constant_expression_1): Likewise. * backend/rust-mangle.cc (v0_simple_type_prefix): Likewise. (v0_type_prefix): Likewise. (v0_mangle_item): Likewise. (Mangler::mangle_item): Likewise. * backend/rust-tree.cc (convert_to_void): Likewise. (type_memfn_quals): Likewise. (rs_tree_equal): Likewise. (fold_offsetof): Likewise. (fold_builtin_source_location): Likewise. (lvalue_error): Likewise. * backend/rust-tree.h (struct named_decl_hash): Likewise. (struct named_label_hash): Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::resolve_visibility): Likewise. (VisibilityResolver::visit): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Likewise. * checks/errors/rust-feature.cc (Feature::create): Likewise. * expand/rust-expand-visitor.cc (get_traits_to_derive): Likewise. (derive_item): Likewise. (expand_item_attribute): Likewise. (expand_stmt_attribute): Likewise. * expand/rust-macro-expand.cc (MacroExpander::match_matcher): Likewise. (MacroExpander::match_repetition): Likewise. (transcribe_context): Likewise. (MacroExpander::import_proc_macros): Likewise. (MacroExpander::parse_proc_macro_output): Likewise. * expand/rust-macro-expand.h: Likewise. * expand/rust-macro-invoc-lexer.h: Likewise. * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise. * expand/rust-proc-macro-invoc-lexer.h: Likewise. * expand/rust-proc-macro.cc (load_macros): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise. (ASTLoweringBase::lower_literal): Likewise. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise. * hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/tree/rust-hir.cc (get_string_in_delims): Likewise. (Visibility::as_string): Likewise. (UseTreeGlob::as_string): Likewise. (CompoundAssignmentExpr::as_string): Likewise. (ArithmeticOrLogicalExpr::as_string): Likewise. * lex/rust-lex.cc (Lexer::parse_byte_string): Likewise. (Lexer::parse_string): Likewise. * lex/rust-token.cc (RS_TOKEN): Likewise. * parse/rust-parse-impl.h (Parser::parse_simple_path_segment): Likewise. (Parser::parse_path_ident_segment): Likewise. (Parser::parse_attr_input): Likewise. (Parser::parse_inherent_impl_item): Likewise. (Parser::parse_trait_impl_item): Likewise. (Parser::parse_type_path_segment): Likewise. (Parser::parse_reference_type): Likewise. (get_lbp_for_comparison_expr): Likewise. * parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. (ResolveTypeToCanonicalPath::visit): Likewise. (ResolveGenericArgs::resolve_disambiguated_generic): Likewise. * rust-gcc.cc (operator_to_tree_code): Likewise. (fetch_overflow_builtins): Likewise. (Gcc_backend::non_zero_size_type): Likewise. (Gcc_backend::convert_tree): Likewise. * rust-lang.cc (grs_langhook_type_for_mode): Likewise. (grs_langhook_global_bindings_p): Likewise. (grs_langhook_pushdecl): Likewise. (grs_langhook_getdecls): Likewise. (convert): Likewise. * typecheck/rust-autoderef.h: Likewise. * typecheck/rust-hir-path-probe.cc: Likewise. * typecheck/rust-hir-trait-reference.cc (TraitItemReference::get_tyty): Likewise. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise. * typecheck/rust-hir-type-check-expr.cc: Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h: Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. * typecheck/rust-substitution-mapper.h: Likewise. * typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_context_type): Likewise. * typecheck/rust-tyty-call.h: Likewise. * typecheck/rust-tyty.cc (TypeKindFormat::to_string): Likewise. (BaseType::monomorphized_clone): Likewise. (VariantDef::variant_type_string): Likewise. (ClosureType::handle_substitions): Likewise. (IntType::as_string): Likewise. (UintType::as_string): Likewise. (FloatType::as_string): Likewise. * typecheck/rust-unify.cc (UnifyRules::expect_projection): Likewise. * util/rust-token-converter.cc (convert): Likewise. (from_literal): Likewise. (from_group): Likewise. (from_tokentree): Likewise.
2024-01-16gccrs: [E0093] Declaration of unknown intrinsic functionMuhammad Mahad1-1/+2
Refactored error message similiar to rustc. gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (Intrinsics::compile): called error function. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-3.rs: Updated comment to pass the test case. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16gccrs: remove braces around scalar initializersPierre-Emmanuel Patry1-12/+9
Remove useless braces around scalar initializers. This will also remove some warning emitted by the compiler and avoid cluttering it's output. gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (offset_handler): Remove braces. (sizeof_handler): Likewise. (transmute_handler): Likewise. (rotate_handler): Likewise. (wrapping_op_handler_inner): Likewise. (op_with_overflow_inner): Likewise. (atomic_load_handler_inner): Likewise. (unchecked_op_inner): Likewise. (uninit_handler): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: Remove unnecessary usage of Location copy constructorOwen Avery1-2/+2
gcc/rust/ChangeLog: * ast/rust-expr.h (MetaItemPathLit::get_locus): Remove copy construction. * backend/rust-constexpr.cc (eval_constant_expression): Likewise. (is_valid_constexpr_fn): Likewise. * util/rust-token-converter.cc (convert): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Remove Rust::Optional in favor of tl::optionalArthur Cohen1-1/+1
gcc/rust/ChangeLog: * Make-lang.in: Remove rust-optional-test.cc's object file * ast/rust-macro.h: Remove use of Rust::Optional * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Likewise. (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/rust-feature-gate.cc (FeatureGate::check): Likewise. * checks/errors/rust-feature.cc (Feature::create): Likewise. (Feature::as_name): Likewise. * checks/errors/rust-feature.h: Likewise. * expand/rust-macro-builtins.cc: Likewise. * lex/rust-lex.cc (Lexer::Lexer): Likewise. (Lexer::skip_token): Likewise. (Lexer::dump_and_skip): Likewise. * lex/rust-lex.h: Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * rust-lang.cc (run_rust_tests): Likewise. * rust-session-manager.cc (Session::compile_crate): Likewise. (TargetOptions::dump_target_options): Likewise. * rust-session-manager.h (struct TargetOptions): Likewise. * util/rust-hir-map.cc (Mappings::lookup_module_children): Likewise. (Mappings::lookup_module_chidren_items): Likewise. (Mappings::lookup_module_child): Likewise. (Mappings::lookup_parent_module): Likewise. * util/rust-hir-map.h (RUST_HIR_MAP_H): Likewise. * util/rust-optional-test.cc: Removed. * util/rust-optional.h: Removed.
2024-01-16gccrs: Replace value initialization of Location with UNDEF_LOCATIONOwen Avery7-49/+62
gcc/rust/ChangeLog: * rust-location.h (UNDEF_LOCATION): New. * ast/rust-ast-collector.cc: Replace Location () with UNDEF_LOCATION. * ast/rust-ast-fragment.cc: Likewise. * ast/rust-ast.h: Likewise. * ast/rust-expr.h: Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.h: Likewise. * ast/rust-type.h: Likewise. * backend/rust-compile-expr.cc: Likewise. * backend/rust-compile-extern.h: Likewise. * backend/rust-compile-implitem.h: Likewise. * backend/rust-compile-intrinsic.cc: Likewise. * backend/rust-compile-item.h: Likewise. * backend/rust-compile.cc: Likewise. * backend/rust-constexpr.cc: Likewise. * expand/rust-expand-visitor.cc: Likewise. * expand/rust-macro-expand.cc: Likewise. * expand/rust-macro-expand.h: Likewise. * expand/rust-macro-invoc-lexer.cc: Likewise. * expand/rust-proc-macro-invoc-lexer.cc: Likewise. * expand/rust-proc-macro.cc: 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-type.h: Likewise. * hir/tree/rust-hir.h: Likewise. * lex/rust-lex.cc: Likewise. * metadata/rust-export-metadata.cc: Likewise. * parse/rust-parse-impl.h: Likewise. * resolve/rust-ast-resolve-item.cc: Likewise. * resolve/rust-ast-resolve.cc: Likewise. * rust-diagnostics.h: Likewise. * rust-session-manager.cc: Likewise. * typecheck/rust-autoderef.cc: Likewise. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-hir-dot-operator.cc: Likewise. * typecheck/rust-hir-path-probe.cc: Likewise. * typecheck/rust-hir-trait-reference.cc: Likewise. * typecheck/rust-hir-trait-reference.h: Likewise. * typecheck/rust-hir-type-check-expr.cc: Likewise. * typecheck/rust-hir-type-check-implitem.cc: Likewise. * typecheck/rust-hir-type-check-type.cc: Likewise. * typecheck/rust-hir-type-check.cc: Likewise. * typecheck/rust-tyty-bounds.cc: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. * util/rust-hir-map.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Change class Location into typedefOwen Avery3-35/+26
gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::address_expression): Remove gcc_location method call. (HIRCompileBase::indirect_expression): Likewise. (HIRCompileBase::compile_constant_item): Likewise. (HIRCompileBase::named_constant_expression): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Remove gcc_location method call, use UNKNOWN_LOCATION to initialize. (CompileExpr::get_fn_addr_from_dyn): Remove gcc_location method call. (CompileExpr::type_cast_expression): Likewise. * backend/rust-compile-intrinsic.cc (transmute_handler): Replace "Location ().gcc_location ()" with UNKNOWN_LOCATION. (copy_nonoverlapping_handler): Likewise. (prefetch_data_handler): Likewise. (atomic_store_handler_inner): Likewise. (atomic_load_handler_inner): Likewise. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Remove gcc_location method call. * rust-diagnostics.cc (rust_be_error_at): Likewise. (rust_be_warning_at): Likewise. (rust_be_fatal_error): Likewise. (rust_be_inform): Likewise. * rust-diagnostics.h (rust_sorry_at): Likewise. * rust-gcc.cc (Bvariable::get_tree): Likewise. (Gcc_backend::fill_in_fields): Likewise. (Gcc_backend::named_type): Likewise. (Gcc_backend::real_part_expression): Likewise. (Gcc_backend::imag_part_expression): Likewise. (Gcc_backend::complex_expression): Likewise. (Gcc_backend::convert_expression): Likewise. (Gcc_backend::struct_field_expression): Likewise. (Gcc_backend::compound_expression): Likewise. (Gcc_backend::conditional_expression): Likewise. (Gcc_backend::negation_expression): Likewise. (Gcc_backend::arithmetic_or_logical_expression): Likewise. (Gcc_backend::arithmetic_or_logical_expression_checked): Likewise. (Gcc_backend::comparison_expression): Likewise. (Gcc_backend::lazy_boolean_expression): Likewise. (Gcc_backend::constructor_expression): Likewise. (Gcc_backend::array_constructor_expression): Likewise. (Gcc_backend::array_initializer): Likewise. (Gcc_backend::array_index_expression): Likewise. (Gcc_backend::call_expression): Likewise. (Gcc_backend::assignment_statement): Likewise. (Gcc_backend::return_statement): Likewise. (Gcc_backend::exception_handler_statement): Likewise. (Gcc_backend::if_statement): Likewise. (Gcc_backend::loop_expression): Likewise. (Gcc_backend::exit_expression): Likewise. (Gcc_backend::block): Likewise. (Gcc_backend::convert_tree): Likewise. (Gcc_backend::global_variable): Likewise. (Gcc_backend::local_variable): Likewise. (Gcc_backend::parameter_variable): Likewise. (Gcc_backend::static_chain_variable): Likewise. (Gcc_backend::temporary_variable): Likewise. (Gcc_backend::label): Likewise. (Gcc_backend::goto_statement): Likewise. (Gcc_backend::label_address): Likewise. (Gcc_backend::function): Likewise. * rust-linemap.cc (Gcc_linemap::to_string): Likewise. (Gcc_linemap::location_file): Likewise. (Gcc_linemap::location_line): Likewise. (Gcc_linemap::location_column): Likewise. (Gcc_linemap::is_predeclared): Likewise. (Gcc_linemap::is_unknown): Likewise. (RichLocation::RichLocation): Likewise. (RichLocation::add_range): Likewise. (RichLocation::add_fixit_insert_before): Likewise. (RichLocation::add_fixit_insert_after): Likewise. * rust-location.h (class Location): Replace with typedef. (operator<): Remove. (operator==): Remove. (operator+): Remove. (operator-): Remove. * typecheck/rust-hir-trait-resolve.cc (AssociatedImplTrait::setup_associated_types): Initialize Location with UNKNOWN_LOCATION. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * util/rust-token-converter.cc (convert): Remove gcc_location method call. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: HIR cleanupMarc Poulhiès2-6/+8
Some more HIR cleanup. gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h (BorrowExpr::is_double_borrow): New. (ArrayElemsCopied::get_elem_to_copy) (ArrayElemsCopied::get_num_copies_expr): Return unique_ptr. (CallExpr::get_fnexpr): Likewise. (ReturnExpr::get_expr): Likewise. (StructExprStructFields::get_struct_base): New. (MethodCallExpr::has_params): New. (ClosureExpr::has_params): New. (BlockExpr::get_inner_attrs): New. (WhileLoopExpr::get_patterns): New. (ForLoopExpr::get_pattern): New. (IfLetExpr::get_if_block): Return ref to unique_ptr. (IfLetExprConseqElse::get_else_block): Likewise. (MatchExpr::get_inner_attrs): New. * hir/tree/rust-hir-item.h (Module::get_module_name): New. (ExternCrate::get_referenced_crate) (ExternCrate::get_as_clause_name): New. (UseTreeGlob::get_glob_type, UseTreeGlob::get_path): New. (UseTreeList::get_path_type, UseTreeList::get_path) (UseTreeList::get_trees): New. (TraitItemKind::get_expr): Remove assert. unique_ptr can be "empty". Must be checked in caller. * hir/tree/rust-hir-pattern.h (IdentifierPattern::get_is_ref) (IdentifierPattern::get_to_bind): New. (RangePatternBoundType::get_has_minus): New. (RangePattern::get_has_ellipsis_syntax): New. (StructPatternField::get_outer_attrs): New. (StructPatternFieldTuplePat::get_index) (StructPatternFieldTuplePat::get_tuple_pattern): New. (StructPatternFieldIdent::get_has_ref): New. * hir/tree/rust-hir-stmt.h (LetStmt::get_outer_attrs): New. (LetStmt::get_type) (LetStmt::get_init_expr, LetStmt::get_pattern): Return unique_ptr. (ExprStmt::get_expr): Likewise. * hir/tree/rust-hir-type.h (TraitBound::get_for_lifetimes): New. (TraitBound::get_in_params): New. (TraitBound::get_opening_question_mark): New. (ImplTraitType::get_type_param_bounds): New. (TraitObjectType::get_has_dyn): New. (TraitBound::get_type_in_parens): New. (ImplTraitTypeOneBound::get_trait_bound): New. (BareFunctionType::get_for_lifetimes) (BareFunctionType::get_is_variadic) (BareFunctionType::get_function_qualifiers): New. * hir/tree/rust-hir.h (class Expr): Virtual inherit from FullVisitable. (class Pattern): Likewise. (ConstGenericParam::get_name): New. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Adjust call. (TypeCheckExpr::resolve_fn_trait_call): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Adjust call. (CompileExpr::array_copied_expr): Likewise. (CompileExpr::generate_possible_fn_trait_call): Likewise. * backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-01-16gccrs: fix ICE with inserting autoderef mappingsPhilip Herron1-1/+2
We were using the call-expr id for the autoderef mappings but this doesn't work when the call expression itself is part of a coercion-site so this changes the code to use the call-expression function path expression for the id instead which will not be duplicated again. Addresses #2105 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::generate_possible_fn_trait_call): use fnexpr * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_fn_trait_call): likewise Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: refactor: make crate.items privateMarc Poulhiès1-1/+1
Introduce Crate::get_items () and fixup all callers. gcc/rust/ChangeLog: * hir/tree/rust-hir.h (struct Crate): Rename struct into ... (class Crate): ... class, and add get_items. * backend/rust-compile.cc (CompileCrate::go): Adapt to visibility change of items. * checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go): Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::go): Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::go): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::go): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::go): Likewise. * checks/lints/rust-lint-marklive.cc (FindEntryPoint::find): Likewise. * checks/lints/rust-lint-scan-deadcode.h (ScanDeadCode::Scan): Likewise. * metadata/rust-export-metadata.cc (PublicInterface::gather_export_data): Likewise. * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise. * hir/rust-hir-dump.cc (CompileCrate::go): Likewise. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-01-16gccrs: cleanup getters to return &unique_ptr instead of pointerMarc Poulhiès4-22/+29
Make all getter methods in HIR classes return a unique_ptr reference instead of a pointer and adjust all callers. gcc/rust/ChangeLog: * hir/tree/rust-hir-type.h (ArrayType::get_element_type): Returns unique_ptr. * hir/tree/rust-hir-expr.h (ArithmeticOrLogicalExpr::get_lhs) (ArithmeticOrLogicalExpr::get_rhs): Likewise. (ComparisonExpr::get_lhs, ComparisonExpr::get_rhs): Likewise. (LazyBooleanExpr::get_lhs, LazyBooleanExpr::get_rhs): Likewise. (AssignmentExpr::get_lhs, AssignmentExpr::get_rhs): Likewise. (ArrayExpr::get_internal_elements): Likewise. (ArrayIndexExpr::get_index_expr, ArrayIndexExpr::get_array_expr): Likewise. (StructExprFieldWithVal::get_value): Likewise. (IfExpr::get_if_condition, IfExpr::get_if_block): Likewise. (ExprWithBlock::get_else_block): Likewise. * hir/tree/rust-hir-item.h (FunctionParam::get_param_name) (FunctionParam::get_type): Likewise. (ConstantItem::get_type, ConstantItem::get_expr): Likewise. (StaticItem::get_expr, StaticItem::get_type): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Adjust for previous change. * backend/rust-compile-block.cc (CompileConditionalBlocks::visit): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-item.cc (CompileItem::visit): Likewise. * backend/rust-compile-struct-field-expr.cc (CompileStructExprField::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-01-16gccrs: ast: Change Identifier definitionPierre-Emmanuel Patry10-25/+23
Change Identifier type definition from a simple typedef to a whole class with it's own node id. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Change with call to getter. * ast/rust-ast.cc (Module::as_string): Likewise. (StaticItem::as_string): Likewise. (TupleStruct::as_string): Likewise. (Method::as_string): Likewise. (StructStruct::as_string): Likewise. (UseTreeRebind::as_string): Likewise. (Enum::as_string): Likewise. (Trait::as_string): Likewise. (Union::as_string): Likewise. (Function::as_string): Likewise. (TypeAlias::as_string): Likewise. (MacroRulesDefinition::as_string): Likewise. (FieldAccessExpr::as_string): Likewise. (MacroMatchFragment::as_string): Likewise. (TypeParam::as_string): Likewise. (StructExprFieldIdentifierValue::as_string): Likewise. (EnumItem::as_string): Likewise. (StructField::as_string): Likewise. (ExternalTypeItem::as_string): Likewise. (ExternalStaticItem::as_string): Likewise. (ExternalFunctionItem::as_string): Likewise. (TraitFunctionDecl::as_string): Likewise. (TraitMethodDecl::as_string): Likewise. (TraitItemConst::as_string): Likewise. (TraitItemType::as_string): Likewise. (MaybeNamedParam::as_string): Likewise. (MetaListPaths::as_string): Likewise. (MetaListNameValueStr::as_string): Likewise. (Module::process_file_path): Likewise. (MetaListNameValueStr::check_cfg_predicate): Likewise. (MetaListPaths::check_cfg_predicate): Likewise. (MetaWord::check_cfg_predicate): Likewise. (MetaNameValueStr::check_cfg_predicate): Likewise. (MetaNameValueStr::to_attribute): Likewise. (MetaWord::to_attribute): Likewise. (MetaListPaths::to_attribute): Likewise. (MetaListNameValueStr::to_attribute): Likewise. (operator<<): Change Identifier class << operator overload for standard output stream. * ast/rust-ast.h (class Identifier): Change typedef to proper class definition. (operator<<): Add prototype for operator overload. (class Token): Change getter identifier. (class MetaListNameValueStr): Likewise. (class PathExpr): Likewise. * ast/rust-expr.h: Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.cc (GenericArg::disambiguate_to_type): Likewise. (GenericArgsBinding::as_string): Likewise. (ConstGenericParam::as_string): Likewise. * ast/rust-path.h: Likewise. * ast/rust-pattern.cc (IdentifierPattern::as_string): Likewise. (StructPatternFieldIdentPat::as_string): Likewise. (StructPatternFieldIdent::as_string): Likewise. * ast/rust-type.h: Likewise. * backend/rust-compile-base.cc: Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-extern.h: Likewise. * backend/rust-compile-fnparam.cc (CompileFnParam::visit): Likewise. * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise. * backend/rust-compile-item.cc (CompileItem::visit): Likewise. * backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise. * backend/rust-compile-struct-field-expr.cc (CompileStructExprField::visit): Likewise. * backend/rust-compile-var-decl.h: Likewise. * backend/rust-compile.cc: Likewise. * checks/errors/rust-unsafe-checker.cc (check_extern_call): Likewise. * checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise. * checks/lints/rust-lint-scan-deadcode.h: Likewise. * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Likewise. (DeriveClone::visit_tuple): Likewise. (DeriveClone::visit_struct): Likewise. (DeriveClone::visit_union): Likewise. * expand/rust-derive-copy.cc (DeriveCopy::visit_struct): Likewise. (DeriveCopy::visit_tuple): Likewise. (DeriveCopy::visit_enum): Likewise. (DeriveCopy::visit_union): Likewise. * expand/rust-macro-expand.cc (MacroExpander::match_matcher): Likewise. (MacroExpander::match_n_matches): Likewise. (MacroExpander::match_repetition): Likewise. (MacroExpander::match_repetition_skipped_metavars): Likewise. * hir/rust-ast-lower-base.cc (struct_field_name_exists): Likewise. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. * hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): 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-type.h: Likewise. * hir/tree/rust-hir.cc (Module::as_string): Likewise. (StaticItem::as_string): Likewise. (TupleStruct::as_string): Likewise. (ConstantItem::as_string): Likewise. (StructStruct::as_string): Likewise. (UseTreeRebind::as_string): Likewise. (Enum::as_string): Likewise. (Trait::as_string): Likewise. (Union::as_string): Likewise. (Function::as_string): Likewise. (TypeAlias::as_string): Likewise. (FieldAccessExpr::as_string): Likewise. (TypeParam::as_string): Likewise. (GenericArgsBinding::as_string): Likewise. (StructPatternFieldIdent::as_string): Likewise. (StructPatternFieldIdentPat::as_string): Likewise. (IdentifierPattern::as_string): Likewise. (StructExprFieldIdentifierValue::as_string): Likewise. (EnumItem::as_string): Likewise. (StructField::as_string): Likewise. (ExternalStaticItem::as_string): Likewise. (ExternalFunctionItem::as_string): Likewise. (NamedFunctionParam::as_string): Likewise. (TraitFunctionDecl::as_string): Likewise. (TraitItemConst::as_string): Likewise. (TraitItemType::as_string): Likewise. (MaybeNamedParam::as_string): Likewise. * hir/tree/rust-hir.h: Likewise. * parse/rust-parse-impl.h (Parser::parse_macro_match_fragment): Likewise. (Parser::parse_module): Likewise. (Parser::parse_use_tree): Likewise. (Parser::parse_maybe_named_param): Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. (ResolveItem::visit): Likewise. (flatten_rebind): Likewise. (ResolveExternItem::visit): Likewise. (rust_flatten_rebind): Likewise. (rust_flatten_rebind_nested): Likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): Likewise. (PatternDeclaration::visit): Likewise. (PatternDeclaration::add_new_binding): Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * resolve/rust-ast-resolve-type.h: Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * typecheck/rust-autoderef.cc: Likewise. * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): Likewise. * typecheck/rust-hir-path-probe.cc (PathProbeType::visit): Likewise. * typecheck/rust-hir-trait-reference.cc (TraitReference::get_name): Likewise. * typecheck/rust-hir-trait-resolve.cc (ResolveTraitItemToRef::visit): Likewise. (TraitResolver::resolve_trait): Likewise. (TraitItemReference::resolve_item): Likewise. (AssociatedImplTrait::setup_raw_associated_types): Likewise. * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. (TypeCheckImplItemWithTrait::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): Likewise. * util/rust-attributes.cc (check_doc_attribute): Likewise. * util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: fortify resolve_method_address to match the typesPhilip Herron1-6/+43
Fixes #2019 gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): match the fntype to the candidate gcc/testsuite/ChangeLog: * rust/compile/issue-2019-2.rs: New test. * rust/compile/issue-2019-3.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: ensure assoicated types are setup for concrete trait impl blocksPhilip Herron1-0/+17
We have been concentrating on generic impl blocks for so long that we have not handled the simple concrete impl block case where associated types need to be setup when compling a function/method on a trait impl block which uses associated types. Addresses #2019 gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): ensure assoicated types are setup * typecheck/rust-hir-trait-reference.h: new interface for concrete impl block * typecheck/rust-hir-trait-resolve.cc (AssociatedImplTrait::setup_raw_associated_types): ensure we setup assoicated types for this impl block gcc/testsuite/ChangeLog: * rust/compile/issue-2019-1.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Fix ICE for reference patterns in match statementsDave Evans1-1/+8
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_scrutinee): Add REF type to rust_assert. (CompileExpr::visit): Add REF type for scrutinee_kind in MatchExpr visitor. gcc/testsuite/ChangeLog: * rust/compile/issue-1813.rs: New test. Signed-off-by: Dave Evans <dave@dmetwo.org>
2024-01-16gccrs: get rid of useless helper class and fix header usagePhilip Herron7-0/+7
gcc/rust/ChangeLog: * Make-lang.in: remove files * backend/rust-compile-block.h: fix headers * backend/rust-compile-expr.h: likewise * backend/rust-compile-fnparam.h: likewise * backend/rust-compile-item.h: likewise * backend/rust-compile-pattern.h: likewise * backend/rust-compile-resolve-path.h: likewise * backend/rust-compile-stmt.h: likewise * typecheck/rust-autoderef.cc: likewise * typecheck/rust-hir-path-probe.cc: likewise * typecheck/rust-hir-path-probe.h: likewise * typecheck/rust-hir-trait-reference.h: likewise * typecheck/rust-hir-trait-resolve.cc: use a for loop instead * typecheck/rust-hir-trait-resolve.h: fix headers * typecheck/rust-hir-type-check-expr.h: likewise * typecheck/rust-hir-type-check-implitem.h: likewise * typecheck/rust-hir-type-check-item.h: likewise * typecheck/rust-hir-type-check-path.cc: likewise * typecheck/rust-hir-type-check-pattern.h: likewise * typecheck/rust-hir-type-check-stmt.h: likewise * typecheck/rust-hir-type-check-type.h: likewise * typecheck/rust-hir-type-check-util.cc: Removed. * typecheck/rust-hir-type-check-util.h: Removed. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: remove useless lookup to NodeIdPhilip Herron1-30/+3
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): remove unused Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: support deref cycles to resolve to trait itemsPhilip Herron1-9/+2
Fixes #2190 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (HIRCompileBase::resolve_deref_adjustment): reuse op overload code * typecheck/rust-autoderef.cc (Adjuster::try_deref_type): update (Adjuster::try_raw_deref_type): likewise * typecheck/rust-autoderef.h: likewise * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): improve debug loging gcc/testsuite/ChangeLog: * rust/compile/issue-2190-1.rs: New test. * rust/compile/issue-2190-2.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: refactor resolve_method_address to be more genericPhilip Herron4-23/+17
We can reuse the DefId to lookup the mappings to Items or Trait Items instead of the HirId this is more generic and can then be reused for the deref operator overload during autoderef cycles. Addresses #2190 gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): refactor * backend/rust-compile-base.h: likewise * backend/rust-compile-expr.cc (CompileExpr::visit): likewise * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): likewise Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Add missing coercion site logic to return expressionsPhilip Herron3-5/+25
gcc/rust/ChangeLog: * backend/rust-compile-base.cc: track return type in fncontext * backend/rust-compile-context.h (struct fncontext): likewise * backend/rust-compile-expr.cc (CompileExpr::visit): apply coercion site (CompileExpr::generate_closure_function): update push_context * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise gcc/testsuite/ChangeLog: * rust/execute/torture/coercion3.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: add missing coercion site code generation for block tailPhilip Herron1-0/+13
Fixes #2179 gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::compile_function_body): add missing coercion_site codegen gcc/testsuite/ChangeLog: * rust/execute/torture/issue-2179.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: unify how we handle DST'sPhilip Herron5-30/+63
DST's are not truely reference types they are "unsized types" so the exact size of them is not known at compile time. We actually achieve this by pretending they are a reference but really its struct we pass around. Fixes #2180 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): refactr (CompileExpr::get_fn_addr_from_dyn): likewise (CompileExpr::get_receiver_from_dyn): likewise (CompileExpr::type_cast_expression): likewise * backend/rust-compile-type.cc (TyTyResolveCompile::visit): likewise (TyTyResolveCompile::create_dyn_obj_record): likewise (TyTyResolveCompile::create_slice_type_record): likewise (TyTyResolveCompile::create_str_type_record): likewise * backend/rust-compile-type.h: likewise * backend/rust-compile.cc (HIRCompileBase::coercion_site1): likewise (HIRCompileBase::coerce_to_dyn_object): refactor * backend/rust-tree.h (SLICE_FLAG): removed (SLICE_TYPE_P): removed (RS_DST_FLAG): new flag (RS_DST_FLAG_P): new predicate * typecheck/rust-tyty.cc (ReferenceType::is_dyn_object): new helper (ReferenceType::is_dyn_obj_type): likewise (PointerType::is_dyn_object): likewise (PointerType::is_dyn_obj_type): likewise * typecheck/rust-tyty.h (class DynamicObjectType): moved up gcc/testsuite/ChangeLog: * rust/execute/torture/issue-2180.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: we can only return unit-type when the ABI is non CPhilip Herron1-5/+14
gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): add filter Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Redo how we handle unit types for the final timePhilip Herron11-203/+193
We had a very inconsistant way for dealing with unit-types in gccrs we tried to optimize the case for a function returning unit type to be clever and not emit any return value for unit types. Then for other cases we would use an empty constructor for an empty tuple and in others use a zero percsion integer. This was all just confusing and made the IR less conformant to Rust. In this patch I change all of this to use an empty tuple type for all cases so we pass around {} which maps over to Rust and gets optimized away in the middle end anyway. In the patch we also remove old gccgo code which optimizes away zero size types to void_type_node which is why my original attempt at doing this two years ago failed. Fixes #2188 gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::compile_function_body): use unit_expression (HIRCompileBase::unit_expression): new helper * backend/rust-compile-base.h: update prototype * backend/rust-compile-block.cc (CompileBlock::visit): use unit_expression * backend/rust-compile-expr.cc (CompileExpr::visit): likewise (CompileExpr::generate_closure_function): likewise * backend/rust-compile-implitem.cc (CompileTraitItem::visit): cleanup * backend/rust-compile-item.cc (CompileItem::visit): likewise * backend/rust-compile-pattern.cc (CompilePatternLet::visit): likewise * backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): likewise * backend/rust-compile-type.cc (TyTyResolveCompile::get_unit_type): new helper (TyTyResolveCompile::visit): use new unit_type helper * backend/rust-compile-type.h: likewise * rust-backend.h: simplify the return_expression * rust-gcc.cc (Gcc_backend::function_type): likewise (Gcc_backend::return_statement): likewise * backend/rust-constexpr.cc (eval_constant_expression): remove bad assertion gcc/testsuite/ChangeLog: * rust/compile/issue-2188.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Add missing compile locals for constants and staticsPhilip Herron1-2/+9
When we have a block expression for cosntants or statics we need to ensure we compile the locals for the implicit function we generate in GIMPLE before feeding it directly into the constant folder to evaluate the data. Fixes #2178 gcc/rust/ChangeLog: * backend/rust-compile-base.cc: add missing compile_locals call gcc/testsuite/ChangeLog: * rust/compile/issue-2178.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: remove unused includesPhilip Herron1-2/+0
gcc/rust/ChangeLog: * backend/rust-compile-implitem.h: remove includes Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: fix ICE with recursive function callsPhilip Herron1-12/+2
Fixes #2136 gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): remove bad checks gcc/testsuite/ChangeLog: * rust/compile/issue-2136-1.rs: New test. * rust/compile/issue-2136-2.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Unify HIR::ExprStmt derived class visitingOwen Avery3-11/+3
gcc/rust/ChangeLog: * backend/rust-compile-stmt.cc (CompileStmt::visit): Unify ExprStmtWith{,out}Block visitors. * backend/rust-compile-stmt.h (CompileStmt::visit): Likewise. * backend/rust-compile-item.h (CompileItem::visit): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h (Dump::visit): Likewise. * hir/tree/rust-hir-stmt.h (ExprStmt::accept_vis): Add. (ExprStmtWithoutBlock::accept_vis): Remove. (ExprStmtWithBlock::accept_vis): Remove. * hir/tree/rust-hir.cc (ExprStmt::accept_vis): Add. (ExprStmtWithoutBlock::accept_vis): Remove. (ExprStmtWithBlock::accept_vis): Remove. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Likewise. (HIRFullVisitorBase::visit): Likewise. (HIRStmtVisitor::visit): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h (ConstChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h (PrivacyReporter::visit): Likewise. * checks/lints/rust-lint-marklive.h (MarkLive::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h (TypeCheckStmt::visit): Likewise. * typecheck/rust-tycheck-dump.h (TypeResolverDump::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Support fully qualified calls to trait items from CallExpr'sPhilip Herron1-0/+16
Fixes #2070 gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): reuse resolve_method_address to monomorphize the call if required * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): allow matching against unimplemented trait item bounds gcc/testsuite/ChangeLog: * rust/compile/issue-2070.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: refactor resolve_method_address to be inside base classPhilip Herron4-91/+91
gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): moved here * backend/rust-compile-base.h: refactored prototype * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): refactor * backend/rust-compile-expr.h: likewise Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: remove unused code in query_compilePhilip Herron1-11/+0
gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): remove unused Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: cleanup query_compile to reuse destructure callPhilip Herron1-6/+1
gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): call destructure Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: cleanup resolve method addressPhilip Herron1-3/+1
Calling PathProbeImplTrait resolves directly to the trait bound in question to stop resolving to potentially multiple implementations of that bound gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): call path probe impl trait Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Fix ICE using constructors for intilizers in staticsPhilip Herron1-3/+3
We are getting constant expressions for the initilizers for static items this hits an assertion in the GCC middle-end which is looking for a constructor so we need to unwrap the constant expression using DECL_INITIAL as the initilizer to the global static. Fixes #2080 gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): unwrap the constant expression gcc/testsuite/ChangeLog: * rust/execute/torture/issue-2080.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: fix ICE when closure body is not a blockPhilip Herron1-9/+14
Fixes: #2052 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): when its not a block we dont have any ribs to generate locals from gcc/testsuite/ChangeLog: * rust/execute/torture/issue-2052.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Revert "hir: Add ExportedMacro node and handling."Arthur Cohen2-2/+0
This reverts commit a1f940d193c6cdb13483690a4f4a7d501ad7040e. It is easier and cleaner to store exported macros' NodeIds into our mappings rather than create a new HIR kind of node. gcc/rust/ChangeLog: * backend/rust-compile-item.h: Revert 1c946687239b86a92839d57dfbc928ad7ce35eae. * backend/rust-compile-stmt.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::visit): Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise. * checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise. * checks/errors/privacy/rust-reachability.h: Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::visit): Likewise. * checks/errors/privacy/rust-visibility-resolver.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-item.cc (ASTLoweringItem::visit): Likewise. * hir/rust-ast-lower-item.h: Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-full-decls.h (class ExportedMacro): Likewise. * hir/tree/rust-hir-item.h (class ExportedMacro): Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * hir/tree/rust-hir.cc (ExportedMacro::accept_vis): Likewise. (ExportedMacro::get_locus): Likewise. (ExportedMacro::get_item_kind): Likewise. (ExportedMacro::clone_item_impl): Likewise. * hir/tree/rust-hir.h: Likewise. * metadata/rust-export-metadata.cc: Likewise. * typecheck/rust-hir-type-check-item.h: Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h: Likewise. * typecheck/rust-tycheck-dump.h: Likewise. * util/rust-attributes.cc: Likewise.
2024-01-16gccrs: Add move_val_init intrinsicPhilip Herron1-1/+55
This implements it as a builtin memcpy using the generic param T for the size hint. Fixes #1902 gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (move_val_init_handler): new intrinsice (uninit_handler): use a builtin memcpy gcc/testsuite/ChangeLog: * rust/compile/issue-1981.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Unify HIR::IfLetExprConseqIf{,Let} into HIR::IfLetExprConseqElseOwen Avery2-6/+0
This should allow for 'if let' expressions to be lowered more easily. gcc/rust/ChangeLog: * backend/rust-compile-block.h (CompileConditionalBlocks::visit): Remove IfLetExprConseqIf{,Let} visitors. (CompileExprWithBlock::visit): Remove IfLetExprConseqIf{,Let} visitors. * backend/rust-compile-expr.h (CompileExpr::visit): Remove IfLetExprConseqIf{,Let} visitors. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Remove IfLetExprConseqIf{,Let} visitors. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Remove IfLetExprConseqIf{,Let} visitors. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Remove IfLetExprConseqIf{,Let} visitors. * checks/errors/rust-const-checker.h (ConstChecker::visit): Remove IfLetExprConseqIf{,Let} visitors. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Remove IfLetExprConseqIf{,Let} visitors. * checks/errors/privacy/rust-privacy-reporter.h (PrivacyReporter::visit): Remove IfLetExprConseqIf{,Let} visitors. * hir/tree/rust-hir-expr.h (class IfLetExprConseqElse): Make else_block ExprWithBlock. (class IfLetExprConseqIf): Remove. (class IfLetExprConseqIfLet): Remove. * hir/tree/rust-hir-full-decls.h (class IfLetExprConseqIf): Remove. (class IfLetExprConseqIfLet): Remove. * hir/tree/rust-hir.cc (IfLetExprConseqElse::as_string): Adjust output. (IfLetExprConseqIf::as_string): Remove. (IfLetExprConseqIfLet::as_string): Remove. (IfLetExprConseqIf::accept_vis): Remove. (IfLetExprConseqIfLet::accept_vis): Remove. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors. (HIRFullVisitorBase::visit): Remove IfLetExprConseqIf{,Let} visitors. (HIRExpressionVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors. * hir/rust-hir-dump.cc (Dump::visit): Remove IfLetExprConseqIf{,Let} visitors. * hir/rust-hir-dump.h (Dump::visit): Remove IfLetExprConseqIf{,Let} visitors. * typecheck/rust-hir-type-check-expr.h (TypeCheckExpr::visit): Remove IfLetExprConseqIf{,Let} visitors. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: Unify HIR::IfExprConseqIf{,Let} into HIR::IfExprConseqElseOwen Avery4-63/+6
This should simplify 'if' expression handling to match future simplifications to 'if let' expression handling. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove IfExprConseqIf visitor. * typecheck/rust-hir-type-check-expr.h (TypeCheckExpr::visit): Remove IfExprConseqIf{,Let} visitor. * backend/rust-compile-block.cc (CompileConditionalBlocks::visit): Remove IfExprConseqIf visitor. * backend/rust-compile-block.h (CompileConditionalBlocks::visit): Remove IfExprConseqIf{,Let} visitors. (CompileExprWithBlock::visit): Remove IfExprConseqIf{,Let} visitors, implement BlockExpr visitor. * backend/rust-compile-expr.cc (CompileExpr::visit): Remove IfExprConseqIf visitor. * backend/rust-compile-expr.h (CompileExpr::visit): Remove IfExprConseqIf{,Let} visitors. * checks/lints/rust-lint-marklive.h (MarkLive::visit): Remove IfExprConseqIf visitor. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Remove IfExprConseqIf{,Let} visitors. * checks/errors/rust-const-checker.h (ConstChecker::visit): Remove IfExprConseqIf{,Let} visitors. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Remove IfExprConseqIf{,Let} visitors. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Remove IfExprConseqIf{,Let} visitors. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Remove IfExprConseqIf{,Let} visitors. * checks/errors/privacy/rust-privacy-reporter.h (PrivacyReporter::visit): Remove IfExprConseqIf{,Let} visitors. * hir/tree/rust-hir-expr.h (class IfExprConseqElse): Make else_block ExprWithBlock. (class IfExprConseqIf): Remove. (class IfExprConseqIfLet): Remove. * hir/tree/rust-hir-full-decls.h (class IfExprConseqIf): Remove. (class IfExprConseqIfLet): Remove. * hir/tree/rust-hir.cc (IfExprConseqElse::as_string): Adjust output. (IfExprConseqIf::as_string): Remove. (IfExprConseqIfLet::as_string): Remove. (IfExprConseqIf::accept_vis): Remove. (IfExprConseqIfLet::accept_vis): Remove. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Remove IfExprConseqIf{,Let} visitors. (HIRFullVisitorBase::visit): Remove IfExprConseqIf{,Let} visitors. (HIRExpressionVisitor::visit): Remove IfExprConseqIf{,Let} visitors. * hir/rust-hir-dump.cc (Dump::visit): Remove IfExprConseqIf{,Let} visitors. * hir/rust-hir-dump.h (Dump::visit): Remove IfExprConseqIf{,Let} visitors. * hir/rust-ast-lower.cc (ASTLoweringIfBlock::visit): Replace HIR::IfExprConseqIf with HIR::IfExprConseqElse. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16gccrs: cleanup resolve method address code generationPhilip Herron1-32/+20
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): remove unused code Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: Remove solve_missing_mappings_from_this to handle covariantsPhilip Herron1-9/+10
change how we monomorphize dyn-items when we need to compute the generics We might have a trait item such as: impl<'a, T> FnLike<&'a T, &'a T> for Identity { fn call(&self, arg: &'a T) -> &'a T { ... } } Which ended up monomorphized badly to: const isize & const & <example::Identity as example::FnLike::<& T, & T>>::call<& isize> (const struct example::Identity & const self, const isize & const & const arg) This is wrong because it turned into a double reference type becasuse this bug was consistent bugs were not picked up but this is not correct. We now reuse our type inference infrastructure to solve the parameters instead. Fixes #1984 gcc/rust/ChangeLog: * backend/rust-compile.cc: use unify_and instead * typecheck/rust-tyty-subst.cc (SubstitutionRef::solve_missing_mappings_from_this): remove * typecheck/rust-tyty-subst.h: update header Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16gccrs: cleanup header usage to decouple includesPhilip Herron6-14/+5
gcc/rust/ChangeLog: * backend/rust-compile-base.cc: fix headers * backend/rust-compile-base.h: likewise * backend/rust-compile-expr.cc: likewise * backend/rust-compile-extern.h: likewise * backend/rust-compile-pattern.cc: likewise * backend/rust-compile.cc: likewise * typecheck/rust-autoderef.cc: likewise * typecheck/rust-hir-dot-operator.cc: likewise * typecheck/rust-hir-inherent-impl-overlap.h: likewise * typecheck/rust-hir-path-probe.cc: likewise * typecheck/rust-hir-trait-resolve.cc: likewise * typecheck/rust-hir-type-check-base.cc: likewise * typecheck/rust-hir-type-check-base.h (RUST_HIR_TYPE_CHECK_BASE): likewise * typecheck/rust-hir-type-check-enumitem.cc: likewise * typecheck/rust-hir-type-check-expr.cc: likewise * typecheck/rust-hir-type-check-implitem.cc: likewise * typecheck/rust-hir-type-check-item.cc: likewise * typecheck/rust-hir-type-check-path.cc: likewise * typecheck/rust-hir-type-check-pattern.cc: likewise * typecheck/rust-hir-type-check-stmt.cc: likewise * typecheck/rust-hir-type-check-struct.cc: likewise * typecheck/rust-hir-type-check-type.cc: likewise * typecheck/rust-hir-type-check-type.h: likewise * typecheck/rust-hir-type-check.h (RUST_HIR_TYPE_CHECK): likewise * typecheck/rust-tyty-bounds.cc: likewise * typecheck/rust-tyty-call.cc: likewise * typecheck/rust-tyty-subst.cc: likewise * typecheck/rust-tyty.cc: likewise Signed-off-by: Philip Herron <herron.philip@googlemail.com>