2024-04-15 Thomas Schwinge * Make-lang.in (RUST_LIBDEPS): Inline into single user. 2024-04-15 Thomas Schwinge * Make-lang.in (LIBPROC_MACRO_INTERNAL): New. (RUST_LIBDEPS, crab1$(exeext)): Use it. 2024-04-15 Thomas Schwinge * Make-lang.in (RUST_LDFLAGS): Inline into single user. 2024-04-15 Thomas Schwinge * Make-lang.in (RUST_LDFLAGS): Remove 'libgrust/libproc_macro_internal'. 2024-04-09 Christophe Lyon * Make-lang.in (rust.install-dvi, rust.install-html): New rules. 2024-03-04 Mark Wielaard * lang.opt.urls: Regenerate. 2024-02-21 0xn4utilus * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add variadic check on all parameters. 2024-02-21 Owen Avery * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Lookup type of sub-pattern, not tuple pattern itself. 2024-02-21 Marc Poulhiès * backend/rust-builtins.cc (BuiltinsContext::register_rust_mappings): Add powi and reformat. * backend/rust-builtins.h: Add missing copyright header. 2024-02-21 Arthur Cohen * expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix formatting of emitted error. 2024-02-21 Owen Avery * resolve/rust-ast-resolve-item.cc (flatten_glob): Use Import class. (flatten_rebind): Likewise. (flatten_list): Likewise. (flatten): Likewise. (flatten_use_dec_to_paths): Likewise. (flatten_use_dec_to_imports): Likewise. (ResolveItem::visit): Likewise. (Import::add_prefix): New. (rust_flatten_nested_glob): Adjust test. (rust_flatten_glob): Likewise. (rust_flatten_rebind_none): Likewise. (rust_flatten_rebind): Likewise. (rust_flatten_rebind_nested): Likewise. (rust_flatten_list): Likewise. * resolve/rust-ast-resolve-item.h (class Import): New. 2024-02-21 Arthur Cohen * typecheck/rust-hir-type-check-implitem.h: Fix typo in field (region_costraints -> region_constraints). 2024-02-07 Kushal Pal * parse/rust-parse-impl.h (Parser::parse_trait_item): Handle macros in trait items similar to how its handled for trait implementation items. 2024-02-07 Kushal Pal * ast/rust-ast-collector.cc (TokenCollector::visit): Remove obsolete classes and functions. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-full-decls.h (class TraitFunctionDecl): Likewise. (class TraitItemFunc): Likewise. (class TraitMethodDecl): Likewise. (class TraitItemMethod): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * ast/rust-ast.cc (TraitItemFunc::TraitItemFunc): Likewise. (TraitItemFunc::operator=): Likewise. (TraitItemFunc::as_string): Likewise. (TraitFunctionDecl::as_string): Likewise. (TraitItemMethod::TraitItemMethod): Likewise. (TraitItemMethod::operator=): Likewise. (TraitItemMethod::as_string): Likewise. (TraitMethodDecl::as_string): Likewise. (TraitItemFunc::accept_vis): Likewise. (TraitItemMethod::accept_vis): Likewise. * ast/rust-item.h (class TraitFunctionDecl): Likewise. (class TraitItemFunc): Likewise. (class TraitMethodDecl): Likewise. (class TraitItemMethod): Likewise. * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Likewise. * checks/errors/rust-ast-validation.h: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_trait_function_decl): Likewise. (CfgStrip::maybe_strip_trait_method_decl): Likewise. (CfgStrip::visit): Likewise. * expand/rust-cfg-strip.h: Likewise. * expand/rust-derive.h: Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::expand_trait_function_decl): Likewise. (ExpandVisitor::expand_trait_method_decl): Likewise. (ExpandVisitor::visit): Likewise. * expand/rust-expand-visitor.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Likewise. * hir/rust-ast-lower-implitem.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-ast-resolve-implitem.h (visit): Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. * resolve/rust-ast-resolve-item.h: Likewise. * resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise. * resolve/rust-default-resolver.h: Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.h: Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h: Likewise. 2024-02-07 Kushal Pal * parse/rust-parse-impl.h (Parser::parse_trait_item): Use parse_function() to parse trait functions. 2024-02-07 Kushal Pal * hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Provide visitor for AST::Function. * hir/rust-ast-lower-implitem.h: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. * resolve/rust-ast-resolve-item.h: Likewise. 2024-02-07 Kushal Pal * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add checks for Trait functions. 2024-02-07 Kushal Pal * ast/rust-ast.h: Replace TraitItem with AssociatedItem. * ast/rust-item.h (class Trait): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_trait): Likewise. * parse/rust-parse.h: Likewise. 2024-02-07 Philip Herron * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): use destructure 2024-02-07 Nobel Singh * Make-lang.in: Add rust-ast-lower-implitem.cc to list of objects. * hir/rust-ast-lower-implitem.h (RUST_AST_LOWER_IMPLITEM_H): Remove implementation. * hir/rust-ast-lower-implitem.cc: Copy implementation from header. 2024-02-07 Philip Herron * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): refactor * typecheck/rust-hir-type-check.h: new prototype * typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables): x 2024-02-07 Philip Herron * typecheck/rust-hir-type-check-type.cc: remove hack 2024-02-07 Philip Herron * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack 2024-02-07 Philip Herron * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): fix 2024-02-07 Nobel Singh * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): Change default ABI to C for extern functions (ASTLoweringBase::lower_extern_block): Likewise 2024-02-07 Jakub Dupak * typecheck/rust-tyty.cc (BaseType::BaseType): Store orig ref. (BaseType::get_orig_ref): Add getter. * typecheck/rust-tyty.h: Store orig ref. 2024-02-07 Jakub Dupak * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Add region constraints. (TypeCheckImplItem::visit): Add region constraints. * typecheck/rust-hir-type-check-implitem.h: Add region constraints. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelf): Add region constraints. (TypeCheckItem::visit): Add region constraints. (TypeCheckItem::resolve_impl_item): Add region constraints. (TypeCheckItem::resolve_impl_block_substitutions): Add region constraints. * typecheck/rust-hir-type-check-item.h: Add region constraints. * typecheck/rust-hir-type-check-type.cc (ResolveWhereClauseItem::Resolve): Add region constraints. (ResolveWhereClauseItem::visit): Add region constraints. * typecheck/rust-hir-type-check-type.h (class ResolveWhereClauseItem): Add region constraints. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Add region constraints. * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): Add region constraints. * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_region_constraints): Add region constraints. * typecheck/rust-tyty-subst.h (class BaseType): Add region constraints. (struct RegionConstraints): Add region constraints. * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Add region constraints. (ADTType::clone): Add region constraints. (FnType::clone): Add region constraints. (ProjectionType::clone): Add region constraints. * typecheck/rust-tyty.h: Add region constraints. 2024-02-07 Jakub Dupak * typecheck/rust-hir-trait-resolve.cc: add regions * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): add regions, resolve generic lifetimes * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): add regions * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): add regions, resolve lifetimes (TypeCheckImplItem::visit): add regions, resove lifetimes * typecheck/rust-hir-type-check-implitem.h: add default value for result * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): add regions, resove lifetimes (TypeCheckItem::resolve_impl_block_substitutions): add regions, resove lifetimes * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add regions, resove lifetimes (TypeCheckExpr::resolve_root_path): add regions, resove lifetimes (TypeCheckExpr::resolve_segments): add regions, resove lifetimes * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): add regions, resove lifetimes (TypeCheckType::resolve_root_path): add regions, resove lifetimes (ResolveWhereClauseItem::Resolve): add regions, resove lifetimes (ResolveWhereClauseItem::visit): add regions, resove lifetimes * typecheck/rust-hir-type-check.cc (TypeCheckContext::LifetimeResolver::resolve): add regions, resolve lifetimes (TraitItemReference::get_type_from_fn): add regions, resove lifetimes * typecheck/rust-hir-type-check.h: add regions, resove lifetimes * typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): add regions, resove lifetimes (SubstMapper::Resolve): add regions, resove lifetimes (SubstMapper::InferSubst): add regions, resove lifetimes (SubstMapper::visit): add regions, resove lifetimes * typecheck/rust-substitution-mapper.h: add regions, resove lifetimes * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): lifetime resolution (TypeCheckContext::regions_from_generic_args): lifetime resolution helper * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): add regions, resove lifetimes (TypeBoundPredicate::operator=): add regions, resove lifetimes (TypeBoundPredicate::apply_generic_arguments): add regions, resove lifetimes (TypeBoundPredicateItem::get_tyty_for_receiver): add regions, resove lifetimes * typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::get_regions): add regions, resove lifetimes (SubstitutionArgumentMappings::get_mut_regions): getter (SubstitutionArgumentMappings::error): split error and empty (SubstitutionArgumentMappings::empty): split error and empty (SubstitutionArgumentMappings::find_symbol): helper (SubstitutionRef::get_num_lifetime_params): getter (SubstitutionRef::get_num_type_params): getter (SubstitutionRef::needs_substitution): extend to regions (SubstitutionRef::get_mappings_from_generic_args): helper (SubstitutionRef::infer_substitions): add regions * typecheck/rust-tyty-subst.h (class RegionParamList): region param handler * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): add regions, resove lifetimes (InferType::default_type): add regions, resove lifetimes (FnType::clone): add regions, resove lifetimes (ReferenceType::ReferenceType): add regions (ReferenceType::get_region): getter (ReferenceType::clone): add regions * typecheck/rust-tyty.h: add regions, resove 2024-02-07 Jakub Dupak * hir/tree/rust-hir-item.h: Add missing getter 2024-02-07 Jakub Dupak * typecheck/rust-tyty-region.h: New file. 2024-02-07 Jakub Dupak * typecheck/rust-hir-type-check.h (class Lifetime): add interned lifetime class * typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): add resolution tool (TypeCheckContext::intern_lifetime): add method to intern lifetime from tyctx (TypeCheckContext::lookup_lifetime): add method to lookup lifetime from tyctx (TypeCheckContext::intern_and_insert_lifetime): add a helper method 2024-02-07 Raiki Tamura * rust-lang.cc (run_rust_tests): Add test. * rust-system.h: Add . * util/make-rust-unicode.py: Output NFC_Quick_Check table. * util/rust-codepoint.h (struct Codepoint): Add is_supplementary method. * util/rust-unicode-data.h: Generated. * util/rust-unicode.cc (binary_search_sorted_array): Removed. (lookup_cc): Remove namespace. (is_alphabetic): Use std::binary_search (nfc_quick_check): New function. (nfc_normalize): Use nfc_quick_check. (is_nfc_qc_maybe): New function. (is_nfc_qc_no): New function. (rust_nfc_qc_test): New test. * util/rust-unicode.h (is_nfc_qc_no): New function. (is_nfc_qc_maybe): New function. (enum class): New enum class. (nfc_quick_check): New function. (rust_nfc_qc_test): New test. 2024-02-07 Kushal Pal * parse/rust-parse-impl.h (Parser::parse_function): Skip token if its a COMMA. 2024-01-30 Owen Avery * ast/rust-ast-full-decls.h (class TraitImplItem): Remove forward declaration. (class AssociatedItem): Add forward declaration. * ast/rust-ast.h (class TraitImplItem): Remove. (class TraitItem): Inherit from AssociatedItem. (SingleASTNode::take_trait_impl_item): Return std::unique_ptr instead of std::unique_ptr. * ast/rust-item.h (class Function): Inherit from AssociatedItem instead of TraitImplItem. (class TypeAlias): Likewise. (class ConstantItem): Likewise. (class TraitImpl): Store items as AssociatedItem. * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Return std::unique_ptr. (DeriveClone::clone_impl): Take std::unique_ptr. * expand/rust-derive-clone.h (DeriveClone::clone_fn): Return std::unique_ptr. (DeriveClone::clone_impl): Take std::unique_ptr. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Handle changes to SingleASTNode::take_trait_impl_item. * parse/rust-parse-impl.h (Parser::parse_impl): Parse TraitImpl as containing AssociatedItem. (Parser::parse_trait_impl_item): Return std::unique_ptr. (Parser::parse_trait_impl_function_or_method): Likewise. * parse/rust-parse.h (Parser::parse_trait_impl_item): Return std::unique_ptr. (Parser::parse_trait_impl_function_or_method): Likewise. 2024-01-30 Robert Goss * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit) Add additional check * typecheck/rust-hir-type-check-struct-field.h: A helper method to make error added * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve) Update message 2024-01-30 Jakub Dupak * hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): fix for lifetimes (ASTLowerWhereClauseItem::visit): fix for lifetimes 2024-01-30 Jakub Dupak * parse/rust-parse-impl.h (Parser::parse_where_clause): fix parsing (Parser::parse_where_clause_item): fix parsing (Parser::parse_type_bound_where_clause_item): fix parsing (Parser::parse_trait_bound): fix parsing * parse/rust-parse.h: fix parsing 2024-01-30 Kushal Pal * lex/rust-lex.cc (Lexer::dump_and_skip): Changed " " to '\n' 2024-01-30 Owen Avery * ast/rust-ast-fragment.cc (Fragment::assert_single_fragment): Update. * ast/rust-ast.h (class TraitImplItem): Move definition before that of TraitItem. (class TraitItem): Inherit from TraitImplItem instead of AssociatedItem. (class SingleASTNode): Unify handling of associated items. (SingleASTNode::take_assoc_item): Move from... (SingleASTNode::take_impl_item): ...here, but leave stub calling take_assoc_item behind. (SingleASTNode::take_trait_item): Cast associated item to TraitItem. (SingleASTNode::take_trait_impl_item): Cast associated item to TraitImplItem. * ast/rust-ast.cc (SingleASTNode::SingleASTNode): Unify handling of associated items. (SingleASTNode::operator=): Likewise. (SingleASTNode::accept_vis): Likewise. (SingleASTNode::is_error): Likewise. (SingleASTNode::as_string): Likewise. * ast/rust-item.h (class Function): Remove direct inheritence from AssociatedItem. (class ConstantItem): Likewise. * ast/rust-macro.h (class MacroInvocation): Remove direct inheritence from AssociatedItem and TraitImplItem. 2024-01-30 Robert Goss * typecheck/rust-hir-type-check-struct-field.h: Allow visit to return a bool * typecheck/rust-hir-type-check-struct.cc: Improve check of repeat fields 2024-01-30 Kushal Pal * parse/rust-parse-impl.h (Parser::parse_inherent_impl_item): Added switch-case for ASYNC token. 2024-01-30 Kushal Pal * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Enclose const in single quotes. 2024-01-30 Kushal Pal * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Added check for `async` functions inside trait. * parse/rust-parse-impl.h (Parser::parse_trait_item): Added switch-case for ASYNC token. 2024-01-30 Nirmal Patel * lex/rust-lex.cc (Lexer::parse_byte_string): Handle newline while parsing byte strings (Lexer::parse_string): Handle newline while parsing strings 2024-01-30 Jakub Dupak * backend/rust-compile-expr.cc (CompileExpr::visit): Use new API. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use new API. * typecheck/rust-tyty-cmp.h: Remove old API. * typecheck/rust-tyty.cc (FnPtr::is_equal): Use new API. * typecheck/rust-tyty.h: Remove old API. * typecheck/rust-unify.cc (UnifyRules::expect_fnptr): Use new API. 2024-01-30 Jakub Dupak * hir/rust-ast-lower-type.cc (ASTLoweringType::visit): For lifetimes. 2024-01-30 Jakub Dupak * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_lifetime): Propagate static requirement. * hir/rust-ast-lower-base.h: Propagate static requirement. * hir/rust-ast-lower-implitem.h: Propagate static requirement. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Propagate static requirement. * hir/rust-ast-lower-type.cc (ASTLoweringType::translate): Propagate static requirement. (ASTLoweringType::visit): Propagate static requirement. * hir/rust-ast-lower-type.h: Propagate static requirement. 2024-01-30 Jakub Dupak * parse/rust-parse-impl.h (Parser::parse_generic_param): Lifetime elision control. (Parser::parse_lifetime_where_clause_item): Lifetime elision control. (Parser::parse_type_param_bound): Lifetime elision control. (Parser::parse_lifetime_bounds): Lifetime elision control. (Parser::parse_lifetime): Lifetime elision control. (Parser::parse_path_generic_args): Lifetime elision control. (Parser::parse_self_param): Lifetime elision control. (Parser::parse_break_expr): Lifetime elision control. (Parser::parse_continue_expr): Lifetime elision control. (Parser::parse_reference_type_inner): Lifetime elision control. * parse/rust-parse.h: Lifetime elision control. 2024-01-30 Jakub Dupak * ast/rust-ast.h: Elided lifetime static constructor * ast/rust-type.h: Default lifetime to elided. * parse/rust-parse-impl.h (Parser::parse_lifetime_param): Use elided lifetime. (Parser::parse_lifetime): Use elided lifetime/ (Parser::lifetime_from_token): Use elided lifetime. (Parser::parse_self_param): Use elided lifetime. (Parser::parse_reference_type_inner): Use elided lifetime. 2024-01-30 Jakub Dupak * parse/rust-parse-impl.h (Parser::lifetime_from_token): Fix matched pattern. 2024-01-30 Kushal Pal * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Added check for `async` function inside trait. 2024-01-30 Kushal Pal * parse/rust-parse-impl.h (Parser::parse_trait_impl_item): Handled `async` items 2024-01-30 Raiki Tamura * Make-lang.in: Add .o files * backend/rust-mangle.cc (struct V0Path): moved to splitted files (v0_path): Likewise. (legacy_mangle_name): Likewise. (legacy_mangle_canonical_path): Likewise. (legacy_hash): Likewise. (v0_tuple_prefix): Likewise. (v0_numeric_prefix): Likewise. (v0_simple_type_prefix): Likewise. (v0_complex_type_prefix): Likewise. (v0_integer_62): Likewise. (v0_opt_integer_62): Likewise. (v0_disambiguator): Likewise. (v0_type_prefix): Likewise. (v0_generic_args): Likewise. (v0_identifier): Likewise. (v0_type_path): Likewise. (v0_function_path): Likewise. (v0_scope_path): Likewise. (v0_crate_path): Likewise. (v0_inherent_or_trait_impl_path): Likewise. (v0_closure): Likewise. (legacy_mangle_item): Likewise. (v0_mangle_item): Likewise. * backend/rust-mangle.h (legacy_mangle_item): Likewise. (v0_mangle_item): Likewise. * backend/rust-mangle-legacy.cc: New file. * backend/rust-mangle-v0.cc: New file. 2024-01-30 Jakub Dupak * checks/errors/borrowck/rust-bir-place.h: Cleanup. * checks/errors/borrowck/rust-borrow-checker.h: Cleanup. 2024-01-30 Jakub Dupak * typecheck/rust-tyty.h (BaseType::is): Cast API. (SubstitutionRef>): Cast API. (BaseType::as): Cast API. (BaseType::try_as): Cast API. 2024-01-30 Jakub Dupak * typecheck/rust-tyty.h (class ClosureType): Inherit interface. (class FnPtr): Inherit interface. (class FnType): Inherit interface. (class CallableTypeInterface): New interface. (BaseType::is): Detect interface members API. 2024-01-30 Jakub Dupak * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Refactor. 2024-01-30 Jakub Dupak * checks/errors/borrowck/rust-bir-builder-internal.h: Replace nodiscard. * checks/errors/borrowck/rust-bir-place.h: Replace nodiscard. 2024-01-30 Jakub Dupak * typecheck/rust-tyty.h: Fix nodiscard to warn unused. 2024-01-30 Jakub Dupak * hir/tree/rust-hir-item.h: Ad lifetime getter. * hir/tree/rust-hir-path.h: Make getter const ref. * hir/tree/rust-hir.h: Const ref and new getter. 2024-01-30 Arthur Cohen * Make-lang.in (GRS_OBJS): Add rust-attribs.o. * backend/rust-builtins.cc (builtin_const, builtin_noreturn) (builtin_novops): Remove. (BuiltinsContext::lookup_simple_builtin): Adjust. (BuiltinsContext::setup_overflow_fns): Remove. (BuiltinsContext::define_function_type): Set builtin type to errormark so the builtin is considered unavailable. (BuiltinsContext::setup_math_fns): Remove. (BuiltinsContext::setup_atomic_fns): Remove. (build_c_type_nodes): Refactor based on D frontend. (BuiltinsContext::define_builtin_types): Likewise. (DEF_PRIMITIVE_TYPE): New. (DEF_FUNCTION_TYPE_0): New. (DEF_FUNCTION_TYPE_1): New. (DEF_FUNCTION_TYPE_2): New. (DEF_FUNCTION_TYPE_3): New. (DEF_FUNCTION_TYPE_4): New. (DEF_FUNCTION_TYPE_5): New. (DEF_FUNCTION_TYPE_6): New. (DEF_FUNCTION_TYPE_7): New. (DEF_FUNCTION_TYPE_8): New. (DEF_FUNCTION_TYPE_9): New. (DEF_FUNCTION_TYPE_10): New. (DEF_FUNCTION_TYPE_11): New. (DEF_FUNCTION_TYPE_VAR_0): New. (DEF_FUNCTION_TYPE_VAR_1): New. (DEF_FUNCTION_TYPE_VAR_2): New. (DEF_FUNCTION_TYPE_VAR_3): New. (DEF_FUNCTION_TYPE_VAR_4): New. (DEF_FUNCTION_TYPE_VAR_5): New. (DEF_FUNCTION_TYPE_VAR_6): New. (DEF_FUNCTION_TYPE_VAR_7): New. (DEF_FUNCTION_TYPE_VAR_11): New. (DEF_POINTER_TYPE): New. (BuiltinsContext::setup): Adjust. (BuiltinsContext::define_builtin_attributes): New. (DEF_ATTR_NULL_TREE): New. (DEF_ATTR_INT): New. (DEF_ATTR_STRING): New. (DEF_ATTR_IDENT): New. (DEF_ATTR_TREE_LIST): New. (handle_flags): Remove. (BuiltinsContext::define_builtins): New. (DEF_BUILTIN): New. (BuiltinsContext::define_builtin): Remove. (BuiltinsContext::register_rust_mappings): New. Add all missing builtins. (BuiltinsContext::lookup_gcc_builtin): Adjust. * backend/rust-builtins.h (DEF_PRIMITIVE_TYPE): New. (DEF_FUNCTION_TYPE_0): New. (DEF_FUNCTION_TYPE_1): New. (DEF_FUNCTION_TYPE_2): New. (DEF_FUNCTION_TYPE_3): New. (DEF_FUNCTION_TYPE_4): New. (DEF_FUNCTION_TYPE_5): New. (DEF_FUNCTION_TYPE_6): New. (DEF_FUNCTION_TYPE_7): New. (DEF_FUNCTION_TYPE_8): New. (DEF_FUNCTION_TYPE_9): New. (DEF_FUNCTION_TYPE_10): New. (DEF_FUNCTION_TYPE_11): New. (DEF_FUNCTION_TYPE_VAR_0): New. (DEF_FUNCTION_TYPE_VAR_1): New. (DEF_FUNCTION_TYPE_VAR_2): New. (DEF_FUNCTION_TYPE_VAR_3): New. (DEF_FUNCTION_TYPE_VAR_4): New. (DEF_FUNCTION_TYPE_VAR_5): New. (DEF_FUNCTION_TYPE_VAR_6): New. (DEF_FUNCTION_TYPE_VAR_7): New. (DEF_FUNCTION_TYPE_VAR_11): New. (DEF_POINTER_TYPE): New. (DEF_ATTR_NULL_TREE): New. (DEF_ATTR_INT): New. (DEF_ATTR_STRING): New. (DEF_ATTR_IDENT): New. (DEF_ATTR_TREE_LIST): New. * backend/rust-compile-intrinsic.cc (Intrinsics::compile): Add comment. (op_with_overflow_inner): Adjust. (copy_handler_inner): Adjust. (prefetch_data_handler): Adjust. (build_atomic_builtin_name): Adjust. (atomic_load_handler_inner): Adjust. (uninit_handler): Adjust. (move_val_init_handler): Adjust. (expect_handler_inner): Adjust. * rust-gcc.cc (fetch_overflow_builtins): Adjust. * rust-lang.cc (rust_localize_identifier): Adjust. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): New. * rust-attribs.cc: New file. 2024-01-30 Pierre-Emmanuel Patry * expand/rust-cfg-strip.cc (CfgStrip::visit): Change calls from visitor to default visitor. (CfgStrip::go): Add call to visit crate. * expand/rust-cfg-strip.h (class CfgStrip): Update prototypes and remove empty ones. * ast/rust-ast-visitor.cc: add WhereClause condition check. 2024-01-30 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::go): Add call to visit on the crate. (ExpandVisitor::visit): Remove some visit functions in favor of their default visitor counterpart. * expand/rust-expand-visitor.h (class ExpandVisitor): Inherit from default visitor and remove now useless function prototypes. 2024-01-30 Pierre-Emmanuel Patry * resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove duplicated functions. * resolve/rust-default-resolver.h (class DefaultResolver): Make the default resolver inherit from the default visitor. 2024-01-30 Owen Avery * checks/errors/rust-feature.cc (Feature::name_hash_map): Add entries for Name::LANG_ITEMS and Name::NO_CORE. * checks/errors/rust-feature.h (Feature::Name::LANG_ITEMS): New. (Feature::Name::NO_CORE): New. 2024-01-30 Kushal Pal * backend/rust-compile-base.cc (HIRCompileBase::setup_abi_options): Renamed `WIN64` to `WIN_64` * util/rust-abi.cc (get_abi_from_string): Likewise (get_string_from_abi): Likewise * util/rust-abi.h (enum ABI): Likewise 2024-01-30 Nobel Singh * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add check for const funtion. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add a validation check and emit an error depending on the context. 2024-01-30 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Adapt defintion getter. * 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-implitem.h: Likewise. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * parse/rust-parse-impl.h: Allow empty function body during parsing. * ast/rust-ast.cc (Function::Function): Constructor now take an optional for the body. (Function::operator=): Adapt to new optional member. (Function::as_string): Likewise. * ast/rust-item.h (class Function): Make body optional and do not rely on nullptr anymore. 2024-01-30 Pierre-Emmanuel Patry * resolve/rust-early-name-resolver.cc (EarlyNameResolver::resolve_generic_args): Move function. (EarlyNameResolver::resolve_qualified_path_type): Likewise. (EarlyNameResolver::visit): Add a top level visit function for crate and remove duplicated code. * resolve/rust-early-name-resolver.h (class EarlyNameResolver): Update overriden function list. 2024-01-30 Pierre-Emmanuel Patry * util/rust-attributes.cc (AttributeChecker::visit): Add visit function for crates. * util/rust-attributes.h (class AttributeChecker): Update function prototypes. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Add a visit function for the crate level. (FeatureGate::check): Add call to crate visit. * checks/errors/rust-feature-gate.h (class FeatureGate): Remove now useless visit functions (traversal only). 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add const check. * checks/errors/rust-ast-validation.h: Add visit function prototype. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add async const check. 2024-01-30 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_vis_item): Allow parsing async items in const. (Parser::parse_async_item): Account for const offset during async lookahead. 2024-01-30 Pierre-Emmanuel Patry * ast/rust-ast-builder.cc (AstBuilder::fn_qualifiers): Change constructor to match the new arguments. * ast/rust-ast-collector.cc (TokenCollector::visit): Change behavior to handle both const and async specifiers at the same time. * ast/rust-ast.cc (FunctionQualifiers::as_string): Likewise. * ast/rust-item.h (class FunctionQualifiers): Remove AsyncConstStatus and replace it with both Async and Const status. Also change the safety arguments to use an enum instead of a boolean. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): Update constructor call. * hir/tree/rust-hir-item.h: Add Const and Async status, remove AsyncConstStatus, update the constructor. * hir/tree/rust-hir.cc (FunctionQualifiers::as_string): Update with the new status. * parse/rust-parse-impl.h (Parser::parse_function_qualifiers): Update constructor call. * util/rust-common.h (enum Mutability): Make an enum class. (enum class): Add Async and Const enum class to avoid booleans. (enum Unsafety): Change to an enum class. 2024-01-30 Owen Avery * ast/rust-ast-full-decls.h (class InherentImplItem): Remove. * ast/rust-ast.h (class InherentImplItem): Remove. (class SingleASTNode): Store pointer to AssociatedItem instead of InherentImplItem. * ast/rust-ast.cc (SingleASTNode::SingleASTNode): Use clone_associated_item instead of clone_inherent_impl_item. (SingleASTNode::operator=): Likewise. * ast/rust-item.h (class InherentImpl): Use AssociatedItem rather than InherentImplItem. (class Function): Likewise. (class ConstantItem): Likewise. * ast/rust-macro.h (class MacroInvocation): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_impl): Likewise. (Parser::parse_inherent_impl_item): Likewise. (Parser::parse_inherent_impl_function_or_method): Likewise. * parse/rust-parse.h (Parser::parse_inherent_impl_item): Likewise. (Parser::parse_inherent_impl_function_or_method): Likewise. 2024-01-30 Philip Herron * backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block): removed * backend/rust-compile-base.h: update header * backend/rust-compile-block.cc (CompileBlock::visit): remove old logic * backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): likewise * backend/rust-compile-stmt.cc (CompileStmt::visit): likewise * backend/rust-compile-var-decl.h: ensure we setup tuple bindings correctly 2024-01-30 Pierre-Emmanuel Patry * ast/rust-item.h: Add safety getter to modules. * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Check a module's safety and emit an error when meeting an unsafe module. * checks/errors/rust-ast-validation.h: Add function prototype. * parse/rust-parse-impl.h (Parser::parse_module): Move the module locus to the first token instead of the mod keyword. 2024-01-30 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_vis_item): Dispatch to parse module when meeting an unsafe module. (Parser::parse_module): Set unsafe status when the parser encounter an unsafe keyword. 2024-01-30 Pierre-Emmanuel Patry * ast/rust-item.h: Add safety status to Modules in the AST. * parse/rust-parse-impl.h (Parser::parse_module): Adapt constructors. 2024-01-30 Owen Avery * hir/tree/rust-hir-pattern.h (class TupleItems): New. (class TupleStructItems): Inherit from TupleItems. (class TuplePatternItems): Likewise. 2024-01-30 Arthur Cohen * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out): New functions. (TopLevel::handle_use_dec): New function. (flatten_rebind): Likewise. (flatten_list): Likewise. (flatten_glob): Likewise. (flatten): Likewise. (TopLevel::visit): Visit various `use` declaration nodes. * resolve/rust-toplevel-name-resolver-2.0.h: Declare functions and visitors. 2024-01-30 Arthur Cohen * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Remove visitors. * resolve/rust-early-name-resolver-2.0.h: Likewise. 2024-01-30 Arthur Cohen * ast/rust-item.h (class UseTree): Add `node_id` member. 2024-01-30 Arthur Cohen * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out): Add documentation comment. (TopLevel::go): Likewise. 2024-01-30 Arthur Cohen * resolve/rust-early-name-resolver-2.0.cc (Early::insert_once): New function. (Early::visit): Likewise. * resolve/rust-early-name-resolver-2.0.h: Likewise. 2024-01-30 Arthur Cohen * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Store mappings after having resolved them. * resolve/rust-late-name-resolver-2.0.h: Add `TypePath` visitor. 2024-01-30 Arthur Cohen * resolve/rust-late-name-resolver-2.0.cc (Late::setup_builtin_types): New function. (Late::go): Setup builtin types. * resolve/rust-late-name-resolver-2.0.h: * resolve/rust-name-resolution-context.cc (NameResolutionContext::map_usage): New function. * resolve/rust-name-resolution-context.h: Likewise. 2024-01-30 Arthur Cohen * resolve/rust-name-resolution-context.h: Store a reference to the mappings. * resolve/rust-name-resolution-context.cc (NameResolutionContext::NameResolutionContext): Likewise. 2024-01-30 Arthur Cohen * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Use the DefaultResolver in the toplevel visitor. 2024-01-30 Arthur Cohen * Make-lang.in: Compile late name resolver. * resolve/rust-late-name-resolver-2.0.cc: New file. * resolve/rust-late-name-resolver-2.0.h: New file. 2024-01-30 Arthur Cohen * resolve/rust-name-resolution-context.h: Add a Labels stack. 2024-01-30 M V V S Manoj Kumar * parse/rust-parse-impl.h (Parser::parse_item): Likewise. (Parser::parse_vis_item): Likewise. (Parser::parse_async_item): Likewise. * parse/rust-parse.h: Made declaration for parse_async_item. 2024-01-30 Pierre-Emmanuel Patry * lex/rust-lex.cc (Lexer::classify_keyword): Update keyword map name. * lex/rust-token.h (enum PrimitiveCoreType): Remove some deprecated comments. * util/rust-keyword-values.cc (get_keywords): Update the keyword map name. (RS_TOKEN): Define as empty (RS_TOKEN_KEYWORD_2015): Add the emission value. (RS_TOKEN_KEYWORD_2018): Likewise. * util/rust-keyword-values.h (RS_KEYWORD_LIST): Introduce the keyword list. (RS_TOKEN_KEYWORD_2018): Define multiple new keywords. 2024-01-30 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Replace raw value. * parse/rust-parse-impl.h (Parser::is_macro_rules_def): Likewise. (Parser::parse_item): Likewise. (Parser::parse_vis_item): Likewise. (Parser::parse_macro_rules_def): Likewise. (Parser::parse_union): Likewise. (Parser::parse_trait_impl_item): Likewise. (Parser::parse_stmt): Likewise. (Parser::parse_stmt_or_expr): Likewise. 2024-01-30 Pierre-Emmanuel Patry * util/rust-keyword-values.h (class WeakKeywords): Add new class with weak keyword constexpr. 2024-01-30 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Replace raw value with keyword call. * ast/rust-ast.h: Likewise. * parse/rust-parse-impl.h (Parser::parse_path_ident_segment): Likewise. (Parser::parse_macro_match_fragment): Likewise. (Parser::parse_extern_crate): Likewise. (Parser::parse_use_tree): Likewise. (Parser::parse_const_item): Likewise. (Parser::parse_literal_expr): Likewise. (Parser::parse_maybe_named_param): Likewise. (Parser::parse_pattern_no_alt): Likewise. (Parser::left_denotation): Likewise. (Parser::parse_path_in_expression_pratt): Likewise. 2024-01-30 Pierre-Emmanuel Patry * lex/rust-token.h (enum PrimitiveCoreType): Add await keyword definition. 2024-01-30 Pierre-Emmanuel Patry * lex/rust-token.h (enum PrimitiveCoreType): Change macro for underscore in token list. 2024-01-30 Pierre-Emmanuel Patry * lex/rust-token.h (enum PrimitiveCoreType): Change enum macro calls. (RS_TOKEN_KEYWORD): Remove generic token keyword macro. (RS_TOKEN_KEYWORD_2015): Introduce keywords for edition 2015. (RS_TOKEN_KEYWORD_2018): Likewise with edition 2018. * lex/rust-token.cc (RS_TOKEN_KEYWORD): Remove old macro definition. (RS_TOKEN_KEYWORD_2015): Replace with 2015 definition... (RS_TOKEN_KEYWORD_2018): ... and 2018 definition. * util/rust-keyword-values.cc (RS_TOKEN_KEYWORD): Likewise. (RS_TOKEN_KEYWORD_2015): Likewise. (RS_TOKEN_KEYWORD_2018): Likewise. * util/rust-keyword-values.h (RS_TOKEN_KEYWORD): Likewise. (RS_TOKEN_KEYWORD_2015): Likewise. (RS_TOKEN_KEYWORD_2018): Likewise. 2024-01-30 Pierre-Emmanuel Patry * lex/rust-token.h (enum PrimitiveCoreType): Change keyword suffix from tok to kw. * ast/rust-ast-collector.cc (TokenCollector::visit): Update suffix to match the new declaration. * lex/rust-lex.cc (Lexer::parse_raw_identifier): Likewise. * parse/rust-parse-impl.h (can_tok_start_type): Likewise. (Parser::parse_item): Likewise. (Parser::parse_vis_item): Likewise. (Parser::parse_extern_crate): Likewise. (Parser::parse_function): Likewise. (Parser::parse_function_qualifiers): Likewise. (Parser::parse_struct): Likewise. (Parser::parse_enum): Likewise. (Parser::parse_static_item): Likewise. (Parser::parse_trait_item): Likewise. (Parser::parse_inherent_impl_item): Likewise. (Parser::parse_trait_impl_item): Likewise. (Parser::parse_extern_block): Likewise. (Parser::parse_external_item): Likewise. (Parser::parse_stmt): Likewise. (Parser::parse_return_expr): Likewise. (Parser::parse_match_expr): Likewise. (Parser::parse_type): Likewise. (Parser::parse_for_prefixed_type): Likewise. (Parser::parse_type_no_bounds): Likewise. (Parser::parse_stmt_or_expr): Likewise. * parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewie. * util/rust-token-converter.cc (convert): Likewise. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add zero field check during ast validation pass. * checks/errors/rust-ast-validation.h: Add union visit function prototype. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add ast validation pass to reject variadic arguments on regular functions. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add auto trait associated item check in AST validation pass. * parse/rust-parse-impl.h: Remove old error emission done during parsing pass. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Reject auto traits with super traits. 2024-01-30 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add check for generics on auto traits. * checks/errors/rust-ast-validation.h: Add visit function prototype. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.hxx: Remove debug log. 2024-01-30 Arthur Cohen * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Format. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.h: New method. * resolve/rust-forever-stack.hxx: Likewise. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.h: New method. * resolve/rust-forever-stack.hxx: Likewise. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.hxx: Do not copy segment when dereferencing iterator in `find_starting_point`. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.h: Fix `ForeverStack::resolve_path` signature. * resolve/rust-forever-stack.hxx: Likewise. * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Use new API. (Early::visit_attributes): Likewise. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.hxx: Add specific behavior for `ForeverStack::get` when dealing with labels. 2024-01-30 Arthur Cohen * resolve/rust-forever-stack.h: Improve resolve_path API. * resolve/rust-forever-stack.hxx: Likewise and fix implementation. 2024-01-30 Arthur Cohen * resolve/rust-rib.h: Add Namespace enum. 2024-01-30 Arthur Cohen * ast/rust-ast.h: Change Path API to be more consistent. * ast/rust-path.h: Likewise. * ast/rust-ast-collector.cc (TokenCollector::visit): Use new API. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-forever-stack.hxx: Likewise. 2024-01-30 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_function): Early return on unrecoverable errors. (Parser::parse_trait_item): Likewise. (Parser::parse_self_param): Update return type. * parse/rust-parse.h (enum ParseSelfError): Add enumeration to describe different self parameter parsing errors. 2024-01-30 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_self_param): Fix the loop exit condition. 2024-01-30 Pierre-Emmanuel Patry * ast/rust-item.h (struct Visibility): Move Visibility from here... * ast/rust-ast.h (struct Visibility): ...to here. * parse/rust-parse-impl.h (Parser::parse_trait_item): Parse visibility before giving it back to the item parsing function. (Parser::parse_trait_type): Add visibility modifier. * parse/rust-parse.h (RUST_PARSE_H): Change function prototype. 2024-01-18 Arthur Cohen * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Cast size_t value to unsigned long. * expand/rust-proc-macro.cc (load_macros): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (TupleStructItems::ItemType::RANGE): Rename to... (TupleStructItems::ItemType::RANGED): ...here. (TupleStructItems::ItemType::NO_RANGE): Rename to... (TupleStructItems::ItemType::MULTIPLE): ...here. (TuplePatternItems::TuplePatternItemType): Rename to... (TuplePatternItems::ItemType): ...here. : Handle renames. * backend/rust-compile-pattern.cc: Likewise. * typecheck/rust-hir-type-check-pattern.cc: Likewise. * checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-lex.cc (Lexer::parse_decimal_int_or_float): Remove additional zero after empty floating point. * parse/rust-parse-impl.h (Parser::left_denotation): Handle float with empty floating point. 2024-01-16 Raiki Tamura * backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): Fix reference to node. * backend/rust-mangle.cc (struct V0Path): Modified to accept closures. (v0_crate_path): Modified to accept closures. (v0_closure): New function to mangle closures. (v0_path): Modified to accept closures * util/rust-mapping-common.h (UNKNOWN_NODEID): Change to UINT32_MAX. (UNKNOWN_HIRID): Change to UINT32_MAX. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Move from here... * ast/rust-ast-visitor.h: ... to here. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Move to header file. (TokenCollector::visit_items_joined_by_separator): Likewise. (TokenCollector::visit_as_line): Likewise. (TokenCollector::visit_items_as_lines): Likewise. (TokenCollector::visit_items_as_block): Likewise. * ast/rust-ast-collector.h: Add implementation. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor for VariadicParam and remove Self parameter visitor from Function visit. * expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_self_param): Remove function. (CfgStrip::maybe_strip_trait_method_decl): Remove self parameter visit. (CfgStrip::maybe_strip_function_params): Handle new function parameters. (CfgStrip::visit): Handle VariadicParam, SelfParam and FunctionParam. * expand/rust-expand-visitor.cc (ExpandVisitor::expand_self_param): Remove function. (ExpandVisitor::expand_trait_method_decl): Do not visit self parameter. (ExpandVisitor::visit): Add visit for VariadicParam, FunctionParam and SelfParam. (ExpandVisitor::expand_function_params): Visit parameters instead. * expand/rust-expand-visitor.h: Update function prototypes. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Update visit with new parameters. (ResolveTraitItems::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Update visit functions with the new visitor functions for VariadicParam SelfParam and FunctionParam. * resolve/rust-early-name-resolver.h: Update function prototypes. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Update visitor according to the new function parameter structures. * ast/rust-ast-visitor.h: Update prototypes and add visitor virtual functions for SelfParam, FunctionParam and VariadicParam. * ast/rust-ast.cc (Function::Function): Move constructor in implementation instead of header. (Function::operator=): Likewise. (Function::as_string): Update function with pointer dereference. (VariadicParam::as_string): Likewise. (TraitFunctionDecl::as_string): Likewise. (TraitMethodDecl::as_string): Likewise. (FunctionParam::accept_vis): Add function for visitor. (SelfParam::accept_vis): Likewise. (VariadicParam::accept_vis): Likewise. (TraitItemFunc::TraitItemFunc): Move constructor to implementation file. (TraitItemFunc::operator=): Likewise. (TraitItemMethod::TraitItemMethod): Likewise. (TraitItemMethod::operator=): Likewise. * ast/rust-item.h (class Function): Remove self optional member. (class TraitMethodDecl): Likewise. (class TraitFunctionDecl): Likewise. (class Param): Add abstract parameter class. (class SelfParam): Inherit from Param and remove parameter common members. (class FunctionParam): Likewise. (class VariadicParam): Likewise. (struct Visibility): Move structure declaration. (class VisItem): Likewise. * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add a self parameter check during AST validation. * checks/errors/rust-ast-validation.h: Add function prototype. * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Update function constructor. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Rework function for the new parameters. (ASTLoweringBase::visit): Add visit functions for VariadicParam, FunctionParam and SelfParam. * hir/rust-ast-lower-base.h: Update function prototypes. * parse/rust-parse-impl.h (Parser::parse_function): Update function according to new function representation. (Parser::parse_function_param): Return vector of abstract param instead of FunctionParam. (Parser::parse_method): Update according to new representation. (Parser::parse_trait_item): Likewise. (Parser::parse_self_param): Error out with self pointers and prevent the lexer from eating regular function parameters. Update return type. * parse/rust-parse.h: Update function return types. * ast/rust-ast-collector.h: Add VariadicParam visit prototype. * ast/rust-ast.h (struct Visibility): Move struct declaration. (class VisItem): Likewise. * ast/rust-expr.h: Update included files. * checks/errors/rust-feature-gate.h: Add visitor functions for SelfParam, FunctionParam and VariadicParam. * expand/rust-cfg-strip.h: Update function prototypes. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-implitem.h: Handle special arguments. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise. * metadata/rust-export-metadata.cc (ExportContext::emit_function): Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add visitor functions. * resolve/rust-ast-resolve-base.h: Update prototypes. * resolve/rust-ast-resolve-stmt.h: Handle new parameter kind. * resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise. * resolve/rust-default-resolver.h: Update prototype. * util/rust-attributes.cc (AttributeChecker::visit): Add visitor functions for SelfParam and VariadicParam. * util/rust-attributes.h: Add visit prototypes. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add check for additional named argument as well as variadic argument's position. * checks/errors/rust-ast-validation.h: Add visit function prototype for external functions. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Push the new trait context when visiting a trait. * ast/rust-ast-visitor.h: Add visit function prototype and TRAIT context. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Change reported error location to the lifetime location. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check if there is a label before visit. * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Emit an error when a label has a forbidden name. * checks/errors/rust-ast-validation.h: Add function prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-expr.h (class BreakExpr): Change Lifetime to LoopLabel. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Lower lifetime inside the label instead. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Resolve the inner lifetime. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-lex.cc (Lexer::parse_raw_identifier): Use const value. * parse/rust-parse-impl.h (Parser::parse_simple_path_segment): Likewise. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-lex.cc (RS_TOKEN): Remove local map. (RS_TOKEN_KEYWORD): Likewise. (Lexer::classify_keyword): Change call to utils. * util/rust-keyword-values.cc (get_keywords): Add init function. (RS_TOKEN_KEYWORD): Call to X macro. * util/rust-keyword-values.h: Change from set to a map. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (RS_TOKEN): Remove locale set. (RS_TOKEN_KEYWORD): Likewise. (ASTValidation::visit): Change keyword set call to the one from utils. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add rust-keyword-values.cc to the list. * util/rust-keyword-values.cc: New file. * util/rust-keyword-values.h: New file. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attribute-values.h (RUST_ATTRIBUTES_VALUE_H): Remove old header guard. (RUST_ATTRIBUTE_VALUES_H): Add new one. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (RS_TOKEN): Add keyword set. (RS_TOKEN_KEYWORD): Likewise. (ASTValidation::visit): Add validation on lifetime visit. * checks/errors/rust-ast-validation.h: Add function prototype. 2024-01-16 Owen Avery * ast/rust-item.h (class Method): Remove. (Function::self_param): New. (Function::has_self_param): New. (Function::Function): Initialize self_param. (Function::operator=): Likewise. (Function::get_self_param): New. * ast/rust-ast.cc (Method::as_string): Remove. (Method::accept_vis): Remove. * ast/rust-ast-collector.cc (TokenCollector::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * ast/rust-ast-collector.h (TokenCollector::visit): Remove AST::Method visitor. * ast/rust-ast-full-decls.h (class Method): Remove. * ast/rust-ast-visitor.h (ASTVisitor::visit): Remove AST::Method visitor. (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Remove AST::Method visitor. * checks/errors/rust-feature-gate.h (FeatureGate::visit): Likewise.. * expand/rust-cfg-strip.cc (CfgStrip::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * expand/rust-cfg-strip.h (CfgStrip::visit): Remove AST::Method visitor. * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Return AST::Function instead of AST::Method. * expand/rust-derive.h (DeriveVisitor::visit): Remove AST::Method visitor. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * expand/rust-expand-visitor.h: (ExpandVisitor::visit): Remove AST::Method visitor. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-implitem.h (ASTLowerImplItem::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * parse/rust-parse-impl.h: Include optional.h. (Parser::parse_function): Adjust AST::Function construction. (Parser::parse_inherent_impl_function_or_method): Construct AST::Function instead of AST::Method, adjust AST::Function construction. (Parser::parse_trait_impl_function_or_method): Likewise. (Parser::parse_method): Return std::unique_ptr instead of AST::Method. * parse/rust-parse.h (Parser::parse_method): Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Remove AST::Method visitor. * resolve/rust-ast-resolve-base.h (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-implitem.h (ResolveToplevelImplItem::visit): Likewise. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * resolve/rust-ast-resolve-item.h (ResolveItem::visit): Remove AST::Method visitor. * resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove AST::Method visitor. * resolve/rust-default-resolver.h (DefaultResolver::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Remove AST::Method visitor, handle self_param in AST::Function visitor. * resolve/rust-early-name-resolver.h (EarlyNameResolver::visit): Remove AST::Method visitor. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h (AttributeChecker::visit): Likewise. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_named_function_param): Add new parsing ability. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (ExternalFunctionItem::as_string): Adapt as_string function to the new ast representation. (NamedFunctionParam::as_string): Likewise. * ast/rust-item.h: Add a function to test whether a FunctionParam has a name pattern. * expand/rust-cfg-strip.cc (CfgStrip::visit): Adapt cfg strip visitor for the new variadic arguments. * hir/rust-ast-lower-extern.h: Adapt lowering to the new variadic function representation. * metadata/rust-export-metadata.cc (ExportContext::emit_function): Change call to constructor. * parse/rust-parse-impl.h (Parser::parse_named_function_param): Change NamedFunctionParam parsing to accomodate new variadic representation. (Parser::parse_external_item): Change external item parsing to use the new NamedFunctionParam variadics. * parse/rust-parse.h: Add new parsing function prototypes. * ast/rust-ast-collector.cc (TokenCollector::visit): Rework token collection to take into account variadic parameters. * ast/rust-ast-visitor.cc: Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Change function bound to avoid getting the type of a variadic parameter. * resolve/rust-ast-resolve-item.cc (ResolveExternItem::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-item.h (class NamedFunctionParam): Add variadic boolean and another constructor. * hir/rust-ast-lower-extern.h: Avoid last parameter when variadic. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-item.h: Add a getter to check if a given function is variadic. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_function_param): Parse variadic functions. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-item.h (class FunctionParam): Add some informations to function parameters in order to be able to store variadic argument as a function parameter. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Adapt the call to the new visit functions. (ASTValidation::check): Launch the parent class visitor root function. * checks/errors/rust-ast-validation.h (class ASTValidation): Inherit from the contextual visitor. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Add multiple context saving calls. * ast/rust-ast-visitor.h (class DefaultASTVisitor): Make visit functions virtual. (class ContextualASTVisitor): Add a stack like container for the current context chain. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add the new visitor object file. * ast/rust-ast-visitor.h (class DefaultASTVisitor): Create the default visitor class. * ast/rust-ast.h: Add a new reference getter for visitor pattern. * ast/rust-ast-visitor.cc: New file. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add some missing mutable reference getters. * ast/rust-expr.h: Likewise. * ast/rust-item.h: Likewise. * ast/rust-path.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Check for presence of a type and use the default value instead of the type. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/rust-ast-validation.cc (ASTValidation::check): Launch check over the whole given crate. (ASTValidation::visit): Implement visitor for some members of the ast. * checks/errors/rust-ast-validation.h: Update some prototype according to implemented visitor functions. Also add a context tracker. 2024-01-16 Pierre-Emmanuel Patry * rust-session-manager.cc (Session::compile_crate): Add call to ast validation. 2024-01-16 Pierre-Emmanuel Patry * lang.opt: Add the new compile options and update the enum values. * rust-session-manager.h (struct CompileOptions): Add the new steps to the enumeration. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add the new object file the list. * checks/errors/rust-ast-validation.cc: New file. * checks/errors/rust-ast-validation.h: New file. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-cfg-strip.cc (CfgStrip::visit): Add expr value check. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Move implementation from here... * ast/rust-ast.cc (SingleASTNode::SingleASTNode): ...to here. (SingleASTNode::operator=): ...and here... (SingleASTNode::accept_vis): ...and here... (SingleASTNode::is_error): ...and here... (SingleASTNode::as_string): ...also here. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add override specifier. * ast/rust-item.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::split_current_token): Add implementation for multiple token split. * expand/rust-macro-invoc-lexer.h: Add function prototype. * expand/rust-proc-macro-invoc-lexer.cc (ProcMacroInvocLexer::split_current_token): Add implementation for 2+ token split for procedural macros. * expand/rust-proc-macro-invoc-lexer.h: Add function prototype. * lex/rust-lex.cc (Lexer::split_current_token): Add function to split a token in multiple other tokens. * lex/rust-lex.h: Add function prototype for split_current_token. * parse/rust-parse-impl.h (Parser::left_denotation): Handle float tuple index identified as a float literal. 2024-01-16 Jakub Dupak * hir/rust-hir-dump.cc (Dump::visit): Remove obsolete member. * hir/tree/rust-hir-expr.h (class BorrowExpr): Remove obsolete member. * hir/tree/rust-hir.cc (BorrowExpr::as_string): Remove obsolete member. 2024-01-16 Jakub Dupak * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Fix typo. 2024-01-16 Owen Avery * backend/rust-compile-expr.cc (patterns_mergeable): Remove. (struct PatternMerge): Remove. (sort_tuple_patterns): Remove. (simplify_tuple_match): Remove. (CompileExpr::visit): Modify compilation of MatchExpr. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Replace with... (CompilePatternCheckExpr::visit): ...this. * backend/rust-compile-pattern.h (class CompilePatternCaseLabelExpr): Replace with... (class CompilePatternCheckExpr): ...this. * backend/rust-compile-type.cc (TyTyResolveCompile::get_implicit_enumeral_node_type): Make enumeral type equivalent to isize. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-base.cc (get_attributes): Add documentation for indices 3 and 4. (get_trait_name): Add documentation for index 1. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add gcc/rust/backend/rust-compile-proc-macro.cc to the list of file to compile. * backend/rust-compile.cc (attribute_array): Move to rust-compile-proc-macro.cc (derive_proc_macro): Likewise. (bang_proc_macro): Likewise. (attribute_proc_macro): Likewise. (proc_macro_payload): Likewise. (proc_macro): Likewise. (proc_macro_buffer): Likewise. (entrypoint): Likewise. (proc_macro_array): Likewise. (CompileCrate::add_proc_macro_symbols): Likewise. * backend/rust-compile-proc-macro.cc: New file. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile.cc (proc_macro_buffer): Update type builder with array length information. (proc_macro_array): Update type initializer with array length information. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile.cc (build_attribute_array): Renamed from... (attribute_array): ...to attribute array. (build_derive_proc_macro): Likewise from... (derive_proc_macro): ... to derive_proc_macro. (build_bang_proc_macro): Likewise from... (bang_proc_macro): ...to bang_proc_macro. (build_attribute_proc_macro): Likewise from... (attribute_proc_macro): ... to attribute_proc_macro. (build_proc_macro_payload): Likewise from... (proc_macro_payload): to proc_macro_payload. (build_proc_macro): Likewise from... (proc_macro): ...to proc_macro. (build_proc_macro_buffer): Likewise from... (proc_macro_buffer): ... to proc_macro_buffer. (build_entrypoint): Likewise from... (entrypoint): ...to entrypoint. (init_derive_proc_macro): Renamed to it's shorter counterpart. (init_attribute_proc_macro): Likewise. (init_bang_proc_macro): Likewise. (init_proc_macro): Likewise. (initialize_proc_macro_array): Likewise. (proc_macro_array): Likewise. (CompileCrate::add_proc_macro_symbols): Update function calls. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-base.h: Make static function address_expression public. * backend/rust-compile.cc (CompileCrate::add_proc_macro_symbols): Add new global variable in export function. (build_bang_proc_macro): Add a function to build the bang proc macro structure type. (build_proc_macro): Add a function to build the proc macro structure type. (build_proc_macro_payload): Add a function to build the proc macro union used in proc macro structures. (init_derive_proc_macro): Add a function to initialize custom derive proc macros. (init_attribute_proc_macro): Add a function to initialize attribute proc macros. (init_bang_proc_macro): Add a function to initialize bang proc macros. (init_proc_macro): Add a function to initialize proc macro structures. (initialize_proc_macro_array): Add a function to initialize the proc macro buffer array. (CompileCrate::add_proc_macro_symbols): Add call to the new functions to correctly initialize proc macros as well as their entrypoint. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (CustomDeriveProcMacro::CustomDeriveProcMacro): Remove constant string declaration. (load_macros_array): Add call to the new generation function. (generate_proc_macro_decls_symbol): Add a new function to generate the entrypoint symbol name from the stable crate id. (PROC_MACRO_DECLS_FMT_ARGS): New macro to keep formats arguments in sync between each call. * expand/rust-proc-macro.h (generate_proc_macro_decls_symbol): Add function prototype. * rust-system.h: Include . 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile.cc (build_attribute_array): Add a function to build the attribute array type. (build_derive_proc_macro): Add a function to build the derive proc macro type. (build_bang_proc_macro): Add a function to build the bang proc macro type. (build_attribute_proc_macro): Add a function to build the attribute proc macro type. (build_proc_macro): Add a function to build the proc macro tagged union type. (build_proc_macro_buffer): Add a function to build the proc macro buffer type. (build_entrypoint): Add a function to build the proc macro entrypoint type. * backend/rust-compile.h: Add function prototype. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-context.h: Add getters. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl): Make the function non static in order to be able to access the compile context. Also add the whole proc macro infomrmation collection. (get_attributes): Add a function to retrieve the different attributes from a derive procedural macro definition attribute. (get_trait_name): Add a function to retrieve the trait name from a derive procedural macro definition attribute. * backend/rust-compile-base.h: Add function prototypes. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-base.cc (HIRCompileBase::setup_abi_options): Reformat uncorrectly formatted comments. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-context.h (struct CustomDeriveInfo): Add new derive procedural macro metadata information holder for mappings. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add const getter. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-base.cc (handle_proc_macro_common): Add new attribute "gccrs_proc_macro" to all procedural macro functions. (get_abi): Add a function to retrieve the correct ABI depending on wether the function is a proc macro or not. 2024-01-16 Pierre-Emmanuel Patry * backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl): Add proc macro handlers dispatch. (handle_proc_macro_common): Add a function for common behavior between all kinds of proc macros. * backend/rust-compile-base.h: Add function prototypes. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::setup_loop): Move. (ExprStmtBuilder::get_label_ctx): Move. (ExprStmtBuilder::get_unnamed_loop_ctx): Moved. (ExprStmtBuilder::visit): BIR improvements. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Refactor. * checks/errors/borrowck/rust-bir-builder-internal.h (class LifetimeResolver): Refactor. (struct BuilderContext): Move.Refactor. (optional_from_ptr): Map on null ptr. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h (class LazyBooleanExprBuilder): Refactor. * checks/errors/borrowck/rust-bir-builder-pattern.h: Refactor. * checks/errors/borrowck/rust-bir-builder-struct.h (class StructBuilder): Refactor. * checks/errors/borrowck/rust-bir-builder.h: Refactor. * checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Refactor. (Dump::visit): Refactor. (Dump::visit_place): Refactor. (Dump::visit_move_place): Refactor. (Dump::visit_lifetime): Refactor. * checks/errors/borrowck/rust-bir-dump.h: Refactor. * checks/errors/borrowck/rust-bir-place.h: Refactor. 2024-01-16 Jakub Dupak * checks/errors/borrowck/dev-notes.md: New file. 2024-01-16 Jakub Dupak * checks/errors/borrowck/bir-design-notes.md: New file. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Use goto. * checks/errors/borrowck/rust-bir-builder-internal.h: Explicit goto. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Explicit goto. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Continue. (ExprStmtBuilder::setup_loop): Continue. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg): Detech infinite loops. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Push ctx. (ExprStmtBuilder::setup_loop): Common loop infractructure setup. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Loop ctx. * checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext): Loop ctx. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Improve jumps dump. (Dump::visit): Improve jumps dump. * checks/errors/borrowck/rust-bir-dump.h (class Dump): Improve jumps dump. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg): Simplify cfg logic. (Dump::go): Run simplify cfg. * checks/errors/borrowck/rust-bir-dump.h: Option to simplify cfg. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use new print. (print_comma_separated): Comma separation print. (Dump::visit): Use new print. 2024-01-16 Jakub Dupak * Make-lang.in: Build BIR dump. * checks/errors/borrowck/rust-borrow-checker.cc (mkdir_wrapped): Cross-platform mkdir. (dump_function_bir): Save dump to file. (BorrowChecker::go): Run dump during borrowck. * checks/errors/borrowck/rust-bir-dump.cc: New file. * checks/errors/borrowck/rust-bir-dump.h: New file. 2024-01-16 Jakub Dupak * Make-lang.in: Compile BIR expr visitor. * checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Use BIR builder. * rust-session-manager.cc (Session::compile_crate): Run borrow checker. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc: New file. * checks/errors/borrowck/rust-bir-builder-expr-stmt.h: New file. * checks/errors/borrowck/rust-bir-builder-internal.h: New file. * checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: New file. * checks/errors/borrowck/rust-bir-builder-pattern.h: New file. * checks/errors/borrowck/rust-bir-builder-struct.h: New file. * checks/errors/borrowck/rust-bir-builder.h: New file. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-borrow-checker.cc: Include to compile new code. * checks/errors/borrowck/rust-bir-place.h: New file. * checks/errors/borrowck/rust-bir-visitor.h: New file. * checks/errors/borrowck/rust-bir.h: New file. 2024-01-16 Jakub Dupak * lang.opt: CLI flag. * rust-session-manager.cc (Session::compile_crate): Guard execution. 2024-01-16 Jakub Dupak * checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::BorrowChecker): Opt dump. (BorrowChecker::go): Opt dump. * checks/errors/borrowck/rust-borrow-checker.h (class BorrowChecker): Opt dump. * lang.opt: Add compile until borrowcheck. * rust-session-manager.cc (Session::enable_dump): Add BIR. (Session::compile_crate): Handle new options. * rust-session-manager.h (struct CompileOptions): Add BIR. 2024-01-16 Jakub Dupak * Make-lang.in: Build borrowck. * checks/errors/borrowck/rust-borrow-checker.cc: New file. * checks/errors/borrowck/rust-borrow-checker.h: New file. * checks/errors/borrowck/rust-function-collector.h: New file. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-pattern.h: Add override modifier to overriding methods. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-item.h: Add a new constructor for const with no value expression. * parse/rust-parse-impl.h (Parser::parse_const_item): Allow const with no expression value. 2024-01-16 Jakub Dupak * hir/tree/rust-hir-path.h: Avoid copy in getter. 2024-01-16 Jakub Dupak * backend/rust-compile-expr.cc (CompileExpr::visit): Rename method. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Rename method. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Rename method. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Rename method. * hir/rust-hir-dump.cc (Dump::visit): Rename method. * hir/tree/rust-hir-expr.h: Rename method. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Rename method. * typecheck/rust-tyty.h: Rename method. 2024-01-16 Jakub Dupak * backend/rust-compile-base.cc: Rename method. * backend/rust-compile-expr.cc (sort_tuple_patterns): Rename method. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Rename method. (CompilePatternBindings::visit): Rename method. (CompilePatternLet::visit): Rename method. * backend/rust-compile-stmt.cc (CompileStmt::visit): Rename method. * backend/rust-compile-var-decl.h: Rename method. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate): Rename method. * hir/rust-hir-dump.cc (Dump::visit): Rename method. * hir/tree/rust-hir-path.h: Rename method. * hir/tree/rust-hir-pattern.h: Rename method. * hir/tree/rust-hir.h: Rename method. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::Resolve): Rename method. (TypeCheckPattern::visit): Rename method. (ClosureParamInfer::visit): Rename method. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Rename method. * util/rust-hir-map.cc (Mappings::insert_hir_pattern): Rename method. 2024-01-16 Jakub Dupak * hir/tree/rust-hir-expr.h: Add getter for name. 2024-01-16 Jakub Dupak * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Implement for tuple pat. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Implement for tupple pat. 2024-01-16 Jakub Dupak * hir/tree/rust-hir-path.h: Avoid copy in getter. * hir/tree/rust-hir-pattern.h: Avoid copy in getter. * hir/tree/rust-hir.h: Avoid copy in getter. 2024-01-16 Owen Avery * resolve/rust-ast-resolve-implitem.h (ResolveToplevelImplItem::go): Take AssociatedItem as parameter. (ResolveTopLevelTraitItems::go): Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::go): Likewise. (ResolveItem::resolve_impl_item): Likewise. (ResolveImplItems::go): Likewise. * resolve/rust-ast-resolve-item.h (ResolveTraitItems::go): Likewise. (ResolveItem::resolve_impl_item): Likewise. (ResolveImplItems::go): Likewise. 2024-01-16 Owen Avery * hir/rust-ast-lower-implitem.h (ASTLoweringImplItem::translate): Take AssociatedItem as parameter. (ASTLoweringTraitItem::translate): Likewise. 2024-01-16 Jakub Dupak * backend/rust-compile-expr.cc (CompileExpr::visit): Bail on labelled block. 2024-01-16 Jakub Dupak * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add loop ctx. 2024-01-16 Jakub Dupak * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Resolve using loop logic. 2024-01-16 Jakub Dupak * hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Call loop lowering and add it to constr. * hir/tree/rust-hir-expr.h (class LoopLabel): Move before BlockExpr and add to BlockExpr. 2024-01-16 Jakub Dupak * ast/rust-ast-builder.cc (AstBuilder::block): Add label arg to constructor call. * ast/rust-expr.h (class LoopLabel): Move before BlockExpr. (class BlockExpr): Add LoopLabel member. * expand/rust-derive-clone.cc (DeriveClone::clone_fn): Add label arg to constructor call. * parse/rust-parse-impl.h (Parser::parse_block_expr): Add label parameter. (Parser::parse_labelled_loop_expr): Add label arg to constructor call. * parse/rust-parse.h: Add label arg to constructor call. 2024-01-16 Owen Avery * ast/rust-ast.h (class AssociatedItem): New, based on TraitItem, InherentImplItem, and TraitImplItem classes. (class TraitItem): Inherit from AssociatedItem. (class InherentImplItem): Likewise. (class TraitImplItem): Likewise. * ast/rust-item.h (class Method): Update cloning functions. (class Function): Likewise. (class TypeAlias): Likewise. (class ConstantItem): Likewise. (class TraitItemFunc): Likewise. (class TraitItemMethod): Likewise. (class TraitItemConst): Likewise. (class TraitItemType): Likewise. * ast/rust-macro.h (class MacroInvocation): Likewise. 2024-01-16 Raiki Tamura * backend/rust-mangle.cc (v0_identifier): Fix broken encoding. (v0_scope_path): Modify paramter. (v0_path): Fix namespace for modules. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_closure_expr_pratt): Fix closure parsing function to handle consecutive parameter lists. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-macro.h: Add PATH fragment to follow set restrictions. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::is_macro_rules_def): Add a function that checks tokens given by the lexer represents an accurate macro definition. This will reduce code duplication. (Parser::parse_item): Replace condition with call to new checking function. (Parser::parse_stmt): Likewise. * parse/rust-parse.h: Add function prototype for is_macro_rules_def. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_expr): Fix range from expr. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_item): Relax constraints around default identifier at item scope to accept "default" macros. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_path_expr_segment): Accept left shift tokens in order to let generic parsing function split the token. 2024-01-16 Owen Avery * ast/rust-ast.h (Pattern::get_pattern_node_id): Rename to... (Pattern::get_node_id): ...here. * ast/rust-macro.h (MacroInvocation::get_pattern_node_id): Rename to... (MacroInvocation::get_node_id): ...here. * ast/rust-path.h (PathInExpression::get_pattern_node_id): Remove. (QualifiedPathInExpression::get_pattern_node_id): Remove. * ast/rust-pattern.h (LiteralPattern::get_pattern_node_id): Remove. (IdentifierPattern::get_pattern_node_id): Remove. (WildcardPattern::get_pattern_node_id): Remove. (RestPattern::get_pattern_node_id): Rename to... (RestPattern::get_node_id): ...here. (RangePattern::get_pattern_node_id): Remove. (ReferencePattern::get_pattern_node_id): Remove. (StructPattern::get_pattern_node_id): Remove. (TupleStructPattern::get_pattern_node_id): Remove. (TuplePattern::get_pattern_node_id): Remove. (GroupedPattern::get_pattern_node_id): Remove. (SlicePattern::get_pattern_node_id): Remove. (AltPattern::get_pattern_node_id): Remove. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Use get_node_id instead of get_pattern_node_id. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_expr): Add comma delimiter. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_visibility): Relax constraints over public visibility return condition in order to accept pub unit types. 2024-01-16 Jakub Dupak * typecheck/rust-tyty.cc (BaseType::is_unit): Refactor. (BaseType::satisfies_bound): Refactor. (BaseType::get_root): Refactor. (BaseType::destructure): Refactor. (BaseType::monomorphized_clone): Refactor. (BaseType::is_concrete): Refactor. (InferType::InferType): Refactor. (InferType::clone): Refactor. (InferType::apply_primitive_type_hint): Refactor. (StructFieldType::is_equal): Refactor. (ADTType::is_equal): Refactor. (handle_substitions): Refactor. (ADTType::handle_substitions): Refactor. (TupleType::TupleType): Refactor. (TupleType::is_equal): Refactor. (TupleType::handle_substitions): Refactor. 2024-01-16 Jakub Dupak * typecheck/rust-tyty.cc (InferType::InferType): Use static constant for kind information. (ErrorType::ErrorType): Use static constant for kind information. (TupleType::TupleType): Use static constant for kind information. (BoolType::BoolType): Use static constant for kind information. (IntType::IntType): Use static constant for kind information. (UintType::UintType): Use static constant for kind information. (FloatType::FloatType): Use static constant for kind information. (USizeType::USizeType): Use static constant for kind information. (ISizeType::ISizeType): Use static constant for kind information. (CharType::CharType): Use static constant for kind information. (ReferenceType::ReferenceType): Use static constant for kind information. (PointerType::PointerType): Use static constant for kind information. (ParamType::ParamType): Use static constant for kind information. (StrType::StrType): Use static constant for kind information. (NeverType::NeverType): Use static constant for kind information. (PlaceholderType::PlaceholderType): Use static constant for kind information. * typecheck/rust-tyty.h: Add static kind information to all TyTy classes. Create safe cast and check methods. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_type_param_bound): Add missing case for lifetime switch. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-token.cc (Token::as_string): Update function to output scope resolution tokens correctly. * parse/rust-parse-impl.h (Parser::parse_generic_param): Change call to as_string. 2024-01-16 Raiki Tamura * backend/rust-compile-context.h: Modify declaration. * backend/rust-mangle.cc (struct V0Path): New struct. (v0_path): New function. (legacy_mangle_name): Take Context as argument. (v0_numeric_prefix): Fix type strings. (v0_complex_type_prefix): New function. (v0_add_integer_62): Deleted (v0_integer_62): New function. (v0_add_opt_integer_62): Deleted. (v0_opt_integer_62): New function. (v0_add_disambiguator): Deleted. (v0_disambiguator): New function. (v0_type_prefix): Support more types. (v0_generic_args): New function. (v0_add_identifier): Deleted. (v0_identifier): New function. (v0_type_path): New function. (v0_function_path): New function. (v0_scope_path): New function. (v0_crate_path): New function. (v0_inherent_or_trait_impl_path): New function. (v0_mangle_item): Use v0_path. (Mangler::mangle_item): Take Context as argument. * backend/rust-mangle.h (class Context): Add forward declaration. * hir/tree/rust-hir-item.h: Fix include. 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (TupleStructItems::clone_tuple_struct_items_impl): Rename to... (TupleStructItems::clone_tuple_items_impl): ...here. (TupleStructItemsNoRange::clone_tuple_struct_items_impl): Rename to... (TupleStructItemsNoRange::clone_tuple_items_impl): ...here. (TupleStructItemsRange::clone_tuple_struct_items_impl): Rename to... (TupleStructItemsRange::clone_tuple_items_impl): ...here. (TuplePatternItems::clone_tuple_pattern_items_impl): Rename to... (TuplePatternItems::clone_tuple_items_impl): ...here. (TuplePatternItemsMultiple::clone_tuple_pattern_items_impl): Rename to... (TuplePatternItemsMultiple::clone_tuple_items_impl): ...here. (TuplePatternItemsRanged::clone_tuple_pattern_items_impl): Rename to... (TuplePatternItemsRanged::clone_tuple_items_impl): ...here. 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (TuplePatternItems::get_pattern_type): Rename to... (TuplePatternItems::get_item_type): ...here. (TuplePatternItemsMultiple::get_pattern_type): Rename to... (TuplePatternItemsMultiple::get_item_type): ...here. (TuplePatternItemsRanged::get_pattern_type): Rename to... (TuplePatternItemsRanged::get_item_type): ...here. * backend/rust-compile-expr.cc: Adjust calls to renamed methods. * backend/rust-compile-pattern.cc: Likewise. * typecheck/rust-hir-type-check-pattern.cc: Likewise. 2024-01-16 Marc Poulhiès * backend/rust-compile-expr.cc (CompileExpr::visit): Merge 2 if clauses. * backend/rust-compile-extern.h: Fix typo in comment. 2024-01-16 Jakub Dupak * parse/rust-parse-impl.h: Add missing token consumption 2024-01-16 Mohammed Rizan Farooqui * expand/rust-macro-builtins.cc (MacroBuiltin::include_str_handler): Comment removed (MacroBuiltin::env_handler): Comment removed (MacroBuiltin::cfg_handler): Comment removed (MacroBuiltin::line_handler): Comment removed 2024-01-16 Jakub Dupak * backend/rust-compile.cc (HIRCompileBase::coercion_site1): Fix wrong cast 2024-01-16 Pierre-Emmanuel Patry * rust-session-manager.cc (Session::expansion): Add early break on error. 2024-01-16 Raiki Tamura * util/rust-canonical-path.h: Add new segment kind for inherent impl. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Use it. * resolve/rust-ast-resolve-toplevel.h: Use it. 2024-01-16 Owen Avery * ast/rust-expr.h: Fix spelling of "doesn't". * backend/rust-compile-expr.cc: Fix spelling of "accessors". * backend/rust-compile-implitem.h: Fix spelling of "normal". * backend/rust-constexpr.cc: Fix spelling of "actual". 2024-01-16 Marc Poulhiès * hir/rust-hir-dump.cc (Dump::debug): New. (debug): New. * hir/rust-hir-dump.h (debug): New. 2024-01-16 Philip Herron * Make-lang.in: fixup formatting * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check * rust-session-manager.cc (Session::compile_crate): call new lint * resolve/rust-ast-verify-assignee.h: Removed. * checks/errors/rust-readonly-check.cc: New file. * checks/errors/rust-readonly-check.h: New file. 2024-01-16 Muhammad Mahad * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Added ErrorCode & more fixit hints. 2024-01-16 Philip Herron * backend/rust-compile-block.h: remove HIR::ForLoopExpr * backend/rust-compile-expr.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 * checks/lints/rust-lint-marklive.h: likewise * hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): likewise * hir/rust-hir-dump.cc (Dump::visit): likewise * hir/rust-hir-dump.h: likewise * hir/tree/rust-hir-expr.h (class ForLoopExpr): likewise * hir/tree/rust-hir-full-decls.h (class ForLoopExpr): likewise * hir/tree/rust-hir-visitor.h: likewise * hir/tree/rust-hir.cc (ForLoopExpr::as_string): likewise (ForLoopExpr::accept_vis): likewise * typecheck/rust-hir-type-check-expr.h: likewise 2024-01-16 Marc Poulhiès * backend/rust-compile-expr.cc (CompileExpr::visit): Fix typo in varIadic. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise. * rust-backend.h (function_type_varadic): Rename into ... (function_type_variadic): ... this. * rust-gcc.cc (function_type_varadic): Rename into ... (function_type_variadic): ... this. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. * typecheck/rust-tyty.h (is_varadic): Renamed into ... (is_variadic): ... this. 2024-01-16 Marc Poulhiès * backend/rust-compile-base.cc (HIRCompileBase::compile_function): Fix typo in substitutions. (HIRCompileBase::resolve_method_address): Likewise. * backend/rust-compile-extern.h (CompileExternItem::visit): Likewise. * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise. * backend/rust-compile-intrinsic.cc (maybe_override_ctx): Likewise. * backend/rust-compile-item.cc (CompileItem::visit): Likewise. * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Likewise. * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelfWithInference): Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise. * typecheck/rust-tyty.cc (BaseType::has_subsititions_defined): Renamed into ... (BaseType::has_substitutions_defined): ... this. (ADTType::is_equal): Fix typo in substitutions. (handle_substitions): Likewise. (FnType::is_equal): Likewise. (FnType::handle_substitions): Likewise. * typecheck/rust-tyty.h (has_subsititions_defined): Renamed into ... (has_substitutions_defined): ... this. 2024-01-16 Owen Avery * backend/rust-compile-intrinsic.cc (get_identifier): Add declaration. (assume_handler): New. (generic_intrinsics): Add assume_handler entry. 2024-01-16 Owen Avery * rust-gcc.cc (Backend::wchar_type): Store static wchar tree. 2024-01-16 Owen Avery * rust-backend.h (complex_type): Remove. (complex_constant_expression): Remove. (real_part_expression): Remove. (imag_part_expression): Remove. (complex_expression): Remove. * rust-gcc.cc (complex_type): Remove. (complex_constant_expression): Remove. (real_part_expression): Remove. (imag_part_expression): Remove. (complex_expression): Remove. 2024-01-16 Owen Avery * rust-gcc.cc (namespace Backend): Use namespace definition instead of qualified names. 2024-01-16 liushuyu * backend/rust-compile-intrinsic.cc: add `copy` intrinsics and make `copy_nonoverlapping` handler more generic 2024-01-16 liushuyu * backend/rust-builtins.cc: add `expect` builtin definition. * backend/rust-compile-intrinsic.cc: add `likely` and `unlikely` intrinsics handler. 2024-01-16 Owen Avery * rust_error_codes.def: Moved to... * rust-error-codes.def: ...here... * rust-diagnostics.h: ...and update references. 2024-01-16 Guillaume Gomez * backend/rust-compile-intrinsic.cc: Simplify `make_unsigned_long_tree` * rust-backend.h: Remove `integer_constant_expression` * rust-gcc.cc: Remove `integer_constant_expression` 2024-01-16 Dave Evans * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add AltPattern visitor function * backend/rust-compile-pattern.h: Update CompilePatternCaseLabelExpr::visit(AltPattern&). * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Update AltPattern visitor 2024-01-16 Guillaume Gomez * backend/rust-compile-intrinsic.cc: Remove unused argument 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Added new error message, rich location and error code. 2024-01-16 Owen Avery * rust-backend.h (class Backend): Convert to ... (namespace Backend): ... namespace. * rust-gcc.cc (Backend::Backend): Rename to ... (Backend::init): ... here. (rust_get_backend): Remove. * rust-session-manager.cc (rust_get_backend): Remove. (Session::init): Use Backend::init instead of rust_get_backend. (Session::compile_crate): Initialize Context without pointer to Backend. * rust-session-manager.h (Session::backend): Remove. * backend/rust-compile-context.cc (Context::Context): Remove pointer to Backend. * backend/rust-compile-context.h (class Context): Remove pointer to Backend, update function calls. * backend/rust-compile-base.cc: Update function calls. * backend/rust-compile-block.cc: Likewise. * backend/rust-compile-expr.cc: Likewise. * backend/rust-compile-extern.h: Likewise. * backend/rust-compile-fnparam.cc: Likewise. * backend/rust-compile-intrinsic.cc: Likewise. * backend/rust-compile-item.cc: Likewise. * backend/rust-compile-pattern.cc: Likewise. * backend/rust-compile-resolve-path.cc: Likewise. * backend/rust-compile-type.cc: Likewise. * backend/rust-compile-var-decl.h: Likewise. * backend/rust-compile.cc: Likewise. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (Attribute::check_cfg_predicate): Change raw string to constexpr call. (Attribute::separate_cfg_attrs): Likewise. * backend/rust-compile-base.cc (should_mangle_item): Likewise. (HIRCompileBase::setup_fndecl): Likewise. (HIRCompileBase::handle_cold_attribute_on_fndecl): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute): Likewise. * checks/errors/rust-unsafe-checker.cc (check_target_attr): Likewise. * expand/rust-cfg-strip.cc (fails_cfg): Likewise. (fails_cfg_with_expand): Likewise. (expand_cfg_attrs): Likewise. * expand/rust-macro-builtins.cc: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise. (ASTLoweringBase::lower_macro_definition): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_doc_comment): Likewise. * parse/rust-parse.cc (extract_module_path): Likewise. * resolve/rust-early-name-resolver.cc (is_macro_use_module): Likewise. (EarlyNameResolver::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (is_macro_export): Likwise. * rust-session-manager.cc (Session::injection): Likewise. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): Likewise. * util/rust-attributes.cc (is_proc_macro_type): Likewise. (AttributeChecker::check_attribute): Likewise. (AttributeChecker::visit): Likewise. * util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise. * util/rust-attribute-values.h: New file. 2024-01-16 Owen Avery * rust-backend.h (Backend::Backend): New. (Backend::~Backend): Remove. (class Gcc_backend): Remove. * rust-gcc.cc (Gcc_backend::Gcc_backend): Rename to ... (Backend::Backend): ... here. (rust_get_backend): Construct Backend instead of Gcc_backend. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (tokenstream_from_string): Change linemap null pointer to the current linemap. 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add proc macro definition insertion. 2024-01-16 Pierre-Emmanuel Patry * util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_def): Change the function body to fetch the node id from the macro parameter. (Mappings::insert_bang_proc_macro_def): Likewise. (Mappings::insert_attribute_proc_macro_def): Likewise. * util/rust-hir-map.h: Update the function's prototype by removing the node id from the list of arguments. 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Add proc macro handle retrieval for attribute and derive proc macros. 2024-01-16 Pierre-Emmanuel Patry * util/rust-hir-map.cc (Mappings::lookup_derive_proc_macro_def): Update function to accomodate new signature. (Mappings::lookup_bang_proc_macro_def): Likewise. (Mappings::lookup_attribute_proc_macro_def): Likewise. * util/rust-hir-map.h: Update function signatures. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-macro-expand.h (struct MacroExpander): Update lookup function prototypes. * util/rust-hir-map.cc (Mappings::lookup_derive_proc_macro_invocation): Update lookup function according to new signature. (Mappings::lookup_bang_proc_macro_invocation): Likewise. (Mappings::lookup_attribute_proc_macro_invocation): Likewise. * util/rust-hir-map.h: Update function prototypes. 2024-01-16 Owen Avery * rust-backend.h (Backend::write_export_data): Remove. * rust-gcc.cc (Backend::write_export_data): Remove. 2024-01-16 Owen Avery * rust-backend.h (Backend::real_part_expression): Make non-virtual. (Backend::imag_part_expression): Likewise. (Backend::complex_expression): Likewise. (Backend::convert_expression): Likewise. (Backend::struct_field_expression): Likewise. (Backend::compound_expression): Likewise. (Backend::conditional_expression): Likewise. (Backend::negation_expression): Likewise. (Backend::arithmetic_or_logical_expression): Likewise. (Backend::arithmetic_or_logical_expression_checked): Likewise. (Backend::comparison_expression): Likewise. (Backend::lazy_boolean_expression): Likewise. (Backend::constructor_expression): Likewise. (Backend::array_constructor_expression): Likewise. (Backend::array_initializer): Likewise. (Backend::array_index_expression): Likewise. (Backend::call_expression): Likewise. (Gcc_backend::real_part_expression): Remove. (Gcc_backend::imag_part_expression): Remove. (Gcc_backend::complex_expression): Remove. (Gcc_backend::convert_expression): Remove. (Gcc_backend::struct_field_expression): Remove. (Gcc_backend::compound_expression): Remove. (Gcc_backend::conditional_expression): Remove. (Gcc_backend::negation_expression): Remove. (Gcc_backend::arithmetic_or_logical_expression): Remove. (Gcc_backend::arithmetic_or_logical_expression_checked): Remove. (Gcc_backend::comparison_expression): Remove. (Gcc_backend::lazy_boolean_expression): Remove. (Gcc_backend::constructor_expression): Remove. (Gcc_backend::array_constructor_expression): Remove. (Gcc_backend::array_initializer): Remove. (Gcc_backend::array_index_expression): Remove. (Gcc_backend::call_expression): Remove. * rust-gcc.cc (Gcc_backend::real_part_expression): Rename to ... (Backend::real_part_expression): ... here. (Gcc_backend::imag_part_expression): Rename to ... (Backend::imag_part_expression): ... here. (Gcc_backend::complex_expression): Rename to ... (Backend::complex_expression): ... here. (Gcc_backend::convert_expression): Rename to ... (Backend::convert_expression): ... here. (Gcc_backend::struct_field_expression): Rename to ... (Backend::struct_field_expression): ... here. (Gcc_backend::compound_expression): Rename to ... (Backend::compound_expression): ... here. (Gcc_backend::conditional_expression): Rename to ... (Backend::conditional_expression): ... here. (Gcc_backend::negation_expression): Rename to ... (Backend::negation_expression): ... here. (Gcc_backend::arithmetic_or_logical_expression): Rename to ... (Backend::arithmetic_or_logical_expression): ... here. (Gcc_backend::arithmetic_or_logical_expression_checked): Rename to ... (Backend::arithmetic_or_logical_expression_checked): ... here. (Gcc_backend::comparison_expression): Rename to ... (Backend::comparison_expression): ... here. (Gcc_backend::lazy_boolean_expression): Rename to ... (Backend::lazy_boolean_expression): ... here. (Gcc_backend::constructor_expression): Rename to ... (Backend::constructor_expression): ... here. (Gcc_backend::array_constructor_expression): Rename to ... (Backend::array_constructor_expression): ... here. (Gcc_backend::array_initializer): Rename to ... (Backend::array_initializer): ... here. (Gcc_backend::array_index_expression): Rename to ... (Backend::array_index_expression): ... here. (Gcc_backend::call_expression): Rename to ... (Backend::call_expression): ... here. 2024-01-16 Pierre-Emmanuel Patry * rust-session-manager.cc (Session::load_extern_crate): Change variable name, add temporaries and comments. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.h: Change get_trait_name to get_name in order to be coherent with the others proc macro type name convention. * resolve/rust-toplevel-name-resolver-2.0.cc (insert_macros): Add a templated funtion that inserts a proc macro into the context and emit an error on failure. (TopLevel::visit): Change from manual insertion to a function call. 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Change to assertion. * util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros): Add empty line. (Mappings::lookup_bang_proc_macros): Likewise. (Mappings::lookup_attribute_proc_macros): Likewise. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-extern-crate.cc (ExternCrate::ExternCrate): Update definition to allow Extern crate with no content (pure proc macros). (ExternCrate::ok): Panic on no content. (ExternCrate::load): Likewise. * metadata/rust-extern-crate.h: Update prototypes. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go): Remove macro resolution. (TopLevel::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.h: Add visit prototype for extern crate. * rust-session-manager.cc (Session::load_extern_crate): Adapt content depending on the loaded crate's content. * util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros): Change return type to optional because it is way more convenient. (Mappings::lookup_bang_proc_macros): Likewise. (Mappings::lookup_attribute_proc_macros): Likewise. * util/rust-hir-map.h: Update function prototypes. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-imports.cc (Import::try_package_in_directory): Remove error when some macro are found even if no import data is available. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h (class BangProcMacro): Move class from here to rust-proc-macro.h. Also remove related functions. (class AttributeProcMacro): Likewise. (class CustomDeriveProcMacro): Likewise. (struct Crate): Remove proc macro vector members. * expand/rust-macro-expand.h (struct MacroExpander): Change the type to the newly created classes. * expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Add constructor implementation. (AttributeProcMacro::AttributeProcMacro): Likewise. (CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise. * expand/rust-proc-macro.h (class BangProcMacro): Move class to here. (class AttributeProcMacro): Likewise. (class CustomDeriveProcMacro): Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go): Change top level visitor to check mappings instead * rust-session-manager.cc (Session::load_extern_crate): Add back macro collection to mappings. * util/rust-hir-map.cc (Mappings::insert_derive_proc_macros): Update getter signature with new types. (Mappings::insert_bang_proc_macros): Likewise. (Mappings::insert_attribute_proc_macros): Likewise. (Mappings::lookup_derive_proc_macros): Likewise. (Mappings::lookup_bang_proc_macros): Likewise. (Mappings::lookup_attribute_proc_macros): Likewise. (Mappings::insert_derive_proc_macro_def): Likewise. (Mappings::insert_bang_proc_macro_def): Likewise. (Mappings::insert_attribute_proc_macro_def): Likewise. (Mappings::lookup_derive_proc_macro_def): Likewise. (Mappings::lookup_bang_proc_macro_def): Likewise. (Mappings::lookup_attribute_proc_macro_def): Likewise. (Mappings::insert_derive_proc_macro_invocation): Likewise. (Mappings::lookup_derive_proc_macro_invocation): Likewise. (Mappings::insert_bang_proc_macro_invocation): Likewise. (Mappings::lookup_bang_proc_macro_invocation): Likewise. (Mappings::insert_attribute_proc_macro_invocation): Likewise. (Mappings::lookup_attribute_proc_macro_invocation): Likewise. * util/rust-hir-map.h: Update function prototypes as well as map types. 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go): Visit crate's newly stored proc macros. * rust-session-manager.cc (Session::load_extern_crate): Store proc macros in the parsed crate instead of a local variable to achieve mappings. 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Change argument to reference. * resolve/rust-early-name-resolver-2.0.h: Update function prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add getters. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h (struct Crate): Add proc macro members. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h (class BangProcMacro): Add new proc macro abstraction. (class AttributeProcMacro): Likewise. (class CustomDeriveProcMacro): Likewise. 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Add function to handle attributes. (Early::visit): Override visitor functions. * resolve/rust-early-name-resolver-2.0.h: Add prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (Attribute::get_traits_to_derive): Convert tokenstream to path list. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (Attribute::is_derive): Remove tokenstream condition. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (Attribute::get_traits_to_derive): Change return type to a vector of references. * ast/rust-ast.h: Update constructor. * expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_stmts): Update function call. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (Attribute::get_traits_to_derive): Add function as member function. * ast/rust-ast.h: Add prototype. * expand/rust-expand-visitor.cc (get_traits_to_derive): Remove function. (ExpandVisitor::expand_inner_stmts): Update function call. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (Attribute::is_derive): Add member function. * ast/rust-ast.h: Likewise. * expand/rust-expand-visitor.cc (is_derive): Remove old function. (ExpandVisitor::expand_inner_stmts): Update function call. (ExpandVisitor::visit_inner_using_attrs): Likewise. 2024-01-16 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::visit): use a temp for the value 2024-01-16 Owen Avery * rust-backend.h (Backend::block): Make non-virtual. (Backend::block_add_statements): Likewise. (Gcc_backend::block): Remove. (Gcc_backend::block_add_statements): Remove. * rust-gcc.cc (Gcc_backend::block): Rename to ... (Backend::block): ... here. (Gcc_backend::block_add_statements): Rename to ... (Backend::block_add_statements): ... here. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-macro-expand.h: Change include directive with the new name. * expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Likewise. * util/rust-hir-map.h: Likewise. * util/rust-token-converter.h: Likewise. * util/rust-token-converter.cc: Remove useless include directive. * Make-lang.in: Rename library. 2024-01-16 Owen Avery * rust-backend.h (Backend::init_statement): Make non-virtual. (Backend::assignment_statement): Likewise. (Backend::return_statement): Likewise. (Backend::if_statement): Likewise. (Backend::loop_expression): Likewise. (Backend::exit_expression): Likewise. (Backend::compound_statement): Likewise. (Backend::statement_list): Likewise. (Backend::exception_handler_statement): Likewise. (Gcc_backend::init_statement): Remove. (Gcc_backend::assignment_statement): Remove. (Gcc_backend::return_statement): Remove. (Gcc_backend::if_statement): Remove. (Gcc_backend::compound_statement): Remove. (Gcc_backend::statement_list): Remove. (Gcc_backend::exception_handler_statement): Remove. (Gcc_backend::loop_expression): Remove. (Gcc_backend::exit_expression): Remove. * rust-gcc.cc (Gcc_backend::init_statement): Rename to ... (Backend::init_statement): ... here. (Gcc_backend::assignment_statement): Rename to ... (Backend::assignment_statement): ... here. (Gcc_backend::return_statement): Rename to ... (Backend::return_statement): ... here. (Gcc_backend::exception_handler_statement): Rename to ... (Backend::exception_handler_statement): ... here. (Gcc_backend::if_statement): Rename to ... (Backend::if_statement): ... here. (Gcc_backend::loop_expression): Rename to ... (Backend::loop_expression): ... here. (Gcc_backend::exit_expression): Rename to ... (Backend::exit_expression): ... here. (Gcc_backend::compound_statement): Rename to ... (Backend::compound_statement): ... here. (Gcc_backend::statement_list): Rename to ... (Backend::statement_list): ... here. 2024-01-16 Owen Avery * rust-backend.h (Backend::function): Make non-virtual. (Backend::function_defer_statement): Likewise. (Backend::function_set_parameters): Likewise. (Backend::write_global_definitions): Likewise. (Backend::write_export_data): Likewise. (Gcc_backend::function): Remove. (Gcc_backend::function_defer_statement): Remove. (Gcc_backend::function_set_parameters): Remove. (Gcc_backend::write_global_definitions): Remove. (Gcc_backend::write_export_data): Remove. * rust-gcc.cc (Gcc_backend::function): Rename to ... (Backend::function): ... here. (Gcc_backend::function_defer_statement): Fix a qualified lookup of Backend::label and rename to ... (Backend::function_defer_statement): ... here. (Gcc_backend::function_set_parameters) Rename to ... (Backend::function_set_parameters): ... here. (Gcc_backend::write_global_definitions): Rename to ... (Backend::write_global_definitions): ... here. (Gcc_backend::write_export_data): Rename to ... (Backend::write_export_data): ... here. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-inherent-impl-overlap.h: Added rich location and errorcode. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Added error code. 2024-01-16 Owen Avery * rust-backend.h (Backend::zero_expression): Make non-virtual. (Backend::var_expression): Likewise. (Backend::integer_constant_expression): Likewise. (Backend::float_constant_expression): Likewise. (Backend::complex_constant_expression): Likewise. (Backend::string_constant_expression): Likewise. (Backend::char_constant_literal): Likewise. (Backend::wchar_constant_literal): Likewise. (Backend::boolean_constant_expression): Likewise. (Gcc_backend::zero_expression): Remove. (Gcc_backend::var_expression): Remove. (Gcc_backend::integer_constant_expression): Remove. (Gcc_backend::float_constant_expression): Remove. (Gcc_backend::complex_constant_expression): Remove. (Gcc_backend::string_constant_expression): Remove. (Gcc_backend::wchar_constant_expression): Remove. (Gcc_backend::char_constant_expression): Remove. (Gcc_backend::boolean_constant_expression): Remove. * rust-gcc.cc (Gcc_backend::zero_expression): Rename to ... (Backend::zero_expression): ... here. (Gcc_backend::var_expression): Rename to ... (Backend::var_expression): ... here. (Gcc_backend::integer_constant_expression): Rename to ... (Backend::integer_constant_expression): ... here. (Gcc_backend::float_constant_expression): Rename to ... (Backend::float_constant_expression): ... here. (Gcc_backend::complex_constant_expression): Rename to ... (Backend::complex_constant_expression): ... here. (Gcc_backend::string_constant_expression): Rename to ... (Backend::string_constant_expression): ... here. (Gcc_backend::wchar_constant_expression): Rename to ... (Backend::wchar_constant_expression): ... here. (Gcc_backend::char_constant_expression): Rename to ... (Backend::char_constant_expression): ... here. (Gcc_backend::boolean_constant_expression): Rename to ... (Backend::boolean_constant_expression): ... here. 2024-01-16 Owen Avery * rust-backend.h (Backend::global_variable): Make non-virtual. (Backend::global_variable_set_init): Likewise. (Backend::local_variable): Likewise. (Backend::parameter_variable): Likewise. (Backend::static_chain_variable): Likewise. (Backend::temporary_variable): Likewise. (Gcc_backend::global_variable): Remove. (Gcc_backend::global_variable_set_init): Remove. (Gcc_backend::local_variable): Remove. (Gcc_backend::parameter_variable): Remove. (Gcc_backend::static_chain_variable): Remove. (Gcc_backend::temporary_variable): Remove. (Gcc_backend::non_zero_size_type): Move to ... (Backend::non_zero_size_type): ... here. (Gcc_backend::convert_tree): Move to ... (Backend::convert_tree): ... here. * rust-gcc.cc (Gcc_backend::non_zero_size_type): Rename to ... (Backend::non_zero_size_type): ... here. (Gcc_backend::convert_tree): Rename to ... (Backend::convert_tree): ... here. (Gcc_backend::global_variable): Rename to ... (Backend::global_variable): ... here. (Gcc_backend::global_variable_set_init): Rename to ... (Backend::global_variable_set_init): ... here. (Gcc_backend::local_variable): Rename to ... (Backend::local_variable): ... here. (Gcc_backend::parameter_variable): Rename to ... (Backend::parameter_variable): ... here. (Gcc_backend::static_chain_variable): Rename to ... (Backend::static_chain_variable): ... here. (Gcc_backend::temporary_variable): Rename to ... (Backend::temporary_variable): ... here. 2024-01-16 Muhammad Mahad * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Added errorcode & richlocation. 2024-01-16 Owen Avery * rust-backend.h (Backend::debug): Make non-virtual. (Backend::get_identifier_node): Likewise. (Gcc_backend::debug): Remove. (Gcc_backend::get_identifier_node): Remove. * rust-gcc.cc (Gcc_backend::debug): Rename to ... (Backend::debug): ... here. (Gcc_backend::get_identifier_node): Rename to ... (Backend::get_identifier_node): ... here. 2024-01-16 Owen Avery * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Expect if conditions to have type bool. 2024-01-16 Owen Avery * rust-backend.h (Backend::label): Make non-virtual. (Backend::label_definition_statement): Likewise. (Backend::goto_statement): Likewise. (Backend::label_address): Likewise. (Gcc_backend::label): Remove. (Gcc_backend::label_definition_statement): Remove. (Gcc_backend::goto_statement): Remove. (Gcc_backend::label_address): Remove. * rust-gcc.cc (Gcc_backend::label): Rename to ... (Backend::label): ... here. (Gcc_backend::label_definition_statement): Rename to ... (Backend::label_definition_statement): ... here. (Gcc_backend::goto_statement): Rename to ... (Backend::goto_statement): ... here. (Gcc_backend::label_address): Rename to ... (Backend::label_address): ... here. 2024-01-16 Owen Avery * backend/rust-constexpr.cc (struct constexpr_fundef): Rename to ... (struct rust_constexpr_fundef): ... here. (struct constexpr_call): Rename to ... (struct rust_constexpr_call): ... here. 2024-01-16 Raiki Tamura * lex/rust-input-source.h: Move constants from here... * util/rust-codepoint.h (struct Codepoint): ... to here * util/rust-attributes.cc (check_no_mangle_function): New function. (AttributeChecker::visit): Use it. * util/rust-unicode.cc (is_ascii_only): New function. * util/rust-unicode.h (is_ascii_only): Likewise. * backend/rust-mangle.cc (legacy_mangle_name): Use it. * util/rust-punycode.cc (extract_basic_string): Likewise. * lex/rust-lex.cc (Lexer::parse_byte_char): Likewise. 2024-01-16 Muhammad Mahad * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Added richlocation & error code. 2024-01-16 Owen Avery * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_fn_trait_call): Add TODO comment. * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): Add assertions, new error constructor. (TypeBoundPredicate::error): Use new error constructor. * typecheck/rust-tyty.h (struct TypeBoundPredicate::mark_is_error): New. (TypeBoundPredicate::TypeBoundPredicate): Add new error constructor. 2024-01-16 Owen Avery * rust-backend.h: (Backend::wchar_type): Make non-virtual. (Backend::get_pointer_size): Likewise. (Backend::raw_str_type): Likewise. (Backend::integer_type): Likewise. (Backend::float_type): Likewise. (Backend::complex_type): Likewise. (Backend::pointer_type): Likewise. (Backend::reference_type): Likewise. (Backend::immutable_type): Likewise. (Backend::function_type): Likewise. (Backend::function_type_varadic): Likewise. (Backend::function_ptr_type): Likewise. (Backend::struct_type): Likewise. (Backend::union_type): Likewise. (Backend::array_type): Likewise. (Backend::named_type): Likewise. (Backend::type_size): Likewise. (Backend::type_alignment): Likewise. (Backend::type_field_alignment): Likewise. (Backend::type_field_offset): Likewise. (Gcc_backend::wchar_type): Remove. (Gcc_backend::get_pointer_size): Remove. (Gcc_backend::raw_str_type): Remove. (Gcc_backend::integer_type): Remove. (Gcc_backend::float_type): Remove. (Gcc_backend::complex_type): Remove. (Gcc_backend::pointer_type): Remove. (Gcc_backend::reference_type): Remove. (Gcc_backend::immutable_type): Remove. (Gcc_backend::function_type): Remove. (Gcc_backend::function_type_varadic): Remove. (Gcc_backend::function_ptr_type): Remove. (Gcc_backend::struct_type): Remove. (Gcc_backend::union_type): Remove. (Gcc_backend::array_type): Remove. (Gcc_backend::named_type): Remove. (Gcc_backend::type_size): Remove. (Gcc_backend::type_alignment): Remove. (Gcc_backend::type_field_alignment): Remove. (Gcc_backend::type_field_offset): Remove. (Gcc_backend::fill_in_fields): Move to ... (Backend::fill_in_fields): ... here. (Gcc_backend::fill_in_array): Move to ... (Backend::fill_in_array): ... here. * rust-gcc.cc (Gcc_backend::wchar_type): Rename to ... (Backend::wchar_type): ... here. (Gcc_backend::get_pointer_size): Rename to ... (Backend::get_pointer_size): ... here. (Gcc_backend::raw_str_type): Rename to ... (Backend::raw_str_type): ... here. (Gcc_backend::integer_type): Rename to ... (Backend::integer_type): ... here. (Gcc_backend::float_type): Rename to ... (Backend::float_type): ... here. (Gcc_backend::complex_type): Rename to ... (Backend::complex_type): ... here. (Gcc_backend::pointer_type): Rename to ... (Backend::pointer_type): ... here. (Gcc_backend::reference_type): Rename to ... (Backend::reference_type): ... here. (Gcc_backend::immutable_type): Rename to ... (Backend::immutable_type): ... here. (Gcc_backend::function_type): Rename to ... (Backend::function_type): ... here. (Gcc_backend::function_type_varadic): Rename to ... (Backend::function_type_varadic): ... here. (Gcc_backend::function_ptr_type): Rename to ... (Backend::function_ptr_type): ... here. (Gcc_backend::struct_type): Rename to ... (Backend::struct_type): ... here. (Gcc_backend::union_type): Rename to ... (Backend::union_type): ... here. (Gcc_backend::fill_in_fields): Rename to ... (Backend::fill_in_fields): ... here. (Gcc_backend::array_type): Rename to ... (Backend::array_type): ... here. (Gcc_backend::fill_in_array): Rename to ... (Backend::fill_in_array): ... here. (Gcc_backend::named_type): Rename to ... (Backend::named_type): ... here. (Gcc_backend::type_size): Rename to ... (Backend::type_size): ... here. (Gcc_backend::type_alignment): Rename to ... (Backend::type_alignment): ... here. (Gcc_backend::type_field_alignment): Rename to ... (Backend::type_field_alignment): ... here. (Gcc_backend::type_field_offset): Rename to ... (Backend::type_field_offset): ... here. 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (move_val_init_handler): mark as side-effects 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (uninit_handler): Update fndecl attributes 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (op_with_overflow_inner): fix use before init 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (enter_intrinsic_block): take the locals vector (uninit_handler): make a temp variable and use the address of it 2024-01-16 Pierre-Emmanuel Patry * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Collect error instead of lambda. * resolve/rust-early-name-resolver-2.0.h (std::function * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Collect error instead of emitting it. Also add invocation registration. * resolve/rust-early-name-resolver-2.0.h (std::function * config-lang.in: Add "backend/rust-tree.h" and "backend/rust-tree.h" to gtfiles. * backend/rust-tree.cc: Include new header generated by gengtype. * backend/rust-tree.h (struct language_function): Add TODO. * rust-lang.cc: Include "rust-tree.h". (struct lang_type): Remove duplicate definition. (struct lang_decl): Likewise. (struct lang_identifier): Likewise. (struct language_function): Likewise. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Added error code and rich location. 2024-01-16 Owen Avery * backend/rust-tree.h (struct rust_cp_class_binding): Fork from gcc/cp/name_lookup.h. (struct rust_cp_binding_level): Likewise. (struct named_label_entry): Remove declaration... (struct rust_named_label_entry): ... and fork definition from gcc/cp/decl.cc. 2024-01-16 Muhammad Mahad * rust-diagnostics.cc (rust_be_error_at): Added overload function. (rust_error_at): non-const `rich_location *` function. * rust-diagnostics.h (rust_error_at): Implementation of overloaded function. (rust_be_error_at): likewise. * rust_error_codes.def: Added GNU license. 2024-01-16 Muhammad Mahad * typecheck/rust-tyty.cc (BaseType::satisfies_bound): Added errorcode and user-friendly error message. 2024-01-16 Owen Avery * backend/rust-tree.cc (resort_data): Fork from c++ frontend. (resort_member_name_cmp): Likewise. (resort_type_member_vec): Likewise. * backend/rust-tree.h (resort_type_member_vec): Likewise. 2024-01-16 Owen Avery * backend/rust-tree.cc (struct conv_type_hasher): Rename to ... (struct rust_conv_type_hasher): ... here. (struct cplus_array_hasher): Rename to ... (struct rust_cplus_array_hasher): ... here. (struct source_location_table_entry_hash): Rename to ... (struct rust_source_location_table_entry_hash): ... here. * backend/rust-tree.h (struct named_decl_hash): Rename to ... (struct rust_named_decl_hash): ... here. (struct cxx_saved_binding): Rename to ... (struct rust_cxx_saved_binding): ... here. (struct named_label_hash): Rename to ... (struct rust_named_label_hash): ... here. (struct tree_pair_s): Rename to ... (struct rust_tree_pair_s): ... here. (struct tree_pair_p): Rename to ... (struct rust_tree_pair_p): ... here. 2024-01-16 Owen Avery * backend/rust-tree.cc (Rust::gt_pch_nx): Move external function declaration ... (gt_pch_nx): ... out of Rust namespace. * backend/rust-tree.h (OVL_FIRST): Qualify function name. 2024-01-16 Philip Herron * backend/rust-compile-type.cc (TyTyResolveCompile::visit): do a final lookup 2024-01-16 Muhammad Mahad * parse/rust-parse-impl.h (Parser::parse_generic_params): Added more user friendly message. 2024-01-16 Owen Avery * expand/rust-macro-builtins.cc (MacroBuiltin::include_str_handler): Use vector::data. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-type.cc: Added last variant name, errorcode & rich location. for enum candidates. 2024-01-16 Owen Avery * backend/rust-tree.h (struct stmt_tree_s): Remove. (typedef stmt_tree): Remove. (c_language_function::x_stmt_tree): Remove. (saved_scope::x_stmt_tree): Remove. (lang_decl_fn::pending_inline_p): Remove. (lang_decl_fn::spare): Adjust size. (lang_decl_fn::pending_inline_info): Remove. 2024-01-16 Owen Avery * backend/rust-constexpr.cc: Include gt-rust-rust-constexpr.h. (struct constexpr_call_hasher): Rename to ... (struct rust_constexpr_call_hasher): ... here. (struct constexpr_fundef_hasher): Rename to ... (struct rust_constexpr_fundef_hasher): ... here. * config-lang.in: Add rust-constexpr.cc to gtfiles. 2024-01-16 Raiki Tamura * backend/rust-mangle.cc (v0_add_identifier): Added punycode encoding (v0_mangle_item): Likewise. * lex/rust-lex.cc (assert_source_content): Change type (test_buffer_input_source): Change type (test_file_input_source): Change type * resolve/rust-ast-resolve-toplevel.h: fix typo * rust-session-manager.cc (Session::load_extern_crate): fix typo * util/rust-canonical-path.h: fix typo * util/rust-hir-map.cc (NodeMapping::get_error): fix typo (Mappings::Mappings): fix typo * util/rust-mapping-common.h (UNKNOWN_CREATENUM): fix typo (UNKNOWN_CRATENUM): Change 0 to UINT32_MAX 2024-01-16 Muhammad Mahad * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Updated errorcode & more userfriendly message. 2024-01-16 Muhammad Mahad * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Added more helpful error message. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-path-probe.h: Fixes issue & added rich location message. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Added rich location and error code. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-lex.cc (Lexer::parse_decimal_int_or_float): Only accept digits after a dot instead of accepting any float member. 2024-01-16 Muhammad Mahad * ast/rust-pattern.h: No need of assertion, we are handling it. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Added check which emits error instead of using assertion. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Added rich location and error code. 2024-01-16 Muhammad Mahad * backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl): Added rich_location & error code. 2024-01-16 Muhammad Mahad * parse/rust-parse-impl.h (Parser::parse_trait): added errorcode & updated error message. 2024-01-16 Muhammad Mahad * parse/rust-parse-impl.h (Parser::parse_outer_attribute): Added errorcode & updated error function. 2024-01-16 Muhammad Mahad * rust-diagnostics.cc (va_constructor): Added constructor for all possible cases. (Error::Error): Updated error struct for all possible cases. * rust-diagnostics.h (struct Error): Updated error struct to support error code & rich location support. 2024-01-16 Muhammad Mahad * backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl): Added rich_location & error code. 2024-01-16 Arthur Cohen * rust-diagnostics.cc: Switch from new[] to xcalloc 2024-01-16 Raiki Tamura * util/make-rust-unicode.py: Add type annotation 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (check_for_cached_intrinsic): simplify this cached intrinsic check * backend/rust-mangle.cc (legacy_mangle_item): use new interface * typecheck/rust-tyty.h: new managle helper 2024-01-16 Philip Herron * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): use the single candidate 2024-01-16 Marc Poulhiès * hir/rust-hir-dump.cc (Dump::visit): Remove useless if/else already handled by visit_field. 2024-01-16 Owen Avery * util/rust-punycode.cc: Add CHECKING_P guard. 2024-01-16 Raiki Tamura * backend/rust-mangle.cc (legacy_mangle_name): Use Unicode escape 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): remove hack 2024-01-16 Owen Avery * expand/rust-proc-macro-invoc-lexer.cc (ProcMacroInvocLexer::skip_token): Remove. * expand/rust-proc-macro-invoc-lexer.h: Include "rust-macro-invoc-lexer.h". (class ProcMacroInvocLexer): Extend MacroInvocLexerBase. 2024-01-16 Raiki Tamura * lex/rust-codepoint.h: Moved to... * util/rust-codepoint.h: ...here. * lex/rust-input-source.h: Add missing license * util/rust-unicode.cc: Add missing license * util/rust-punycode.cc (extract_basic_string): Remove constant 2024-01-16 Arthur Cohen * expand/rust-macro-expand.h: Keep optional references for last_def and last_invoc. * expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Store optional references. * rust-session-manager.cc (Session::expansion): Use tl::optional's APIs for better checking. 2024-01-16 Marc Poulhiès * hir/rust-hir-dump.h (do_ifexpr): New. * hir/rust-hir-dump.cc (Dump::do_ifexpr): New. (Dump::visit): Use do_ifexpr and visit_field 2024-01-16 Muhammad Mahad * typecheck/rust-casts.cc (TypeCastRules::emit_cast_error): Refactored ErrorCodes & error messages. 2024-01-16 Muhammad Mahad * backend/rust-compile-base.cc: Added ErrorCode. 2024-01-16 Muhammad Mahad * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): called error function. (ASTLoweringBase::lower_extern_block): likewise. 2024-01-16 Owen Avery * ast/rust-ast-collector.cc: Adjust formatting. * checks/errors/rust-feature-gate.cc: Add trailing newline. * rust-diagnostics.h: Remove old comment. 2024-01-16 Owen Avery * rust-gcc.cc (Gcc_backend::struct_type): Remove references to "this". (Gcc_backend::union_type): Likewise. (Gcc_backend::array_type): Likewise. (Gcc_backend::wchar_constant_expression): Likewise. (Gcc_backend::convert_expression): Likewise. (Gcc_backend::constructor_expression): Likewise. (Gcc_backend::array_initializer): Likewise. (Gcc_backend::assignment_statement): Likewise. (Gcc_backend::global_variable): Likewise. (Gcc_backend::temporary_variable): Likewise. (Gcc_backend::function_defer_statement): Likewise. 2024-01-16 Raiki Tamura * Make-lang.in: Add rust-punycode.o. * rust-lang.cc (run_rust_tests): Add selftest. * util/rust-punycode.cc: New file. * util/rust-punycode.h: New file. 2024-01-16 Muhammad Mahad * backend/rust-compile.cc (HIRCompileBase::verify_array_capacities): Added ErrorCode. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): added errorcode. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * 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. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (assert_source_content): Fix namespace specifier (test_buffer_input_source): Likewise. (test_file_input_source): Likewise. * lex/rust-lex.h: Move InputSource ... * lex/rust-input-source.h: ... to here. (New file) * lex/rust-token.cc (nfc_normalize_token_string): New function * lex/rust-token.h (nfc_normalize_token_string): New function * rust-lang.cc (run_rust_tests): Modify order of selftests. * rust-session-manager.cc (validate_crate_name): Modify interface of Utf8String. * util/rust-unicode.cc (lookup_cc): Modify codepoint_t typedef. (lookup_recomp): Likewise. (recursive_decomp_cano): Likewise. (decomp_cano): Likewise. (sort_cano): Likewise. (compose_hangul): Likewise. (assert_normalize): Likewise. (Utf8String::nfc_normalize): New function. * util/rust-unicode.h: Modify interface of Utf8String. 2024-01-16 Muhammad Mahad * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Added ErrorCode. 2024-01-16 Pierre-Emmanuel Patry * util/rust-common.h (enum_to_str): Remove extra semicolon after the function. 2024-01-16 Muhammad Mahad * checks/errors/rust-const-checker.cc (ConstChecker::visit): Use of mutable reference in constant functions. * checks/errors/rust-feature-gate.cc (FeatureGate::gate): ErrorCode for intrinsics are subject to change. 2024-01-16 Muhammad Mahad * checks/errors/rust-const-checker.cc (ConstChecker::check_function_call): Added errorcode. 2024-01-16 Muhammad Mahad * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): Added errorcode. 2024-01-16 Arthur Cohen * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Declare macros in the current rib if they are macros 2.0. 2024-01-16 Arthur Cohen * ast/rust-macro.h: Add new method to `MacroRulesDefinition` to allow getting the `MacroKind` contained. 2024-01-16 Arthur Cohen * rust-session-manager.cc (Session::expansion): Use new `Early` name resolution 2.0 pass 2024-01-16 Arthur Cohen * Make-lang.in: Add new object file. * resolve/rust-early-name-resolver-2.0.cc: New file. * resolve/rust-early-name-resolver-2.0.h: New file. 2024-01-16 Arthur Cohen * resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit CallExpr and MethodCallExpr properly. * resolve/rust-default-resolver.h: Switch "node" to plural in documentation. 2024-01-16 Arthur Cohen * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out): Fix format string. (is_macro_export): New method. (TopLevel::visit): Handle macro definitions. 2024-01-16 Arthur Cohen * resolve/rust-name-resolution-context.cc (Resolver::insert): Do not call into `rust_unreachable` when resolving macros anymore. 2024-01-16 Arthur Cohen * resolve/rust-forever-stack.h (insert_at_root): New method. (resolve_path): New method. (reverse_iter): Iterate on `Node`s instead of `Rib`s * resolve/rust-forever-stack.hxx: Add path resolution. 2024-01-16 Arthur Cohen * resolve/rust-rib.h: Add shadowing parameter. Make kind field public. * resolve/rust-rib.cc (Rib::insert): Likewise. 2024-01-16 Muhammad Mahad * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): refactored message and called error function. 2024-01-16 Muhammad Mahad * checks/errors/rust-feature-gate.cc (FeatureGate::check): errorcode support for unknown feature. 2024-01-16 Muhammad Mahad * typecheck/rust-unify.cc (UnifyRules::emit_type_mismatch): refactored & called error function. 2024-01-16 Marc Poulhiès * expand/rust-macro-builtins.cc (load_file_bytes): Return a tl::optional. (MacroBuiltin::include_byte_handler): Adjust and check file was correctly opened. (MacroBuiltin::include_str_handler): Likewise. 2024-01-16 Arthur Cohen * resolve/rust-toplevel-name-resolver-2.0.h (class TopLevel): Inherit from DefaultResolver * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::TopLevel): Remove unecessary methods 2024-01-16 Arthur Cohen * Make-lang.in: Add new object file. * resolve/rust-default-resolver.cc: New file. * resolve/rust-default-resolver.h: New file. 2024-01-16 Raiki Tamura * util/rust-unicode.cc (decomp_cano): Decompose Hangul. (sort_cano): Fix bounds check. (recomp): use `compose_hangul`. (compose_hangul): Compose Hangul. (rust_utf8_normalize_test): Add tests. 2024-01-16 Arthur Cohen * resolve/rust-forever-stack.hxx: assert() -> rust_assert() 2024-01-16 Arthur Cohen * Make-lang.in: Add new object file. * resolve/rust-toplevel-name-resolver-2.0.cc: New file. * resolve/rust-toplevel-name-resolver-2.0.h: New file. 2024-01-16 Arthur Cohen * Make-lang.in: Add new object file. * resolve/rust-name-resolution-context.cc: New file. * resolve/rust-name-resolution-context.h: New file. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): called error function. 2024-01-16 Owen Avery * expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::skip_token): Remove. * expand/rust-macro-invoc-lexer.h (class MacroInvocLexer): Extend MacroInvocLexerBase. 2024-01-16 Marc Poulhiès * ast/rust-ast-fragment.cc (Fragment::create_empty): New. * ast/rust-ast-fragment.h (MacroTranscriberFunc): New. * ast/rust-macro.h (MacroRulesDefinition): Use MacroTranscriberFunc. * expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers): likewise. (MacroBuiltin::assert_handler): Return optional. (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::include_handler): Likewise. (MacroBuiltin::line_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. (MacroBuiltin::sorry): Likewise. * expand/rust-macro-builtins.h (builtin_transcribers): Use MacroTranscriberFunc. (assert_handler): Return optional. (file_handler): Likewise. (column_handler): Likewise. (include_bytes_handler): Likewise. (include_str_handler): Likewise. (compile_error_handler): Likewise. (concat_handler): Likewise. (env_handler): Likewise. (cfg_handler): Likewise. (include_handler): Likewise. (line_handler): Likewise. (stringify_handler): Likewise. (sorry): Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Adjust to transcribers returning optional. 2024-01-16 Philip Herron * typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): always resolve the type even when its an a mandatory trait item * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Add check for enum candidates otherwise you get undefined behaviour 2024-01-16 Raiki Tamura * lex/rust-codepoint.h: Add comment * lex/rust-lex.h: New method to get decoded characters * rust-session-manager.cc (validate_crate_name): Modify unicode check (rust_crate_name_validation_test): Add testcases * util/rust-unicode.h (RUST_UNICODE_H): New class Utf8String. (class Utf8String): New class. * util/rust-unicode.cc (binary_search_sorted_array): Add comment. (recursive_decomp_cano): Add comment. (recomp): Remove dead code. (dump_string): Removed. 2024-01-16 Owen Avery * util/rust-unicode.cc: Add CHECKING_P guard. 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): We need to check if a function context exists 2024-01-16 Philip Herron * expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor (tokenstream_from_string): likewise * lex/rust-lex.cc (Lexer::Lexer): likewise * lex/rust-lex.h: pass through Linemap * parse/rust-cfg-parser.cc (parse_cfg_option): likewise * rust-session-manager.cc (Session::load_extern_crate): likewise * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): dont apply Sized on self * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new * typecheck/rust-hir-type-check-base.h: add prototype * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized (TypeResolveGenericParam::visit): likewise * typecheck/rust-hir-type-check-type.h: update prototypes * typecheck/rust-typecheck-context.cc: remove bad assertions * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup (TypeCheckBase::get_predicate_from_bound): apply sized rules properly * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers (Mappings::get_lang_item): likewise * util/rust-hir-map.h: likewise * util/rust-token-converter.cc (from_ident): update lexer ctor (from_punct): likewise 2024-01-16 Philip Herron * typecheck/rust-hir-path-probe.cc: track regular polarity * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): likewise * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): likewise * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): likewise (TypeBoundPredicate::TypeBoundPredicate): update ctor (TypeBoundPredicate::operator=): update copy assignment ctor (TypeBoundPredicate::error): update error node * typecheck/rust-tyty.h: add polarity field to predicate 2024-01-16 Philip Herron * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): use new BoundPolarity enum * hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): likewise * hir/rust-hir-dump.cc (BoundPolarityString): new helper (Dump::visit): update hir dump * hir/tree/rust-hir-item.h (class ImplBlock): likewise * hir/tree/rust-hir-type.h (class TraitBound): likewise * hir/tree/rust-hir.cc (TraitBound::as_string): fix as string * util/rust-common.h (enum Polarity): add new anti bound (enum BoundPolarity): likewise * util/rust-hir-map.cc (Mappings::Mappings): update naming 2024-01-16 Owen Avery * rust-backend.h: Include "rust-gcc.h". (class Gcc_backend): Move to ... * rust-gcc.cc (class Gcc_backend): ... here. 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-item.cc: add is_error check 2024-01-16 Raiki Tamura * Make-lang.in: Add rust-unicode.o * rust-lang.cc (run_rust_tests): Add test. * rust-system.h: Include * util/make-rust-unicode.py: Generater of rust-unicode-data.h. * util/rust-unicode-data.h: Auto-generated file. * util/rust-unicode.cc: New file. * util/rust-unicode.h: New file. 2024-01-16 Arthur Cohen * rust-diagnostics.cc: Rework `make_description` and `make_url` functions. * rust-diagnostics.h: Specify ErrorCode's underlying type, remove error_codes_strings table. * rust_error_codes.def: New file. 2024-01-16 Owen Avery * rust-location.h (typedef Location): Remove. * expand/rust-proc-macro.cc (register_callback): Replace Location constructor with UNDEF_LOCATION. * ast/rust-ast-collector.h: Replace Location with location_t. * checks/errors/privacy/rust-privacy-reporter.cc: Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.cc: Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise. * checks/errors/rust-feature-gate.cc: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * metadata/rust-imports.h: Likewise. * resolve/rust-ast-resolve-path.h: Likewise. * resolve/rust-name-resolver.h: Likewise. * rust-backend.h: Likewise. * rust-diagnostics.h: Likewise. * rust-gcc.cc: Likewise. * rust-linemap.h: Likewise. * util/rust-attributes.cc: Likewise. * util/rust-hir-map.cc: Likewise. * util/rust-hir-map.h: Likewise. * util/rust-token-converter.cc: Likewise. 2024-01-16 Owen Avery * typecheck/rust-autoderef.cc: Replace Location with location_t. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-coercion.h: Likewise. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-trait-reference.cc: Likewise. * typecheck/rust-hir-trait-resolve.cc: Likewise. * typecheck/rust-hir-type-check-base.cc: Likewise. * typecheck/rust-hir-type-check-expr.cc: Likewise. * typecheck/rust-hir-type-check-expr.h: 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-type-util.cc: Likewise. * typecheck/rust-type-util.h: Likewise. * typecheck/rust-tyty-bounds.cc: Likewise. * typecheck/rust-tyty-call.cc: Likewise. * typecheck/rust-tyty-call.h: Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty-subst.h: Likewise. * typecheck/rust-tyty.cc: Likewise. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): refactored error message & called error function. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (literal_from_string): Add callback function. (load_macros_array): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (handle_suffix): Rework function to make it work with the new literal conversion function. (convert_literal): Add a new function to convert to a proc macro literal from a literal tokenptr. The function will abort if the pointer does not point to a literal. (convert): Add call to convert literal for every literal case. * util/rust-token-converter.h (convert_literal): Add public prototype. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc: Remove static modifier and move to an anonymous namespace. 2024-01-16 Muhammad Mahad * 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. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.cc (check_proc_macro_non_root): Add function to emit this specific error. (AttributeChecker::visit): Modify visitor to propagate to some containers that were not handled correctly. 2024-01-16 Owen Avery * 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. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (available): Remove function. (load_macros_array): There was no need for an indirection here. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (available): Add symbol registration. (load_macros_array): Likewise. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (load_macros_array): Symbol rename. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute): Refactor the function to be safer and more efficient. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute): Add a new function to find a potential proc macro type attribute on a given item. (proc_macro_privacy_check): Move all proc macro privacy check in their own function to avoid cluttering the usual privacy check. (PrivacyReporter::go): Add call to newly created proc macro privacy check function. 2024-01-16 Pierre-Emmanuel Patry * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go): Add visibility verification. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.cc (is_proc_macro_type): Add function to identify matching proc macro attribute type. (check_proc_macro_non_function): Add function to check and emit error. (AttributeChecker::visit): Add cal to new check function. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Remove NodeId from identifiers. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Added check for error code support. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): called error function. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * ast/rust-ast-builder.h: Replace Location with location_t. * 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. * 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.h: Likewise. * lex/rust-lex.cc: Likewise. * lex/rust-lex.h: Likewise. 2024-01-16 Owen Avery * expand/rust-derive-clone.cc: Replace Location with location_t. * expand/rust-derive-clone.h: Likewise. * expand/rust-derive-copy.cc: Likewise. * expand/rust-derive-copy.h: Likewise. * expand/rust-derive.cc: Likewise. * expand/rust-derive.h: Likewise. * expand/rust-macro-builtins.cc: Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc: Likewise. * parse/rust-parse-impl.h: Likewise. * parse/rust-parse.cc: Likewise. * parse/rust-parse.h: Likewise. 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_macro_match): Use token_id_is_keyword. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h (class Identifier): Remove interface inheritance. (class SimplePath): Likewise. * expand/rust-expand-visitor.cc (get_traits_to_derive): Change return type. (derive_item): Update according to get_traits_to_derive return type. (expand_item_attribute): Likewise. (ExpandVisitor::expand_inner_stmts): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Likewise. * util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_invocation): Change input type to SimplePath. (Mappings::lookup_derive_proc_macro_invocation): Likewise. (Mappings::insert_attribute_proc_macro_invocation): Likewise. (Mappings::lookup_attribute_proc_macro_invocation): Likewise. * util/rust-hir-map.h: Likewise with function prototypes. * util/rust-proc-macro-invocation.h: Removed. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add new constructor for SimplePath from an identifier. * expand/rust-expand-visitor.cc (get_traits_to_derive): Add conversion. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-macro-expand.cc (MacroExpander::import_proc_macros): Remove function. * expand/rust-macro-expand.h (struct MacroExpander): Remove import_proc_macro function. * util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_def): Add a function to insert a derive proc macro definition. (Mappings::insert_bang_proc_macro): Remove function. (Mappings::insert_bang_proc_macro_def): Add function to insert a bang proc macro definition. (Mappings::insert_attribute_proc_macro_def): Likewise with attribute proc macros. (Mappings::lookup_derive_proc_macro_def): Add a function to lookup a defined derive proc macro definition. (Mappings::lookup_bang_proc_macro): Remove function. (Mappings::lookup_bang_proc_macro_def): Add a function to lookup a bang proc macro definition. (Mappings::lookup_attribute_proc_macro_def): Add a function to lookup an attribute prod macro definition. (Mappings::insert_derive_proc_macro_invocation): Add a function to insert a derive proc macro invocation. (Mappings::lookup_derive_proc_macro_invocation): Add a function to lookup a derive proc macro invocation. (Mappings::insert_bang_proc_macro_invocation): Add a function to insert a bang proc macro invocation. (Mappings::lookup_bang_proc_macro_invocation): Add a function to lookup a bang proc macro invocation. (Mappings::insert_attribute_proc_macro_invocation): Add a function to insert an attribute proc macro invocation. (Mappings::lookup_attribute_proc_macro_invocation): Add a function to lookup an attribute proc macro invocation. * util/rust-hir-map.h: Add different proc macro mappings and change function prototypes. * expand/rust-expand-visitor.cc (get_traits_to_derive): Return a vector of SimplePath instead. (derive_item): Accept SimplePath instead of a string. * ast/rust-ast.h: Add common ProcMacroInvocable interface to Identifiers and SimplePath nodes. * ast/rust-ast.cc: Add const modifier. * ast/rust-macro.h: Change path and identifier getters. * ast/rust-path.h: Change return type to reference. * util/rust-proc-macro-invocation.h: New file. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.h (RUST_ATTRIBUTES_H): Add missing header guard. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h (class MetaItem): Add MetaItem dispatch values. * ast/rust-expr.h: Add LitExpr and PathLit dispatch. * ast/rust-macro.h: Add remaining dispatch getters. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-extern-crate.h: Add proc macro getter. * rust-session-manager.cc (Session::load_extern_crate): Collect mappings and create mappings. * util/rust-hir-map.cc: Add insertion and lookup functions for every mapping. * util/rust-hir-map.h: Add function prototypes. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-imports.cc (Import::try_package_in_directory): Add call to load macros before loading metadatas. * expand/rust-proc-macro.cc: Return empty vector instead of panicking on error. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-import-archive.cc (Stream_concatenate::do_peek): Remove deletion. (Stream_concatenate::do_advance): Likewise. (Import::find_archive_export_data): Replace with a smart pointer. * metadata/rust-imports.cc (add_search_path): Change return type to smart pointer. (Import::open_package): Likewise. (Import::try_package_in_directory): Likewise. (Import::find_export_data): Likewise. (Import::find_object_export_data): Likewise. (Import::Import): Change constructor to accept unique_ptr. * metadata/rust-imports.h: Change constructor prototype. * rust-session-manager.cc (Session::load_extern_crate): Change pointer to smart pointer. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-extern-crate.cc (ExternCrate::ExternCrate): Change constructor to accept procedural macro vector. * metadata/rust-extern-crate.h: Add vector of procecural macro in extern crate. * rust-session-manager.cc (Session::load_extern_crate): Add argument to new constructor call. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-imports.cc (add_search_path): Change prototype, now return a pair of Stream and procedural macro vector. (Import::open_package): Likewise. (Import::try_package_in_directory): Likewise. * metadata/rust-imports.h: Likewise. * rust-session-manager.cc (Session::load_extern_crate): Likewise. 2024-01-16 Pierre-Emmanuel Patry * metadata/rust-imports.h: Make the function to load a given file public. * rust-session-manager.cc (Session::load_extern_crate): Change path resolution depending on extern crate declaration in cli arguments. 2024-01-16 Owen Avery * ast/rust-ast-collector.h (TokenCollector::visit): Replace default argument with UNDEF_LOCATION. 2024-01-16 Owen Avery * 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. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): refactored and call error function. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.cc (AttributeChecker::visit): Add help message. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.cc (AttributeChecker::visit): Add attribute input check. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.cc (AttributeChecker::visit): Add attribute check on functions. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_ident): Adapt code to new constructor. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-proc-macro.cc (tokenstream_from_string): Add a function that creates a tokenstream from a given string. (load_macros_array): Add call to registration function. 2024-01-16 Pierre-Emmanuel Patry * lang.opt: Add option * rust-session-manager.cc: Add option registration in session target options. * rust-session-manager.h (struct CompileOptions): Add new getter for proc macros instead of a boolean. 2024-01-16 Arthur Cohen * resolve/rust-forever-stack.h: New file. * resolve/rust-forever-stack.hxx: New file. 2024-01-16 Marc Poulhiès * hir/rust-hir-dump.cc (convert_param_kind_to_str): New. (convert_new_bind_type_to_str): New. (convert_mut_to_str): New. (Dump::go): New. (Dump::put): New. (Dump::begin): New. (Dump::end): New. (Dump::begin_field): New. (Dump::end_field): New. (Dump::put_field): New. (Dump::visit_field): New. (Dump::visit): Refactor. (Dump::visit_collection): New. (Dump::do_traititem): New. (Dump::do_vis_item): New. (Dump::do_functionparam): New. (Dump::do_pathpattern): New. (Dump::do_structexprstruct): New. (Dump::do_expr): New. (Dump::do_pathexpr): New. (Dump::do_typepathsegment): New. (Dump::do_typepathfunction): New. (Dump::do_qualifiedpathtype): New. (Dump::do_operatorexpr): New. (Dump::do_mappings): New. (Dump::do_inner_attrs): New. (Dump::do_outer_attrs): New. (Dump::do_baseloopexpr): New. (Dump::do_ifletexpr): New. (Dump::do_struct): New. (Dump::do_enumitem): New. (Dump::do_traitfunctiondecl): New. (Dump::do_externalitem): New. (Dump::do_namefunctionparam): New. (Dump::do_stmt): New. (Dump::do_type): New. (Dump::do_item): New. (Dump::do_tuplefield): New. (Dump::do_structfield): New. (Dump::do_genericargs): New. (Dump::do_maybenamedparam): New. * hir/rust-hir-dump.h: Refactor. * hir/tree/rust-hir-item.h (enum_to_str): New. * hir/tree/rust-hir-type.h (enum_to_str): New. * hir/tree/rust-hir.cc (enum_to_str): New. * util/rust-common.h (enum_to_str): New. 2024-01-16 Arthur Cohen Matthew Jasper * Make-lang.in: Add `rust-rib.cc` object. * resolve/rust-rib.cc: New file. * resolve/rust-rib.h: New file. 2024-01-16 Owen Avery * ast/rust-ast.h: Replace Location with location_t. * ast/rust-expr.h: Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.h: Likewise. * ast/rust-pattern.h: Likewise. * ast/rust-stmt.h: Likewise. * ast/rust-type.h: Likewise. * hir/rust-ast-lower-base.h: 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. * lex/rust-token.h: Likewise. * resolve/rust-ast-resolve-pattern.h: Likewise. * typecheck/rust-hir-trait-reference.h: Likewise. * typecheck/rust-tyty-bounds.h: Likewise. * typecheck/rust-tyty-call.h: Likewise. * typecheck/rust-tyty-subst.h: Likewise. * typecheck/rust-tyty-util.h: Likewise. * typecheck/rust-tyty.h: Likewise. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * rust-gcc.cc (Gcc_backend::debug): Move out of class declaration. (Gcc_backend::get_identifier_node): Likewise. (Gcc_backend::wchar_type): Likewise. 2024-01-16 Muhammad Mahad * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): called error function. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * rust-gcc.h: Add include guard. 2024-01-16 Arthur Cohen * 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-16 Muhammad Mahad * checks/errors/rust-feature-gate.cc (FeatureGate::gate): called error function. 2024-01-16 Muhammad Mahad * backend/rust-compile-intrinsic.cc (Intrinsics::compile): called error function. 2024-01-16 Muhammad Mahad * checks/errors/rust-unsafe-checker.cc (check_unsafe_call): called error function. 2024-01-16 Owen Avery * rust-location.h (typedef RichLocation): Remove. * expand/rust-macro-expand.cc: Replace RichLocation with rich_location. * hir/rust-ast-lower-base.cc: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * rust-diagnostics.cc: Likewise. * rust-diagnostics.h: Likewise. * rust-session-manager.cc: Likewise. * typecheck/rust-casts.cc: Likewise. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-hir-inherent-impl-overlap.h: Likewise. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-trait-reference.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-pattern.cc: Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. * typecheck/rust-unify.cc: Likewise. 2024-01-16 Owen Avery * lex/rust-lex.cc (Lexer::start_line): Use linemap_line_start. * rust-linemap.cc (Linemap::start_line): Remove. * rust-linemap.h (Linemap::start_line): Remove. 2024-01-16 Owen Avery * rust-linemap.cc (RichLocation::RichLocation): Remove. (RichLocation::~RichLocation): Remove. (RichLocation::add_range): Remove. (RichLocation::add_fixit_insert_before): Remove. (RichLocation::add_fixit_insert_after): Remove. * rust-location.h (class RichLocation): Remove. * rust-diagnostics.cc (rust_be_error_at): Remove RichLocation::get invocation. * expand/rust-macro-expand.cc: Fix RichLocation constructor. * hir/rust-ast-lower-base.cc: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * rust-session-manager.cc: Likewise. * typecheck/rust-casts.cc: Likewise. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-hir-inherent-impl-overlap.h: Likewise. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-trait-reference.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-pattern.cc: Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. * typecheck/rust-unify.cc: Likewise. 2024-01-16 Owen Avery * lex/rust-lex.cc (Lexer::get_current_location): Use linemap_position_for_column. * rust-session-manager.cc (Session::handle_crate_name): Likewise. * rust-linemap.cc (Linemap::get_location): Remove. * rust-linemap.h (Linemap::get_location): Likewise. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-token.cc (escape_special_chars): Add a function that escape a given string. (Token::as_string): Add call to escape function for string/char representations. 2024-01-16 Marc Poulhiès * hir/tree/rust-hir-type.h (MaybeNamedParam::get_type): Remove rust_assert. (BareFunctionType::get_return_type): Likewise. 2024-01-16 Pierre-Emmanuel Patry * 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. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add virtual destructor. * expand/rust-macro-expand.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * hir/tree/rust-hir-full-decls.h (struct Crate): Change to class. (class Crate): Likewise. (struct StructField): Likewise. (class StructField): Likewise. (struct TupleField): Likewise. (class TupleField): Likewise. (struct TraitFunctionDecl): Likewise. (class TraitFunctionDecl): Likewise. * rust-session-manager.h (struct Crate): Likewise. (class Crate): Likewise. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * lex/rust-lex.cc (Lexer::dump_and_skip): Use location_to_string. * rust-linemap.cc (Linemap::to_string): Move to... (Linemap::location_to_string): ... here. * rust-linemap.h (Linemap::to_string): Remove. (Linemap::location_to_string): Remove definition. 2024-01-16 Marc Poulhiès * hir/tree/rust-hir-expr.h (TypeCastExpr::get_casted_expr): Remove assert in accessor. (TypeCastExpr::get_type_to_convert_to): Likewise. (CompoundAssignmentExpr::get_left_expr): Likewise. (CompoundAssignmentExpr::get_right_expr): Likewise. (GroupedExpr::get_expr_in_parens): Likewise. (TupleIndexExpr::get_tuple_expr): Likewise. (FieldAccessExpr::get_receiver_expr): Likewise. (ClosureParam::get_pattern): Likewise. (ClosureParam::get_type): Likewise. (ExprType::get_return_type): Likewise. (IfLetExpr::get_scrutinee_expr): Likewise. (MatchArm::get_guard_expr): Likewise. (MatchExpr::get_scrutinee_expr): Likewise. * hir/tree/rust-hir-item.h (TypeParam::get_type): Likewise. (SelfParam::get_type): Likewise. (Function::get_return_type): Likewise. (TypeAlias::get_type_aliased): Likewise. (StructField::get_field_type): Likewise. (TraitFunctionDecl::get_block_expr): Likewise. (ImplBlock::get_trait_ref): Likewise. * hir/tree/rust-hir-path.h (ConstGenericArg::get_expression): New. (TypePathFunction::get_return_type): Remove assert in accessor. (QualifiedPathType::get_trait): Likewise. * hir/tree/rust-hir-pattern.h (PatternType::get_lower_bound): Likewise. (PatternType::get_upper_bound): Likewise. (ReferencePattern::get_referenced_pattern): Likewise. * hir/tree/rust-hir.h (ConstGenericParam::get_default_expression): Likewise. 2024-01-16 Muhammad Mahad * hir/rust-ast-lower-base.cc (struct_field_name_exists): called error function. 2024-01-16 Owen Avery * rust-diagnostics.cc (rust_be_error_at): Add function accepting location_t and ErrorCode. (rust_error_at): Likewise. * rust-diagnostics.h (rust_error_at): Likewise. (rust_be_error_at): Likewise. 2024-01-16 Owen Avery * rust-linemap.cc (class Gcc_linemap): Remove. (Gcc_linemap::start_file): Move to... (Linemap::start_file): ... here. (Gcc_linemap::to_string): Move to... (Linemap::to_string): ... here. (Gcc_linemap::stop): Move to... (Linemap::stop): ... here. (Gcc_linemap::start_line): Move to... (Linemap::start_line): ... here. (Gcc_linemap::get_location): Move to... (Linemap::get_location): ... here. (rust_get_linemap): Use Linemap. * rust-linemap.h (Linemap::in_file_): New field from Gcc_linemap. (Linemap::Linemap): Initialize in_file_. (Linemap::~Linemap): Make non-virtual. (Linemap::start_file): Likewise. (Linemap::start_line): Likewise. (Linemap::get_location): Likewise. (Linemap::stop): Likewise. (Linemap::to_string): Likewise. 2024-01-16 Arthur Cohen * 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-16 Owen Avery * rust-linemap.h (Linemap::unknown_location): Remove. * ast/rust-ast.cc: Replace Linemap::unknown_location with UNKNOWN_LOCATION. * ast/rust-path.cc: Likewise. * hir/tree/rust-hir.cc: Likewise. * metadata/rust-imports.cc: Likewise. * parse/rust-parse-impl.h: Likewise. * parse/rust-parse.h: Likewise. * rust-backend.h: Likewise. * rust-diagnostics.cc: Likewise. * rust-session-manager.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. 2024-01-16 Muhammad Mahad * resolve/rust-ast-verify-assignee.h: called error function. 2024-01-16 Muhammad Mahad * typecheck/rust-tyty-call.cc (emit_unexpected_argument_error): Refactored invalid number of argument into one function. (TypeCheckCallExpr::visit): called refactored function. (TypeCheckMethodCallExpr::check): likewise. 2024-01-16 Arthur Cohen * util/expected.h: Adapt class to GCC requirements. 2024-01-16 Arthur Cohen * util/expected.h: New file. 2024-01-16 Arthur Cohen * util/optional.h: Adapt for GCC. 2024-01-16 Arthur Cohen * util/optional.h: New file. 2024-01-16 Owen Avery * 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. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix abit output format. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix external item trailing semicolon and outer attributes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Output outer attributes on external functions. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix method qualifier output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add where clause. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add outer attributes to collector output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add variadics in collector output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add generics. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix generic output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Reformat trait impl block. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Output generic in inherent impl. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-dump.cc (Dump::require_spacing): Change dollar spacing rule. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Change formatting. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix trait impl block output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix binding args. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Output function qualifiers after visibility. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix self param output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-dump.cc (Dump::require_spacing): Add a rule to remove spaces around dots and after references. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix several token collection rules. * ast/rust-ast-dump.cc (Dump::require_spacing): Add spacing rule for comma. 2024-01-16 Owen Avery * expand/rust-macro-invoc-lexer.h (class MacroInvocLexerBase): New. 2024-01-16 Owen Avery * expand/rust-macro-builtins.cc (source_relative_path): Use LOCATION_FILE. (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Use LOCATION_COLUMN. (MacroBuiltin::line_handler): Use LOCATION_LINE. * rust-linemap.cc (Gcc_linemap::location_file): Remove. (Gcc_linemap::location_line): Remove. (Gcc_linemap::location_column): Remove. * rust-linemap.h (Linemap::location_file): Remove. (Linemap::location_line): Remove. (Linemap::location_column): Remove. (Linemap::location_to_file): Remove. (Linemap::location_to_line): Remove. (Linemap::location_to_column): Remove. 2024-01-16 Muhammad Mahad * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): called error function and changed error message similiar to rustc. 2024-01-16 Owen Avery * rust-linemap.cc (Gcc_linemap::get_unknown_location): Remove. (Gcc_linemap::get_predeclared_location): Remove. (Gcc_linemap::is_predeclared): Remove. (Gcc_linemap::is_unknown): Remove. * rust-linemap.h (Linemap::get_predeclared_location): Remove. (Linemap::get_unknown_location): Remove. (Linemap::is_predeclared): Remove. (Linemap::is_unknown): Remove. (Linemap::predeclared_location): Use BUILTINS_LOCATION. (Linemap::unknown_location): Use UNKNOWN_LOCATION. (Linemap::is_predeclared_location): Remove. (Linemap::is_unknown_location): Remove. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): called error function 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): called error function. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (Lexer::input_source_is_valid_utf8): New method of `Lexer`. * lex/rust-lex.h: Likewise. * rust-session-manager.cc (Session::compile_crate): Add error. 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (transcribe_expression): Skip trailing semicolon. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-item.cc: called error function. 2024-01-16 Raiki Tamura * ast/rust-ast.h: Modify constructors of `Rust::Identifier` * ast/rust-pattern.h: Likewise. * hir/tree/rust-hir-item.h: Likewise. * parse/rust-parse-impl.h (Parser::parse_macro_rules_def): Likewise. (Parser::parse_decl_macro_def): Likewise. (Parser::parse_macro_match_fragment): Likewise. (Parser::parse_module): Likewise. (Parser::parse_use_tree): Likewise. (Parser::parse_function): Likewise. (Parser::parse_type_param): Likewise. (Parser::parse_type_alias): Likewise. (Parser::parse_struct): Likewise. (Parser::parse_struct_field): Likewise. (Parser::parse_enum): Likewise. (Parser::parse_enum_item): Likewise. (Parser::parse_union): Likewise. (Parser::parse_static_item): Likewise. (Parser::parse_trait): Likewise. (Parser::parse_trait_item): Likewise. (Parser::parse_trait_type): Likewise. (Parser::parse_trait_const): Likewise. (Parser::parse_external_item): Likewise. (Parser::parse_generic_args_binding): Likewise. (Parser::parse_method): Likewise. (Parser::parse_maybe_named_param): Likewise. (Parser::parse_identifier_pattern): Likewise. (Parser::parse_struct_expr_field): Likewise. (ResolveItem::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit):Add comments * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. * checks/lints/rust-lint-scan-deadcode.h: Fix error location 2024-01-16 Owen Avery * 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. 2024-01-16 Marc Poulhiès * 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. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-path-probe.h: called error function 2024-01-16 Muhammad Mahad * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): called error function 2024-01-16 Marc Poulhiès * hir/tree/rust-hir-expr.h (class ArrayElems): Inherit from FullVisitable. (class StructExprField): Likewise. * hir/tree/rust-hir-item.h (class WhereClauseItem): Likewise. (class UseTree): Likewise. (UseTreeRebind::get_path, UseTreeRebind::get_identifier) (UseTreeRebind::get_bind_type): New. (UseDeclaration::get_use_tree): New. (struct TraitFunctionDecl): Change struct to ... (class TraitFunctionDecl): ... class. (TraitFunctionDecl::get_where_clause): New. (StructField::get_outer_attrs): New. (struct TupleField): Change struct to ... (class TupleField): ... class. (TupleField::get_visibility, TupleField::get_outer_attrs): New. * hir/tree/rust-hir-pattern.h (class TupleStructItems): Inherit from FullVisitable. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (Lexer::build_token): Replace function call. (Lexer::parse_string): Likewise. (Lexer::parse_identifier_or_keyword): Likewise. (Lexer::parse_raw_string): Likewise. (Lexer::parse_char_or_lifetime): Likewise. (Lexer::get_input_codepoint_length): Deleted. (Lexer::peek_codepoint_input): Deleted. (Lexer::skip_codepoint_input): Deleted. * lex/rust-lex.h: Remove some methods and fields 2024-01-16 Philip Herron * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): track output * util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): new helper * util/rust-hir-map.h: add prototype for helper 2024-01-16 Philip Herron * 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 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at 2024-01-16 Marc Poulhiès * 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. 2024-01-16 Marc Poulhiès * hir/tree/rust-hir-expr.h (AwaitExpr::get_awaited_expr): New. (AsyncBlockExpr::get_has_move, AsyncBlockExpr::get_block_expr): New. * hir/tree/rust-hir-item.h (Enum::get_where_clause): New. (Trait::get_where_clause, Trait::is_unsafe): New. (ExternalItem::get_visibility): New. 2024-01-16 Marc Poulhiès * hir/tree/rust-hir.h (class FullVisitable): New. (class Stmt): Adjust with new class. (class Expr): Likewise. (class Pattern): Likewise. (class Type): Likewise. (class TypeParamBound): Likewise. (class GenericParam): Likewise. (class TraitItem): Likewise. (class ImplItem): Likewise. 2024-01-16 Marc Poulhiès * hir/tree/rust-hir.h (class WithInnerAttrs): New. (class Item): Adjust to new WithInnerAttrs class. (struct Crate): Likewise. * hir/rust-hir-dump.cc (Dump::go): Likewise. (Dump::visit): Likewise. * hir/tree/rust-hir-expr.h (class GroupedExpr): Likewise. (class ArrayExpr): Likewise. (class TupleExpr): Likewise. (class StructExprStruct): Likewise. (class BlockExpr): Likewise. (class MatchExpr): Likewise. * hir/tree/rust-hir-item.h (TypeParam::get_outer_attribute): New. (class Module): Adjust to new WithInnerAttrs class. (struct StructField): change struct to... (class StructField): ... a class. (class ImplBlock): Adjust to new WithInnerAttrs class. (class ExternBlock): Likewise. 2024-01-16 Marc Poulhiès * 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. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-pattern.h: Change constructor to accept new parameter instead of defaulting on string type. * parse/rust-parse-impl.h (Parser::parse_literal_or_range_pattern): Propagate type hint. (Parser::parse_pattern_no_alt): Likewise. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (Lexer::parse_byte_char):add check for range of codepoint 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field Error Function (TypeCheckPattern::visit): called emit_invalid_field_error function 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (MacroExpander::match_matcher): Remove append_fragment inside repetitions. (MacroExpander::match_n_matches): Use sub_stack push/pop to handle repetitions. (MatchedFragmentContainer::add_fragment): Add MatchedFragmentContainer accepting version. * expand/rust-macro-expand.h (MatchedFragmentContainer::add_fragment): Likewise. (MatchedFragmentContainerRepetition::add_fragment): Likewise. (SubstititionScope::append_fragment): Likewise. 2024-01-16 Philip Herron * typecheck/rust-casts.cc (TypeCastRules::check): apply new argument * typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): track if this is a cast site (TypeCoercionRules::TryCoerce): update ctor (TypeCoercionRules::TypeCoercionRules): cleanup error handling (TypeCoercionRules::do_coercion): likewise (TypeCoercionRules::coerce_unsafe_ptr): only infer in try mode (TypeCoercionRules::coerce_borrowed_pointer): cleanup * typecheck/rust-coercion.h: update header 2024-01-16 Philip Herron * typecheck/rust-hir-trait-reference.h: update prototype * typecheck/rust-hir-trait-resolve.cc: add generic args as an out param * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): use the generics 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add comment after tail expressions. * ast/rust-ast-dump.cc (Dump::require_spacing): Check for missing previous token. * ast/rust-ast-dump.h: Output formatting characters. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::collect): Collect CollectItems once done. (TokenCollector::newline): Add newline formatting implementation. (TokenCollector::indentation): Add indentation implementation. (TokenCollector::increment_indentation): Add indentation increment. (TokenCollector::comment): Add new comment formatting option. * ast/rust-ast-collector.h: Update prototypes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::collect_tokens): Filter tokens. (TokenCollector::visit_items_joined_by_separator): Change store call. (TokenCollector::visit_as_line): Likewise. (TokenCollector::visit_items_as_block): Likewise. (TokenCollector::trailing_comma): Likewise. (TokenCollector::visit): Likewise. (TokenCollector::visit_closure_common): Likewise. (TokenCollector::visit_function_common): Likewise. * ast/rust-ast-collector.h (class CollectItem): Add class to differentiate between formatting and raw data (tokens). 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::TokenCollector): Remove constructor, changing it to an implicit default constructor. * ast/rust-ast-collector.h: Change from container reference to direct container. * ast/rust-ast-dump.h: Change call to constructor. * expand/rust-macro-expand.h (struct MacroExpander): Likewise. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-dump.cc (Dump::require_spacing): Add a function to determine wether a space shall output. * ast/rust-ast-dump.h: Add function prototype as well as condition. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add a visit function for visitable abstract class so we can call a dump on any visitable item. * ast/rust-ast-collector.h: Add new visit function prototype. * ast/rust-ast-dump.cc (Dump::go): Add call to process function. (Dump::visit): Remove functions. (Dump::visit_items_joined_by_separator): Likewise. (Dump::visit_as_line): Likewise. (Dump::visit_items_as_lines): Likewise. (Dump::visit_items_as_block): Likewise. (Dump::visit_function_common): Likewise. (get_delimiters): Likewise. (Dump::debug): Update with call to tokencollector. * ast/rust-ast-dump.h (RUST_AST_DUMP_H): Move include directives. (class Dump): Remove multiple prototypes and add generic process function. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Add semicolon in extern blocks. 2024-01-16 Pierre-Emmanuel Patry * rust-session-manager.cc (Session::enable_dump): Remove tokenstream dump. (Session::compile_crate): Likewise. (Session::dump_tokenstream): Likewise. * rust-session-manager.h (struct CompileOptions): Likewise. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (Lexer::build_token):add check for all kinds of whitespaces 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add default constructors. 2024-01-16 Pierre-Emmanuel Patry * 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. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (is_float_digit):Change types of param to `uint32_t` (is_x_digit):Likewise (is_octal_digit):Likewise (is_bin_digit):Likewise (check_valid_float_dot_end):Likewise (is_whitespace):Likewise (is_non_decimal_int_literal_separator):Likewise (is_identifier_start):Likewise (is_identifier_continue):Likewise (Lexer::skip_broken_string_input):Likewise (Lexer::build_token):Remove handling BOM (Lexer::parse_in_type_suffix):Modify use of `current_char` (Lexer::parse_in_decimal):Likewise (Lexer::parse_escape):Likewise (Lexer::parse_utf8_escape):Likewise (Lexer::parse_partial_string_continue):Likewise (Lexer::parse_partial_hex_escape):Likewise (Lexer::parse_partial_unicode_escape):Likewise (Lexer::parse_byte_char):Likewise (Lexer::parse_byte_string):Likewise (Lexer::parse_raw_byte_string):Likewise (Lexer::parse_raw_identifier):Likewise (Lexer::parse_non_decimal_int_literal):Likewise (Lexer::parse_decimal_int_or_float):Likewise (Lexer::peek_input):Change return type to `Codepoint` (Lexer::get_input_codepoint_length):Change to return 1 (Lexer::peek_codepoint_input):Change to be wrapper of `peek_input` (Lexer::skip_codepoint_input):Change to be wrapper of `skip_input` (Lexer::test_get_input_codepoint_n_length):Deleted (Lexer::split_current_token):Deleted (Lexer::test_peek_codepoint_input):Deleted (Lexer::start_line):Move backwards (assert_source_content):New helper function for selftest (test_buffer_input_source):New helper function for selftest (test_file_input_source):Likewise (rust_input_source_test):New test * lex/rust-lex.h (rust_input_source_test):New test * rust-lang.cc (run_rust_tests):Add selftest 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (MacroExpander::match_repetition_skipped_metavars): New. (MacroExpander::match_repetition): Use new method. * expand/rust-macro-expand.h (MacroExpander::match_repetition_skipped_metavars): New. 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (MacroExpander::match_token): Match token instead of token id. * parse/rust-parse-impl.h (Parser::skip_token): Add token-skipping variant. (Parser::expect_token): Likewise. * parse/rust-parse.h (Parser::skip_token): Likewise. (Parser::expect_token): Likewise. 2024-01-16 Arthur Cohen * lang.opt: Add -frust-name-resolution-2.0 option 2024-01-16 Philip Herron * typecheck/rust-autoderef.cc (AutoderefCycle::cycle): add check for pointers 2024-01-16 Philip Herron * typecheck/rust-autoderef.cc: use new selection filter * typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): new slection Filter * typecheck/rust-hir-dot-operator.h: New select prototype * typecheck/rust-hir-type-check-expr.cc: call select * typecheck/rust-type-util.cc (try_coercion): new helper * typecheck/rust-type-util.h (try_coercion): helper prototype 2024-01-16 Muhammad Mahad * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): passed "E0277" * typecheck/rust-tyty.cc (BaseType::bounds_compatible): passed "E0277" 2024-01-16 Matthew Jasper * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Expand expressions in more contexts. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Visit enum variants. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.cc (BlockExpr::normalize_tail_expr): Refactor code and warn about dangling reference. * expand/rust-expand-visitor.cc (expand_stmt_attribute): Document function and change argument names to make those clearer. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_stmts): Remove second argument. (ExpandVisitor::visit): Remove argument from function call. * expand/rust-expand-visitor.h: Update function prototype. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Change call to expand_inner_stmts. (expand_tail_expr): Change argument name and try to expand the last statement as a tail expression once all statements have been expanded. * expand/rust-expand-visitor.h: Change prototype to accept parent class. * ast/rust-expr.h: Add try_convert_last_stmt function prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-expr.h: Add a function to take tail expr as well as a function to set a tail expression. * expand/rust-expand-visitor.cc (expand_tail_expr): Add tail expression expansion function. (ExpandVisitor::visit): Add call to tail expr expansion in for BlockExpr. 2024-01-16 Arthur Cohen Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc : Change type from pointer to reference and expand statements from statements. * ast/rust-macro.h: Return macro kind. * ast/rust-ast.h: Add Statement kind. * ast/rust-item.h: Change module. * ast/rust-stmt.h: Return kind. 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Use pointers/smart pointers to refer to MatchedFragmentContainer instances. (MacroExpander::transcribe_rule): Likewise. (MatchedFragmentContainer::get_single_fragment): New implementation. (MatchedFragmentContainer::get_fragments): Likewise. (MatchedFragmentContainer::add_fragment): Likewise. (MatchedFragmentContainer::zero): Likewise. (MatchedFragmentContainer::metavar): Likewise. * expand/rust-macro-expand.h (class MatchedFragmentContainer): Make abstract. (class MatchedFragmentContainerMetaVar): New. (class MatchedFragmentContainerRepetition): New. (class SubstitutionScope): Use pointers/smart pointers to refer to MatchedFragmentContainer instances. (MacroExpander::transcribe_rule): Likewise. * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_metavar): Likewise. (SubstituteCtx::check_repetition_amount): Likewise. (SubstituteCtx::substitute_repetition): Likewise. * expand/rust-macro-substitute-ctx.h (class SubstituteCtx): Likewise. 2024-01-16 Muhammad Mahad * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): called rust_error_at * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): called rust_error_at 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelfWithInference): arguments mappings as an out parameter and apply them to the bounds * typecheck/rust-hir-type-check-item.h: update the prototype * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): apply the arguments to the segment type 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): simplify lookup of the respective predicate * typecheck/rust-tyty-subst.cc (SubstitutionArg::SubstitutionArg): track original parameter (SubstitutionArg::operator=): update copy ctor (SubstitutionArg::get_param_ty): use original param (SubstitutionArg::as_string): update as_string * typecheck/rust-tyty-subst.h: add new private field 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelfWithInference): New helper utility to infer non concrete types and handle the case where its not a binding generic type (which inherits SubstitutionRef) * typecheck/rust-hir-type-check-item.h: new helper prototype * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): use this helper 2024-01-16 Philip Herron * typecheck/rust-hir-trait-resolve.cc: use lookup_predicate (DefID) * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): fix formatting 2024-01-16 Matthew Jasper * ast/rust-ast.h (MacroInvocation::add_semicolon): New method. (Expr::to_stmt): Remove method. * ast/rust-macro.h (MacroInvocation::add_semicolon): Add override. (MacroInvocation::to_stmt): Remove override. * ast/rust-stmt.h: Remove use of Expr::to_stmt. (ExprStmt::add_semicolon): Add override. * expand/rust-macro-expand.h (struct MacroExpander): Add EXPR/STMT and remove BLOCK from ContextType. * expand/rust-expand-visitor.cc (ExpandVisitor::maybe_expand_expr): Use EXPR context. (ExpandVisitor::expand_inner_stmts): Use STMT context. (ExpandVisitor::visitor): Remove use of BLOCK context. * expand/rust-macro-expand.cc (parse_many): Pass enum by value. (transcribe_on_delimiter): Remove function. (transcribe_context): Use EXPR/STMT contexts. (MacroExpander::parse_proc_macro_output): Use EXPR/STMT contexts. (transcribe_many_stmts): Parse statements with semicolons. * parse/rust-parse-impl.h (Parser::parse_stmt): Delegate macro parsing to parse_expr_stmt, check for ! after macro_rules. (Parser::parse_let_stmt): Work around lack of NT tokens. (Parser::parse_expr_stmt): Handle statements at end of macro expansions. (Parser::parse_expr_stmt): Parse macro statements/expression statements starting with a macro. (Parser::parse_match_expr): Don't modify flag unnecessarily. (Parser::parse_stmt_or_expr): Parse macro statements/expression statements starting with a macro. (Parser::parse_path_based_stmt_or_expr): Remove method. (Parser::parse_macro_invocation_maybe_semi): Remove method. (Parser::parse_expr): Move code into left_denotations. (Parser::left_denotations): New method. (Parser::null_denotation): Split out methods for cases with and without paths. (Parser::null_denotation_path): New method. (Parser::null_denotation_not_path): New method. (Parser::parse_macro_invocation_partial): Don't check for semicolon here. * parse/rust-parse.h: Update declarations. (struct ParseRestrictions): Additional flag. 2024-01-16 Matthew Jasper * ast/rust-ast.cc (BlockExpr::strip_tail_expr): Don't normalize tail expression in this method. (BlockExpr::normalize_tail_expr): New method that only does the normalization. * ast/rust-expr.h: Declare new method. * hir/rust-ast-lower-block.h: Normalize tail expressions on blocks before lowering. 2024-01-16 Matthew Jasper * ast/rust-ast-dump.cc (Dump::visit): Print macro invocations. 2024-01-16 Raiki Tamura * lex/rust-lex.cc (is_whitespace):add all lacked codepoints valid as whitespaces (is_identifier_start):new function to check XID_Start and underscore (is_identifier_continue):new function to check XID_Continue (Lexer::build_token):tokenize Unicode identifiers (Lexer::parse_partial_string_continue):add comments (Lexer::parse_partial_unicode_escape):add comments (Lexer::parse_raw_identifier):change to use `is_identifier_scontinue` (Lexer::parse_identifier_or_keyword):change to use `is_identifier_continue` (Lexer::parse_char_or_lifetime):change to use `is_identifier_start/continue` (Lexer::skip_codepoint_input):do not attempt to skip input when bumping EOF * lex/rust-lex.h:add `current_char32` field 2024-01-16 Owen Avery * lex/rust-lex.cc (Lexer::classify_keyword): Check if iterator is valid before dereferencing. 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (MacroExpander::match_repetition): Remove redundant rust_error_at call. 2024-01-16 Philip Herron * typecheck/rust-unify.cc (UnifyRules::go): dont check bounds on placeholders 2024-01-16 tieway59 * typecheck/rust-tycheck-dump.h: Delete this file * rust-session-manager.cc: Remove `Session::dump_type_resolution` and `TYPE_RESOLUTION_DUMP` * rust-session-manager.h: Likewise 2024-01-16 Philip Herron * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): match the fntype to the candidate 2024-01-16 Arthur Cohen * expand/rust-derive.h: Store AstBuilder and location. * expand/rust-derive.cc (DeriveVisitor::DeriveVisitor): Update constructor. * expand/rust-derive-clone.h: Remove members now stored in `DeriveVisitor`. * expand/rust-derive-copy.h: Likewise. * expand/rust-derive-clone.cc (DeriveClone::DeriveClone): Update constructor. * expand/rust-derive-copy.cc (DeriveCopy::DeriveCopy): Likewise. 2024-01-16 Philip Herron * 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 2024-01-16 Dave Evans * 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. 2024-01-16 TieWay59 * typecheck/rust-hir-type-check-expr.cc: Remove obsolete error diagnostic 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): use new interface * typecheck/rust-type-util.cc (types_compatable): implementation of new interface * typecheck/rust-type-util.h (types_compatable): prototype * typecheck/rust-unify.cc (UnifyRules::expect_placeholder): It is allow for unification against placeholders 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (derive_item): Add const attribute to the trait name argument. * expand/rust-macro-expand.h (struct MacroExpander): Likewise. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (get_traits_to_derive): Change assertion to allow empty derive directives. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (expand_attribute): Add function to expand a given attribute on a given item. * expand/rust-macro-expand.h (struct MacroExpander): Change return type to ast fragment. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (get_traits_to_derive): Change the function to get traits in a given attribute instead of an attribute vector. (ExpandVisitor::expand_struct_fields): Remove call in visitor. (ExpandVisitor::expand_function_params): Likewise. (ExpandVisitor::expand_closure_params): Likewise. (ExpandVisitor::visit): Likewise. (ExpandVisitor::expand_outer_attribute): Remove function. (ExpandVisitor::visit_outer_attrs): Remove function. * expand/rust-expand-visitor.h: Remove function prototypes. (ExpandVisitor::visit_outer_attrs): Remove function. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.h: Remove fragment collection fro procedural macros. * expand/rust-macro-expand.h (struct MacroExpander): Remove procedural macro fragment from expander. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-fragment.cc (Fragment::Fragment): Remove overwrite member in constructor. (Fragment::operator=): Removal of overwrite member in copy. (Fragment::should_overwrite): Remove overwrite getter. * ast/rust-ast-fragment.h: Remove overwrite boolean member. * expand/rust-expand-visitor.cc (derive_item): Add a function to derive items using the expander for now. (builtin_derive_item): Rename from derive_item to builtin_derive_item. (ExpandVisitor::visit): Remove visit to derive attributes. (ExpandVisitor::expand_derive): Remove derive attribute visitor. (ExpandVisitor::visit_attrs_with_derive): Likewise. * expand/rust-expand-visitor.h: Update insertion of other kind of proc macros. We no longer have an overwrite attribute in the fragment. * expand/rust-macro-expand.cc (MacroExpander::parse_procmacro_output): Return the fragment instead of inserting it. * expand/rust-macro-expand.h (struct MacroExpander): Return fragment. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.h: Update enum name to match definition. * expand/rust-expand-visitor.cc (ExpandVisitor::expand_derive): Add call to expander. (ExpandVisitor::expand_outer_attribute): Change call to macro expander. (ExpandVisitor::expand_inner_attribute): Likewise. * expand/rust-expand-visitor.h: Remove const attribute to match visitor declaration. Attach result to the AST. Add condition for item erasure. * expand/rust-proc-macro.h: Add token collector and expansion call. Add lexers and parsers for each proc macro type and uses them to parse macro output. * expand/rust-macro-expand.h (struct MacroExpander): Add functions. * expand/rust-proc-macro.cc (ProcMacroExpander::import_proc_macros): Moved from here... * expand/rust-macro-expand.cc (MacroExpander::import_proc_macros): ... to here. Unify procedural macro parsing under one function. Add a flag to determine whether it originate from a derive macro. (MacroExpander::parse_procmacro_output): Parse macro output to statements. Store an error on parsing failure. * Make-lang.in: Add const_TokenPtr specific lexer. * expand/rust-proc-macro-invoc-lexer.cc: New file. * expand/rust-proc-macro-invoc-lexer.h: New file. * rust-session-manager.cc (Session::expansion): Remove ProcMacroExpander declaration. * ast/rust-ast-fragment.cc (Fragment::Fragment): Add overwrite flag. (Fragment::should_overwrite): Add a getter to determine whether the fragment shall overwrite it's parent or be appended after. * ast/rust-ast-fragment.h: Add flag to declaration. 2024-01-16 Pierre-Emmanuel Patry * util/rust-hir-map.cc (Mappings::insert_bang_proc_macro): Add a function to insert a new bang proc macro. (Mappings::lookup_bang_proc_macro): Add a function to lookup a bang procedural macro. (Mappings::insert_derive_proc_macro): Add a function to insert a derive procedural macro. (Mappings::lookup_derive_proc_macro): Add a function to lookup a derive procedural macro. (Mappings::insert_attribute_proc_macro): Add a function to insert an attribute procedural macro. (Mappings::lookup_attribute_proc_macro): Add a function to lookup an attribute procedural macro. * util/rust-hir-map.h: Add function prototypes. * expand/rust-expand-visitor.cc (ExpandVisitor::expand_outer_attribute): Implement expansion of outer attributes. (ExpandVisitor::expand_inner_attribute): Add call for inner attribute expansion. * expand/rust-expand-visitor.h: Add new procedural macro expander attribute. * expand/rust-proc-macro.cc (load_macros_array): Add a function to load the proc macro array from a given shared object. (load_macros): Add a function to retrieve procedural macro vector from a given shared object. (ProcMacroExpander::import_proc_macros): Add a function to load procedural macros from a given extern crate name. * expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Add new proc-macro file. (class ProcMacroExpander): Add new ProcMacroExpander class. * rust-session-manager.cc (Session::expansion): Create new macro expander and feed it to the expand visitor. * util/rust-attributes.cc: Add macro_export builtin attribute. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Fix attribute collection. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.h: Make trivial visitors public. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add rust-proc-macro object to list. * expand/rust-proc-macro.cc: New file. * expand/rust-proc-macro.h: New file. 2024-01-16 Pierre-Emmanuel Patry * util/rust-attributes.cc: Add attribute to the table. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Move implementation from here... * ast/rust-ast-collector.h: ... to here. 2024-01-16 Owen Avery * Make-lang.in: Add "rust-dir-owner.o". * ast/rust-ast.cc: Include "rust-dir-owner.h". (Module::process_file_path): Handle non-mod-rs external file modules properly. * parse/rust-parse-impl.h: Include "rust-dir-owner.h". (Parser::parse_module): Handle non-mod-rs external file modules properly. * util/rust-dir-owner.cc: New file. * util/rust-dir-owner.h: New file. 2024-01-16 Owen Avery * expand/rust-macro-builtins.cc: Fix comments. (MacroBuiltin::proc_macro_builtin): Add error message. * expand/rust-macro-builtins.h: Fix comments. 2024-01-16 Philip Herron * typecheck/rust-hir-trait-resolve.cc: when the bound is concrete keep the mapping * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add missing call * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): make this the same as paths 2024-01-16 Owen Avery * util/rust-optional.h (class Optional): Add volatile field to union. 2024-01-16 Owen Avery * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_metavar): Substitute crate metavar. 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::null_denotation): Allow struct expression referencing. 2024-01-16 Charalampos Mitrodimas * ast/rust-ast-dump.cc (Dump::visit): print literals based on their type. 2024-01-16 Arthur Cohen * expand/rust-macro-builtins.cc (MacroBuiltin::dummy): New function. * expand/rust-macro-builtins.h: Declare it. 2024-01-16 Arthur Cohen * ast/rust-ast-builder.cc (AstBuilder::struct_expr_struct): New function. (AstBuilder::let): Likewise. (AstBuilder::struct_expr): Likewise. (AstBuilder::struct_expr_field): Likewise. (AstBuilder::field_access): Likewise. (AstBuilder::wildcard): Likewise. * ast/rust-ast-builder.h: Likewise. * expand/rust-derive-clone.cc (DeriveClone::visit_union): Implement properly. 2024-01-16 Arthur Cohen * Make-lang.in: Add new files. * expand/rust-derive.cc (DeriveVisitor::derive): Call into DeriveCopy. * expand/rust-derive-copy.cc: New file. * expand/rust-derive-copy.h: New file. 2024-01-16 Arthur Cohen * expand/rust-derive-clone.cc (DeriveClone::visit_struct): Implement proper cloning for structs with fields. * ast/rust-ast-builder.cc (AstBuilder::struct_expr): New function. (AstBuilder::struct_expr_field): Likewise. (AstBuilder::field_access): Likewise. (AstBuilder::let): Likewise. * ast/rust-ast-builder.h: Declare new functions. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (convert): Use a variable instead of multiple nested calls. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-lex.h: Make build_token method public. * lex/rust-token.h: Add a setter for a token location. * util/rust-token-converter.cc (convert): Add the function to convert from a Span to a Location. (from_ident): Convert Ident span to a Location. (from_literal): Convert Literal span to a Location. (from_punct): Convert Punct span to a Location. (from_group): Convert Group span to a Location. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (convert): Add implementation. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (convert): Update call to constructors with location information. (handle_suffix): Convert token locus to a Span and use it in the literal. 2024-01-16 Owen Avery * expand/rust-macro-expand.cc (MacroExpander::try_match_rule): Don't match delimiters for root matcher. (MacroExpander::match_matcher): Add option to match delimiters. * expand/rust-macro-expand.h (MacroExpander::match_matcher): Likewise. * parse/rust-parse-impl.h (Parser::skip_token): Add zero argument method. * parse/rust-parse.h: (Parser::skip_token): Likewise. 2024-01-16 Philip Herron * 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. 2024-01-16 Arthur Cohen * Make-lang.in: Add new object files to Makefile. * expand/rust-expand-visitor.cc (is_derive): Move function. (is_builtin): Likewise. (get_traits_to_derive): New function. (derive_item): Likewise. (ExpandVisitor::visit): Visit item/statements containers. (ExpandVisitor::visit_outer_attrs): Take a reference on the attribute instead of a copy. (ExpandVisitor::is_derive): Deleted function. (ExpandVisitor::is_builtin): Likewise. * expand/rust-expand-visitor.h (RUST_EXPAND_VISITOR_H): Add missing #ifdef guards. (is_derive): Declare function. (is_builtin): Likewise. * expand/rust-macro-builtins.cc (builtin_macro_from_string): Use new MacroBuiltin::builtins map. (make_macro_path_str): Likewise. * expand/rust-macro-builtins.h (enum class): Add builtin derive macros. * expand/rust-derive-clone.cc: New file. * expand/rust-derive-clone.h: New file. * expand/rust-derive.cc: New file. * expand/rust-derive.h: New file. * util/rust-hir-map.cc (Mappings::insert_macro_def): Fix logic for setting builtin macro transcribers. 2024-01-16 Arthur Cohen * ast/rust-ast-builder.cc: New file. * ast/rust-ast-builder.h: New file. 2024-01-16 Arthur Cohen * expand/rust-macro-invoc-lexer.cc: Add missing copyright header. * expand/rust-macro-substitute-ctx.cc: Likewise. 2024-01-16 Owen Avery * rust-session-manager.h: Include "rust-optional.h". (struct TargetOptions): Store values in config key/value pairs as Optional rather than std::string. * rust-session-manager.cc (TargetOptions::dump_target_options): Handle Optional values. 2024-01-16 Philip Herron * typecheck/rust-casts.cc (TypeCastRules::check): do coercion (TypeCastRules::emit_cast_error): clang-format 2024-01-16 Philip Herron * resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): add name resolution * resolve/rust-ast-resolve-stmt.h: likewise * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): insert resolved node 2024-01-16 Philip Herron * resolve/rust-ast-resolve-pattern.cc: remove unused 2024-01-16 Philip Herron * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): fix missing pop 2024-01-16 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::visit): remove unused 2024-01-16 Philip Herron * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): hir lowering (ASTLoweringStmt::visit): likewise * hir/rust-ast-lower-stmt.h: likewise 2024-01-16 Owen Avery * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_metavar): Allow substitution failure. (SubstituteCtx::substitute_token): Handle substitution failure, include dollar sign in count of tokens to substitute. (SubstituteCtx::substitute_tokens): Include dollar sign in count of tokens to substitute. * expand/rust-macro-substitute-ctx.h (SubstituteCtx::substitute_metavar): Adjust signature and document new substitution failure handling. 2024-01-16 Owen Avery * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::check_repetition_amount): Ignore single fragments while checking repetition amount. 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): stop if error * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): fix sized options * typecheck/rust-tyty.cc (BaseType::satisfies_bound): its ok if its an ?T (BaseType::bounds_compatible): likewise * typecheck/rust-tyty.h: update prototype * typecheck/rust-unify.cc (UnifyRules::go): check both sides bounds 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * 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 2024-01-16 David Malcolm * typecheck/rust-hir-trait-reference.cc (TraitItemReference::is_optional): Remove stray semicolon. 2024-01-16 Arthur Cohen * resolve/rust-early-name-resolver.cc (EarlyNameResolver::go): Cleanup order of calls when accumulating #[macro_use] macros. (EarlyNameResolver::visit): Likewise. 2024-01-16 Matthew Jasper * resolve/rust-early-name-resolver.cc (EarlyNameResolver::accumulate_escaped_macros): Remove unnecessary visit. 2024-01-16 Matthew Jasper * ast/rust-ast.cc (Attribute::check_cfg_predicate): Only check first item as a predicate. 2024-01-16 Owen Avery * util/rust-optional.h (operator==): New for Optional == Optional. 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_attr_input): Parse AttrInputMacro. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.cc (TokenCollector::visit): Propagate coretype hint. 2024-01-16 Owen Avery * util/rust-optional.h (class Optional): Improve inner state. 2024-01-16 Owen Avery * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::check_repetition_amount): Handle keywords. (SubstituteCtx::substitute_token): Likewise. * lex/rust-token.cc (Token::get_str): Likewise. * parse/rust-parse-impl.h (Parser::parse_macro_match_fragment): Likewise. 2024-01-16 Arthur Cohen * ast/rust-ast.h: Add `outer_attrs` to Item. * ast/rust-expr.h: Make use of new inheritance methods. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (dispatch_float_literals): Remove function. (handle_suffix): Rename old dispatch and add one LitKind argument. (dispatch_integer_literals): Remove function. (convert): Change call from dispatch to suffix handler. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-token.h: Implement hash for token id enumeration. * util/rust-token-converter.cc (dispatch_float_literals): Update to new internals. (dispatch_integer_literals): Likewise. (convert): Likewise. (string_literal): Remove function. (byte_string_literal): Likewise. (unsigned_literal): Likewise. (signed_literal): Likewise. (from_literal): Update with new internals. 2024-01-16 Owen Avery * ast/rust-ast-dump.cc (Dump::visit): Add AttrInputMacro visitor. * ast/rust-ast-dump.h: (Dump::visit): Likewise. * ast/rust-ast-full-decls.h (class AttrInputMacro): New. * ast/rust-ast-collector.cc (TokenCollector::visit): Add and call out to AttrInputMacro visitor. * ast/rust-ast-collector.h: (TokenCollector::visit): Add AttrInputMacro visitor. * ast/rust-ast-visitor.h: (ASTVisitor::visit): Likewise. * ast/rust-ast.cc (AttrInputMacro::accept_vis): New. (AttrInputMacro::as_string): New. (AttrInputMacro::AttrInputMacro): New. (AttrInputMacro::operator=): New. * ast/rust-ast.h: (AttrInput::AttrInputType::MACRO): New. * ast/rust-expr.h (class AttrInputMacro): New. * checks/errors/rust-feature-gate.h: (FeatureGate::visit): Add AttrInputMacro visitor. * expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise. * expand/rust-cfg-strip.h: (CfgStrip::visit): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-expand-visitor.h: (ExpandVisitor::visit): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: (ASTLoweringBase::visit): Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: (ResolverBase::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h: (EarlyNameResolver::visit): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. (check_doc_attribute): Handle AttrInputType::MACRO. * util/rust-attributes.h: (AttributeChecker::visit): Add AttrInputMacro visitor. 2024-01-16 Owen Avery * ast/rust-macro.h (MacroInvocation::clone_macro_invocation_impl): Make public. 2024-01-16 Owen Avery * util/rust-optional.h (struct std::hash>): New. 2024-01-16 Owen Avery * util/rust-optional.h (class Optional): Use pointers internally. 2024-01-16 Arthur Cohen * ast/rust-ast-dump.cc (Dump::visit): Implement dump for `TupleIndexExpr`. 2024-01-16 Owen Avery * lex/rust-token.cc (token_id_keyword_string): Return std::string reference. * lex/rust-token.h (token_id_keyword_string): Return std::string reference. 2024-01-16 Matthew Jasper * ast/rust-ast.h (Expr::as_expr_without_block): Remove. (Expr::set_outer_attrs): Make public in base class. * expand/rust-macro-expand.cc: Add fixme comment for pre-existing bug. * hir/tree/rust-hir.h: Remove Expr::as_expr_without_block. * parse/rust-parse-impl.h (Parser::parse_lifetime): Use lifetime_from_token. (Parser::lifetime_from_token): New method. (Parser::null_denotation): Handle labelled loop expressions and for loop expressions. (Parser::parse_loop_label): Make initial token a parameter. (Parser::parse_labelled_loop_expr): Likewise. (Parser::parse_for_loop_expr): Allow FOR token to already be skipped. (Parser::parse_expr): Handle expr_can_be_stmt. (Parser::parse_expr_with_block): Remove. (Parser::parse_expr_stmt_with_block): Remove. (Parser::parse_expr_stmt_without_block): Remove. (Parser::parse_expr_without_block): Remove. (Parser::parse_stmt_or_expr_with_block): Remove. (Parser::parse_expr_stmt): Use parse_expr directly. (Parser::parse_match_expr): Likewise. (Parser::parse_stmt): Use parse_expr_stmt in more cases. (Parser::parse_stmt_or_expr): Rename from parse_stmt_or_expr_without_block, use parse_expr directly. (Parser::parse_block_expr): Update error message. * parse/rust-parse.h: Update declarations. 2024-01-16 Matthew Jasper * ast/rust-ast-full-decls.h (class ExprStmtWithoutBlock): Remove. (class ExprStmtWithBlock): Remove. * ast/rust-stmt.h (class ExprStmtWithoutBlock): Remove. (class ExprStmtWithBlock): Remove. (class ExprStmt): Make non-abstract, add common functionality from removed base classes. * ast/rust-ast.h: Move to_stmt to base class. * ast/rust-ast.cc (ExprStmtWithBlock::as_string): Remove. * ast/rust-macro.h: Use new signature for to_stmt. (ExprStmt::as_string): New method. (ExprStmtWithoutBlock::as_string): Remove. (BlockExpr::strip_tail_expr): Update for removed classes. (ExprStmtWithoutBlock::accept_vis): Remove. (ExprStmtWithBlock::accept_vis): Remove. (ExprStmt::accept_vis): New method. * ast/rust-ast-dump.cc (Dump::visit): Update for removed classes. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-collector.cc (TokenStream::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-expand-visitor.h: Likewise. * expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise. * expand/rust-cfg-strip.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise. * hir/rust-ast-lower-stmt.h: Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h: Likewise. * parse/rust-parse-impl.h (Parser::parse_match_expr): Likewise. (Parser::parse_stmt_or_expr_without_block): Likewise. * parse/rust-parse.h: Likewise. 2024-01-16 Owen Avery * lex/rust-token.cc (token_id_is_keyword): New. (token_id_keyword_string): New. * lex/rust-token.h (token_id_is_keyword): New. (token_id_keyword_string): New. * expand/rust-macro-expand.cc (MacroExpander::match_fragment): Match keywords for ident fragment. * parse/rust-parse-impl.h (Parser::parse_identifier_or_keyword_token): Add. * parse/rust-parse.h (Parser::parse_identifier_or_keyword_token): Add. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (dispatch_float_literals): Invert suffix condition. (dispatch_integer_literals): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (convert): Fix style. (from_ident): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (dispatch_float_literals): Make input immutable. (dispatch_integer_literals): Likewise. (convert): Likewise. * util/rust-token-converter.h (convert): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_tokenstream): Add conversion of Ident structures. (from_ident): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_literal): Add function implementation. (string_literal): String literal specific handler. (byte_string_literal): Byte string specific handler. (unsigned_literal): Unsigned literal specific handler. (signed_literal): Signed literal specific handler. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_punct): Add conversion implementation. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (dispatch_float_literals): Accept const_TokenPtr instead of TokenPtr. (dispatch_integer_literals): Likewise. (convert): Accept vector of const_TokenPtr instead of a vector of TokenPtr. * util/rust-token-converter.h (convert): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_tokenstream): Add vector for joined punct accumulation. (from_ident): Accept const pointer vector. (from_literal): Likewise. (from_punct): Likewise. (from_group): Likewise. (from_tokentree): Likewise. (convert): Likewise. * util/rust-token-converter.h (convert): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_tokenstream): Add call to from_tokentree. (from_tokentree): Add implementation, from the from_tokenstream function. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (from_punct): Add group conversion. (from_group): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (to_tokenstream): Change function name from to_tokenstream to convert. (convert): Likewise. (from_tokenstream): Add tokenstream handler. (from_ident): Add empty function. (from_literal): Likewise. (from_punct): Likewise. (from_group): Likewise. * util/rust-token-converter.h (to_tokenstream): Change function name from to_tokenstream to convert. (convert): Likewise. 2024-01-16 Pierre-Emmanuel Patry * util/rust-token-converter.cc (dispatch_float_literals): Remove suffixed temporary variable. (dispatch_integer_literals): Likewise. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add new rust-token-converter file. * ast/rust-ast-collector.cc (pop_group): Function moved from TokenCollector. (dispatch_float_literals): Likewise. (dispatch_integer_literals): Likewise. (TokenCollector::collect): Removed function. * ast/rust-ast-collector.h: Removed function prototype. * util/rust-token-converter.cc: New file. * util/rust-token-converter.h: New file. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-collector.h (RUST_AST_TOKENSTREAM_H): Rename headerguard from RUST_AST_TOKENSTREAM_H ... (RUST_AST_COLLECTOR_H): ... to RUST_AST_COLLECTOR_H. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Change file name. * ast/rust-ast-tokenstream.cc: Moved to... * ast/rust-ast-collector.cc: ...here. * ast/rust-ast-tokenstream.h: Moved to... * ast/rust-ast-collector.h: ...here. * rust-session-manager.cc: Change header name. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::TokenStream): Rename TokenStream to TokenCollector. (TokenCollector::TokenCollector): Likewise. (TokenStream::collect_tokens): Likewise. (TokenCollector::collect_tokens): Likewise. (TokenStream::collect): Likewise. (TokenCollector::collect): Likewise. (TokenStream::visit): Likewise. (TokenCollector::visit): Likewise. (TokenStream::visit_items_joined_by_separator): Likewise. (TokenCollector::visit_items_joined_by_separator): Likewise. (TokenStream::visit_as_line): Likewise. (TokenCollector::visit_as_line): Likewise. (TokenStream::visit_items_as_lines): Likewise. (TokenCollector::visit_items_as_lines): Likewise. (TokenStream::visit_items_as_block): Likewise. (TokenCollector::visit_items_as_block): Likewise. (TokenStream::trailing_comma): Likewise. (TokenCollector::trailing_comma): Likewise. (TokenStream::newline): Likewise. (TokenCollector::newline): Likewise. (TokenStream::indentation): Likewise. (TokenCollector::indentation): Likewise. (TokenStream::increment_indentation): Likewise. (TokenCollector::increment_indentation): Likewise. (TokenStream::decrement_indentation): Likewise. (TokenCollector::decrement_indentation): Likewise. (TokenStream::visit_closure_common): Likewise. (TokenCollector::visit_closure_common): Likewise. (TokenStream::visit_loop_common): Likewise. (TokenCollector::visit_loop_common): Likewise. (TokenStream::visit_function_common): Likewise. (TokenCollector::visit_function_common): Likewise. * ast/rust-ast-tokenstream.h (class TokenStream): Likewise. (class TokenCollector): Likewise. * rust-session-manager.cc (Session::dump_tokenstream): Rename token vector for clearer intent. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (dispatch_float_literals): Add dispatch function for floating point literals. (TokenStream::collect): Add call to dispatcher. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (dispatch_integer_literals): Add a static function to dispatch depending on the core type. (TokenStream::collect): Add call to dispatch function. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::collect): Add conversion for byte string and string. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::collect): Add Ident conversion. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::collect): Add joint punct token conversion. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::collect): Add conversion for single punctuation tokens. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (pop_group): Add a function to easily collect a group from a given stack at the end of it. (TokenStream::collect): Collect tokens as a rust compatible Tokenstream type. * ast/rust-ast-tokenstream.h (RUST_AST_TOKENSTREAM_H): Move includes to stay constrained by guards. 2024-01-16 M V V S Manoj Kumar * ast/rust-ast-full-decls.h (enum class): Added declaration. (struct AnonConst): Added declaration. (struct InlineAsmRegOrRegClass): Added declaration. (struct InlineAsmOperand): Added declaration. (struct InlineAsmPlaceHolder): Added declaration. (struct InlineAsmTemplatePiece): Added declaration. (struct TupleClobber): Added declaration. (struct TupleTemplateStr): Added declaration. * ast/rust-expr.h (class InlineAsm): Defined all it's data members outside. (enum class InlineAsmOptions): Converted this to a enum class so we could use it in the HIR. (struct AnonConst): Defined it independent of the AST::InlineAsm node. (struct InlineAsmRegOrRegClass): Defined it independent of the AST::InlineAsm node. (struct InlineAsmOperand): Defined it independent of the AST::InlineAsm node. (struct InlineAsmPlaceHolder): Defined it independent of the AST::InlineAsm node. (struct InlineAsmTemplatePiece): Defined it independent of the AST::InlineAsm node. (struct TupleClobber): Defined it independent of the AST::InlineAsm node. (struct TupleTemplateStr): Defined it independent of the AST::InlineAsm node. * hir/tree/rust-hir-expr.h (class InlineAsmReg): Added defination. (class InlineAsmRegClass): Added defination. (struct InlineAsmRegOrRegClass): Added defination. (class InlineAsm): Added defination. * hir/tree/rust-hir-full-decls.h (class InlineAsmReg): Added declaration. (class InlineAsmRegClass): Added declaration. (struct InlineAsmRegOrRegClass): Added declaration. (class InlineAsm): Added declaration. 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * backend/rust-compile-base.cc (HIRCompileBase::compile_function_body): add missing coercion_site codegen 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * backend/rust-compile-type.cc (TyTyResolveCompile::visit): add filter 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * checks/lints/rust-lint-unused-var.cc (UnusedVariables::Lint): use the decl not the expr 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_trait_impl_function_or_method): Parse function/method qualifiers after "default". 2024-01-16 Philip Herron * backend/rust-compile-base.cc: add missing compile_locals call 2024-01-16 Arthur Cohen * ast/rust-ast.h (class AttrInputMetaItemContainer): Run clang-format. (class DelimTokenTree): Likewise. 2024-01-16 Arthur Cohen * resolve/rust-early-name-resolver.cc (is_macro_use_module): New function. (EarlyNameResolver::accumulate_escaped_macros): New function. (EarlyNameResolver::go): Use `accumulate_escaped_macros`. (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h: Declare `accumulate_escaped_macros`. 2024-01-16 Arthur Cohen * ast/rust-ast.h: Add take_items() and set_items() method to Crate. * ast/rust-item.h: Add take_items() and set_items() method to Module. 2024-01-16 Arthur Cohen * ast/rust-ast.h (enum Kind): Add MODULE variant. * ast/rust-item.h: Return Kind::MODULE in AST::Module::get_kind(). 2024-01-16 Arthur Cohen * ast/rust-macro.cc (builtin_macro_from_string): Move function. * ast/rust-macro.h (enum class): Move enum. (builtin_macro_from_string): Move function. * expand/rust-macro-builtins.cc (builtin_macro_from_string): New function. (make_macro_path_str): Use new bi-map. (parse_single_string_literal): Use new `BuiltinMacro` enum. (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::include_handler): Likewise. (MacroBuiltin::sorry): New function. * expand/rust-macro-builtins.h (enum class): Move enum here. (builtin_macro_from_string): New function declaration. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Use new function. * util/rust-hir-map.cc (Mappings::insert_macro_def): Remove old builtin macro map. 2024-01-16 Arthur Cohen * expand/rust-macro-builtins.cc: Include bidirectional map. * util/bi-map.h: New file. 2024-01-16 Owen Avery * ast/rust-ast.cc (BlockExpr::strip_tail_expr): Try to take new tail expression from statements list. * ast/rust-expr.h (BlockExpr::strip_tail_expr): Replace definition with only declaration. 2024-01-16 Owen Avery * ast/rust-ast.h (Stmt::is_expr): New. * ast/rust-stmt.h (ExprStmt::is_expr): New. 2024-01-16 Owen Avery * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_repetition): Fix out-of-bounds. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Link against the static libproc_macro. 2024-01-16 Pierre-Emmanuel Patry * lang.opt: Add frust-extern option. * rust-session-manager.cc (Session::handle_extern_option): Add frust-extern option handler. * rust-session-manager.h (struct Session): Add an unordered map to store library name and locations. 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_generic_params): Handle parameter parsing error. 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-expr.cc: update for op overload 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): use the predicate (TypeCheckExpr::resolve_segments): cleanup 2024-01-16 Philip Herron * typecheck/rust-hir-trait-reference.cc (AssociatedImplTrait::AssociatedImplTrait): bind the predicate (AssociatedImplTrait::get_trait): remove (AssociatedImplTrait::get_predicate): new getter * typecheck/rust-hir-trait-reference.h: bind predicate * typecheck/rust-hir-type-check-item.cc: update ctor * typecheck/rust-type-util.cc (lookup_associated_impl_block): new function * typecheck/rust-type-util.h (class BaseType): remove unused forward decl (lookup_associated_impl_block): new helper * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::is_equal): new * typecheck/rust-tyty-subst.cc (SubstitutionRef::lookup_associated_impl): use new helper (SubstitutionRef::monomorphize): update usage/error handling * typecheck/rust-tyty-subst.h: remove old prototype * typecheck/rust-tyty.h: add is_equal decl 2024-01-16 Owen Avery * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Type check StructPatternFieldIdentPat. 2024-01-16 Owen Avery * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Lower StructPatternFieldIdentPat. 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_fn_trait_call): return the assoicated predicate * typecheck/rust-hir-type-check-expr.h: update prototype 2024-01-16 Philip Herron * hir/rust-ast-lower-implitem.h: add missing where clause lowering 2024-01-16 Philip Herron * hir/tree/rust-hir-item.h: add get_locus() const 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (StructPatternFieldIdentPat::get_identifier): New. (StructPatternFieldIdentPat::get_pattern): New. 2024-01-16 Marc Poulhiès * ast/rust-ast-dump.cc (Dump::visit): print parentheses around unique expression operand. 2024-01-16 Owen Avery * rust-session-manager.cc (Session::enable_dump): Fix error messages. 2024-01-16 Philip Herron * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method (UnifyRules::expect_fndef): add ABI check * typecheck/rust-unify.h: prototype for new error method 2024-01-16 Philip Herron * util/rust-abi.cc (get_abi_from_string): add ABI mapping 2024-01-16 Philip Herron * hir/tree/rust-hir-pattern.h: add missing get_mutability * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): use new ClosureParamInfer on untyped parameters * typecheck/rust-hir-type-check-pattern.cc (ClosureParamInfer::Resolve): interface (ClosureParamInfer::ClosureParamInfer): constructor (ClosureParamInfer::visit): visitors for each pattern * typecheck/rust-hir-type-check-pattern.h (class ClosureParamInfer): new visitor 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-pattern.h: cleanup 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): return so we dont hit undefined behaviour 2024-01-16 Philip Herron * backend/rust-compile-implitem.h: remove includes 2024-01-16 Philip Herron * backend/rust-compile-item.cc (CompileItem::visit): remove bad checks 2024-01-16 Philip Herron * lang.opt: add lang option flag * rust-lang.cc (grs_langhook_init_options_struct): enable by default 2024-01-16 Philip Herron * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::operator=): we are done if other is in an error state 2024-01-16 Philip Herron * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): verify it is a method 2024-01-16 Philip Herron * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): use new interface * typecheck/rust-hir-type-check-base.h: update prototype to include Self * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): lifewise * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::resolve_impl_block_substitutions): likewise * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): likewise (TypeCheckExpr::resolve_segments): likewise * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise (TypeResolveGenericParam::visit): likewise (ResolveWhereClauseItem::visit): likewise * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): likewise (TypeBoundPredicate::apply_generic_arguments): likewise (TypeBoundsMappings::lookup_predicate): likewise * typecheck/rust-tyty-bounds.h: likewise * typecheck/rust-tyty.h:likewise 2024-01-16 Philip Herron * typecheck/rust-hir-type-check.h: New error state and missing copy implementations * typecheck/rust-typecheck-context.cc (TypeCheckContextItem::TypeCheckContextItem): missing copy ctor (TypeCheckContextItem::operator=): missing copy implementation (TypeCheckContextItem::get_error): new static function (TypeCheckContextItem::is_error): new method (TypeCheckContextItem::get_context_type): handle error state (TypeCheckContextItem::get_defid): handle error state 2024-01-16 Philip Herron * typecheck/rust-hir-type-check.h: new helper * typecheck/rust-typecheck-context.cc (TypeCheckContext::have_function_context): implementation 2024-01-16 Philip Herron * typecheck/rust-hir-type-check.h: Add prototype * typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_defid): implementation 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-expr.cc: refactor 2024-01-16 Philip Herron * typecheck/rust-autoderef.cc: don't take a reference * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise * typecheck/rust-hir-type-check.h: remove reference * typecheck/rust-typecheck-context.cc (TypeCheckContext::pop_return_type): likewise 2024-01-16 Owen Avery * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Handle StructPatternFieldIdentPat. 2024-01-16 TieWay59 PR translation/108890 * lang.opt: Fix translation mistakes 2023 in GCC/Rust [PR108890] (line 67): change the inconsistent tab to spaces (line 75): wrap bare placeholder `integer` (line 79): remove redundant text of `Choose which` (line 96): remove redundant text of `Choose which` (line 112): remove redundant `Flag to` (line 124): correct the exclusive term `When to stop` (line 124): correct typo of `copimlation` 2024-01-16 M V V S Manoj Kumar * parse/rust-parse-impl.h (Parser::debug_dump_ast_output): Removed this funtion. * rust-session-manager.cc (Session::enable_dump): Removed else if (arg == "parse"). (Session::compile_crate): Removed calls of dump_ast and dump_ast_expanded. (Session::dump_ast): Removed this function. (Session::dump_ast_expanded): Removed this function. * rust-session-manager.h (struct CompileOptions): Removed the PARSER_AST_DUMP option. 2024-01-16 Arthur Cohen * parse/rust-parse-impl.h (Parser::parse_reference_pattern): Do not call into `parse_pattern` anymore. 2024-01-16 Owen Avery * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate): Add is_let_top_level parameter. (ASTLoweringPattern::visit): Handle is_let_top_level. * hir/rust-ast-lower-pattern.h (class ASTLoweringPattern): Add is_let_top_level. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Set is_let_top_level. 2024-01-16 Zheyuan Chen * ast/rust-ast-dump.cc: fix bad formatting for associated type. 2024-01-16 Sergey Bugaev * hir/rust-ast-lower-expr.h, hir/rust-ast-lower-expr.cc: Lower AST::ErrorPropagationExpr to HIR::ErrorPropagationExpr 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix scope resolution token output. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Keep associated type. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit_function_common): Fix function body output. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_outer_attribute): Fix attribute status. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-token.cc (Token::as_string): Fix lifetime string representation. 2024-01-16 Sergey Bugaev * resolve/rust-ast-resolve-expr.cc: Add "break rust" Easter egg 2024-01-16 Sergey Bugaev * resolve/rust-ast-resolve-expr.h, resolve/rust-ast-resolve-expr.cc: Add ResolveExpr::funny_error 2024-01-16 Sergey Bugaev * ast/rust-ast.h: Add AST::Kind::IDENTIFIER 2024-01-16 Sergey Bugaev * ast/rust-ast.h (Kind): Convert into a C++ enum class * expand/rust-macro-builtins.cc: Adapt to the change 2024-01-16 Owen Avery * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add implementation for IfLetExprConseqElse. * typecheck/rust-hir-type-check-expr.h: (TypeCheckExpr::visit): Remove stub implementation for IfLetExprConseqElse. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Lower IfLetExpr{,ConseqElse}. * hir/rust-ast-lower-expr.h: (ASTLoweringExpr::visit): Likewise. * hir/rust-ast-lower-block.h (ASTLoweringIfLetBlock::visit): Lower IfLetExprConseqElse. (ASTLoweringExprWithBlock::visit): Likewise. * hir/rust-ast-lower.cc (ASTLoweringIfLetBlock::visit): Lower IfLetExprConseqElse. * hir/tree/rust-hir-expr.h (IfLetExprConseqElse::IfLetExprConseqElse): Make constructor more general. (IfLetExprConseqElse::vis_else_block): Add. (IfLetExprConseqElse::get_else_block): Add. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add IfLetExprConseqElse visitor. * resolve/rust-ast-resolve-expr.h (ResolveExpr::visit): Add IfLetExprConseqElse visitor. 2024-01-16 Sebastian Kirmayer * parse/rust-parse-impl.h (Parser::parse_macro_match_repetition): reject separator in `?` repetition 2024-01-16 Owen Avery * ast/rust-expr.h (class IfLetExprConseqElse): Make else_block ExprWithBlock. (class IfLetExprConseqIf): Remove. (class IfLetExprConseqIfLet): Remove. * ast/rust-ast-full-decls.h (class IfLetExprConseqIf): Remove. (class IfLetExprConseqIfLet): Remove. * ast/rust-ast.cc (IfLetExprConseqElse::as_string): Adjust output. (IfLetExprConseqIf::as_string): Remove. (IfLetExprConseqIfLet::as_string): Remove. (IfLetExprConseqIf::accept_vis): Remove. (IfLetExprConseqIfLet::accept_vis): Remove. * ast/rust-ast-visitor.h (ASTVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors. * ast/rust-ast-dump.cc (Dump::visit): Likewise. * ast/rust-ast-dump.h: (Dump::visit): Likewise. * ast/rust-ast-tokenstream.cc (TokenStream::visit): Likewise. * ast/rust-ast-tokenstream.h (TokenStream::visit): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h: (AttributeChecker::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h (EarlyNameResolver::visit): Likewise. * resolve/rust-ast-resolve-base.h (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * checks/errors/rust-feature-gate.h (FeatureGate::visit): Likewise. * expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise. * expand/rust-cfg-strip.h: (CfgStrip::visit): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-expand-visitor.h (ExpandVisitor::visit): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: (ASTLoweringBase::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_if_let_expr): Replace IfLetExprConseqIf{,Let} with IfLetExprConseqElse. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add struct name and curly braces to output tokenstream. 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_macro_match): Handle underscore. 2024-01-16 Owen Avery * hir/tree/rust-hir-full-decls.h (class ExprStmtWithoutBlock): Remove. (class ExprStmtWithBlock): Remove. * hir/tree/rust-hir-stmt.h (class ExprStmt): Add remaining ExprStmtWith{,out}Block functionality. (class ExprStmtWithoutBlock): Remove. (class ExprStmtWithBlock): Remove. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Lower to HIR::ExprStmt instead of deriving class. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * hir/tree/rust-hir-stmt.h (ExprStmt::expr): Add field. (ExprStmt::get_expr): Add method. (ExprStmt::ExprStmt): Add copy/move constructors, modify existing constructor. (ExprStmt::operator=): Add assignment operator. (ExprStmtWithoutBlock::expr): Remove field. (ExprStmtWithoutBlock::get_expr): Remove method. (ExprStmtWithoutBlock::ExprStmt): Remove copy/move constructors, modify existing constructor. (ExprStmtWithoutBlock::operator=): Remove assignment operator. (ExprStmtWithBlock::expr): Remove field. (ExprStmtWithBlock::get_expr): Remove method. (ExprStmtWithBlock::ExprStmt): Remove copy/move constructors, modify existing constructor. (ExprStmtWithBlock::operator=): Remove assignment operator. (ExprStmt::as_string): Add method. (ExprStmtWithBlock::as_string): Remove method. (ExprStmtWithoutBlock::as_string): Remove method. * hir/tree/rust-hir.cc (ExprStmt::as_string): Add method. (ExprStmtWithBlock::as_string): Remove method. (ExprStmtWithoutBlock::as_string): Remove method. 2024-01-16 Owen Avery * ast/rust-expr.h (class IfExprConseqElse): Make else_block ExprWithBlock. (class IfExprConseqIf): Remove. (class IfExprConseqIfLet): Remove. * ast/rust-ast-full-decls.h (class IfExprConseqIf): Remove. (class IfExprConseqIfLet): Remove. * ast/rust-ast.cc (IfExprConseqElse::as_string): Adjust output. (IfExprConseqIf::as_string): Remove. (IfExprConseqIfLet::as_string): Remove. (IfExprConseqIf::accept_vis): Remove. (IfExprConseqIfLet::accept_vis): Remove. * ast/rust-ast-visitor.h (ASTVisitor::visit): Remove IfExprConseqIf{,Let} visitors. * ast/rust-ast-tokenstream.cc (TokenStream::visit): Likewise. * ast/rust-ast-tokenstream.h (TokenStream::visit): Likewise. * ast/rust-ast-dump.cc (Dump::visit): Likewise. * ast/rust-ast-dump.h (Dump::visit): Likewise. * checks/errors/rust-feature-gate.h (FeatureGate::visit): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h (AttributeChecker::visit): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h (EarlyNameResolver::visit): Likewise. * resolve/rust-ast-resolve-base.h (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-expr.h (ResolveExpr::visit): Remove IfExprConseqIf visitor. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise. * expand/rust-cfg-strip.cc (CfgStrip::visit): Remove IfExprConseqIf{,Let} visitors. * expand/rust-cfg-strip.h (CfgStrip::visit): Likewise. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-expand-visitor.h (ExpandVisitor::visit): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-block.h (ASTLoweringIfBlock::visit): Remove IfExprConseqIf visitor. (ASTLoweringExprWithBlock::visit): Likewise. * hir/rust-ast-lower.cc (ASTLoweringIfBlock::visit): Remove IfExprConseqIf visitor, adjust IfExprConseqElse lowering. * hir/rust-ast-lower-expr.h (ASTLoweringExpr::visit): Remove IfExprConseqIf visitor. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise. * parse/rust-parse-impl.h (Parser::parse_if_expr): Replace IfExprConseqIf{,Let} with IfExprConseqElse. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix inner attribute tokenstream output. 2024-01-16 Marc Poulhiès * ast/rust-ast-dump.cc (Dump::debug): New. * ast/rust-ast-dump.h (Dump::debug): Untemplate it. (debug): New. * ast/rust-ast.h (class Visitable): New. (class TokenTree): Inherit from Visitable. (class MacroMatch): Likewise. (class AttrInput): Likewise. (class MetaItemInner): Likewise. (class Pattern): Likewise. (classTypeParamBound): Likewise. (class GenericParam): Likewise. (class TraitItem): Likewise. (classInherentImplItem): Likewise. (class TraitImplItem): Likewise. (class ExternalItem): Likewise. (class SingleASTNode): Likewise. 2024-01-16 Thomas Schwinge * rust-lang.cc (grs_langhook_type_for_mode): Placate clang-format. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add boolean for differenciation. * parse/rust-parse-impl.h (Parser::parse_doc_comment): Change function interface to make code cleaner. It should return a body instead of the whole attribute. (Parser::parse_inner_attribute): Specify the inner status of the node. (Parser::parse_attribute_body): Change function interface to make the code cleaner much like parse_doc_comment. (Parser::parse_outer_attribute): Specify outer status of the node. * parse/rust-parse.h: Update functions prototypes. 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * typecheck/rust-hir-path-probe.cc: dont subst with a dynamic object 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): remove unused 2024-01-16 Philip Herron * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): call destructure 2024-01-16 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): call path probe impl trait 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Add call to attribute expansion function. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::visit_outer_attrs): Change condition order. (ExpandVisitor::visit_inner_using_attrs): Likewise. (ExpandVisitor::visit_attrs_with_derive): Likewise. (ExpandVisitor::is_builtin): Add builtin identification function. * expand/rust-expand-visitor.h: Add function prototype. * util/rust-attributes.cc: Add missing rustc_builtin_macro attribute. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::expand_struct_fields): Add call to expand structu fields. (ExpandVisitor::expand_function_params): Add call to expand function parameters. (ExpandVisitor::expand_closure_params): Add call to expand closure parameters. (ExpandVisitor::visit): Add calls for item outer attribute expansions. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::expand_outer_attribute): Stub for a single attribute expansion. (ExpandVisitor::visit_outer_attrs): Visit the attributes to expand on a given item. * expand/rust-expand-visitor.h: Add function prototypes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast.h: Add getter to Expr class. * ast/rust-expr.h: Add override attribute to existing getters. Also implement it for RangeExpr, attempting to retrieve outer attributes on those types will crash the compiler. * ast/rust-macro.h: Add override attribute to existing getters. * ast/rust-path.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Add call to inner attribute stub. (ExpandVisitor::expand_inner_attribute): Expand one single attribute. (ExpandVisitor::visit_inner_using_attrs): Expand a given item using a vector of attributes. (ExpandVisitor::visit_inner_attrs): Visit inner attributes of a given item. * expand/rust-expand-visitor.h: Add function prototypes. 2024-01-16 Pierre-Emmanuel Patry * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Add call to derive expander. (ExpandVisitor::expand_derive): Expand a single derive. (ExpandVisitor::visit_attrs_with_derive): Visit an item with derive attributes. (ExpandVisitor::is_derive): Identify a derive attribute. * expand/rust-expand-visitor.h: Add function prototypes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix ICE. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Remove default separator. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Visit inner attributes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Change token type. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix existing and implement remaining attribute visitors. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor to the union's outer attributes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add call to inner attribute visitor. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix ICE. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Make comma mandatory. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Remove additional semicolon output. * ast/rust-ast-tokenstream.h: Change block visitor prototype with a default value for trailing tokens. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add two new files to the list of sources. * ast/rust-ast-full.h: Add new ast formatting header. * ast/rust-ast.cc (enum indent_mode): Move formatting function to it's own file. (indent_spaces): Likewise. (get_string_in_delims): Likewise. (enum AttrMode): Likewise. (get_mode_dump_desc): Likewise. (append_attributes): Likewise. (unquote_string): Likewise. (GroupedExpr::as_string): Move pattern implementation to it's own file. (RangePattern::as_string): Likewise. (RangePatternBoundLiteral::as_string): Likewise. (SlicePattern::as_string): Likewise. (AltPattern::as_string): Likewise. (TuplePatternItemsMultiple::as_string): Likewise. (TuplePatternItemsRanged::as_string): Likewise. (TuplePattern::as_string): Likewise. (StructPatternField::as_string): Likewise. (StructPatternFieldIdent::as_string): Likewise. (StructPatternFieldTuplePat::as_string): Likewise. (StructPatternFieldIdentPat::as_string): Likewise. (StructPatternElements::as_string): Likewise. (StructPattern::as_string): Likewise. (LiteralPattern::as_string): Likewise. (ReferencePattern::as_string): Likewise. (IdentifierPattern::as_string): Likewise. (TupleStructItemsNoRange::as_string): Likewise. (TupleStructItemsRange::as_string): Likewise. (TupleStructPattern::as_string): Likewise. (GroupedExpr::accept_vis): Likewise. (LiteralPattern::accept_vis): Likewise. (IdentifierPattern::accept_vis): Likewise. (WildcardPattern::accept_vis): Likewise. (RestPattern::accept_vis): Likewise. (RangePatternBoundLiteral::accept_vis): Likewise. (RangePatternBoundPath::accept_vis): Likewise. (RangePatternBoundQualPath::accept_vis): Likewise. (RangePattern::accept_vis): Likewise. (ReferencePattern::accept_vis): Likewise. (StructPatternFieldTuplePat::accept_vis): Likewise. (StructPatternFieldIdentPat::accept_vis): Likewise. (StructPatternFieldIdent::accept_vis): Likewise. (StructPattern::accept_vis): Likewise. (TupleStructItemsNoRange::accept_vis): Likewise. (TupleStructItemsRange::accept_vis): Likewise. (TupleStructPattern::accept_vis): Likewise. (TuplePatternItemsMultiple::accept_vis): Likewise. (TuplePatternItemsRanged::accept_vis): Likewise. (TuplePattern::accept_vis): Likewise. (GroupedPattern::accept_vis): Likewise. (SlicePattern::accept_vis): Likewise. (AltPattern::accept_vis): Likewise. * ast/rust-ast-formatting.cc: New file. * ast/rust-ast-formatting.h: New file. * ast/rust-pattern.cc: New file. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add new file for rust-path implementation. * ast/rust-ast.cc (PathInExpression::as_string): Move function to the new file. (PathPattern::as_string): Likewise. (QualifiedPathInExpression::as_string): Likewise. (ConstGenericParam::as_string): Likewise. (QualifiedPathInType::as_string): Likewise. (TypePath::as_string): Likewise. (PathPattern::convert_to_simple_path): Likewise. (TypePath::as_simple_path): Likewise. (PathExprSegment::as_string): Likewise. (GenericArgs::as_string): Likewise. (GenericArgsBinding::as_string): Likewise. (TypePath::to_trait_bound): Likewise. (TypePathSegmentGeneric::as_string): Likewise. (TypePathFunction::as_string): Likewise. (TypePathSegmentFunction::as_string): Likewise. (ConstGenericParam::accept_vis): Likewise. (PathInExpression::accept_vis): Likewise. (TypePathSegment::accept_vis): Likewise. (TypePathSegmentGeneric::accept_vis): Likewise. (TypePathSegmentFunction::accept_vis): Likewise. (TypePath::accept_vis): Likewise. (QualifiedPathInExpression::accept_vis): Likewise. (QualifiedPathInType::accept_vis): Likewise. (GenericArg::disambiguate_to_const): Likewise. (GenericArg::disambiguate_to_type): Likewise. * ast/rust-path.cc: New file. 2024-01-16 Philip Herron * backend/rust-compile-item.cc (CompileItem::visit): unwrap the constant expression 2024-01-16 Owen Avery * util/rust-lang-item.h (RustLangItem::ItemType::FN): Add. (RustLangItem::ItemType::FN_MUT): Add. (RustLangItem::Parse): Handle FN and FN_MUT. (RustLangItem::ToString): Handle FN and FN_MUT. 2024-01-16 Emanuele Micheletti * typecheck/rust-casts.cc (TypeCastRules::cast_rules): case INTEGRAL handles TypeKind::CHAR 2024-01-16 Philip Herron * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): add check for reference marker and type's in self params (ResolveItem::visit): likewise * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): remove bad generics check (TypeCheckExpr::resolve_segments): likewise * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): likewise 2024-01-16 Philip Herron * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): add name resolution self param (ResolveItem::visit): likewise 2024-01-16 Philip Herron * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): this is an empty (TypeBoundPredicate::operator=): likewise * typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::empty): new interface (SubstitutionArgumentMappings::is_error): this marks it as an error * typecheck/rust-tyty-subst.h: update prototypes 2024-01-16 Philip Herron * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy): allow error types to be permissive 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit_items_as_lines): Handle trailing chars. (TokenStream::visit_items_as_block): Likewise. (TokenStream::visit): Fix visitor. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-token.cc (Token::as_string): Add type hint output. 2024-01-16 Pierre-Emmanuel Patry * rust-session-manager.cc (Session::enable_dump): Enable new dump. (Session::compile_crate): CLI argument parsing. (Session::dump_tokenstream): Dump the tokenstream as a string in the specified file. * rust-session-manager.h (struct CompileOptions): Add tokenstream dump option. 2024-01-16 Pierre-Emmanuel Patry * lex/rust-token.cc (Token::as_string): Add as_string implementation. * lex/rust-token.h: Add as_string prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::TokenStream): Add constructor. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::collect_tokens): Add getter. (TokenStream::go): Rename function. (TokenStream::visit): Likewise. * ast/rust-ast-tokenstream.h: Add collect prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Change getter name. * ast/rust-ast.cc (SimplePath::as_string): Change attribute name. * ast/rust-ast.h (class SimplePath): Refactor attribute name and change getter name. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit_as_line): Add formatting calls. (TokenStream::visit_items_as_block): Likewise. (TokenStream::newline): Add stub. (TokenStream::indentation): Add stub. (TokenStream::increment_indentation): Add stub. (TokenStream::decrement_indentation): Add stub. (TokenStream::visit): Add formatting calls. (TokenStream::visit_function_common): Likewise. * ast/rust-ast-tokenstream.h: Add stub prototypes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor implementation. * ast/rust-ast-tokenstream.h: Add additional function prototype. * ast/rust-item.h: Add some getters. * ast/rust-macro.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor. * ast/rust-item.h: Add missing getters. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitors. (TokenStream::visit_closure_common): Merge common code for closure visitors. * ast/rust-ast-tokenstream.h: Add function prototype. * ast/rust-expr.h: Add missing move attribute getter. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitors. (TokenStream::visit_loop_common): Merge common loop code. * ast/rust-ast-tokenstream.h: Add function prototypes. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Implement visitor. * ast/rust-ast-tokenstream.h: Add function prototype for missing component. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::trailing_comma): Output a trailing comma to the token stream according to the configuration. * ast/rust-ast-tokenstream.h: Add function prototype. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Implement visitors. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-tokenstream.cc (TokenStream::visit): Implement visitors. * ast/rust-ast-tokenstream.h: Add function prototypes. * ast/rust-ast.h: Add missing getters. * ast/rust-expr.h: Likewise. 2024-01-16 Pierre-Emmanuel Patry * Make-lang.in: Add rust-as-tokenstream to compile list. * ast/rust-item.h: Add missing getter for location. * ast/rust-ast-tokenstream.cc: Add ast visitor implementation. * ast/rust-ast-tokenstream.h: New file. * ast/rust-pattern.h: Add getter. 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Add implicit unit type as the return type when not specified 2024-01-16 Philip Herron * util/rust-attributes.cc: Add stable to the table of known attributes 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): return early on bad type * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::TypeCheckPattern): remove assertion in favor of check (TypeCheckPattern::visit): likewise 2024-01-16 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): when its not a block we dont have any ribs to generate locals from 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_expr_without_block): Remove direct array expression handling. 2024-01-16 Arthur Cohen * ast/rust-item.h: Fix `Visibility::has_path()` implementation. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::resolve_module_path): Check if we are dealing with pub(crate) properly. 2024-01-16 Arthur Cohen * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Set resolved_node_id when visiting root segment of SimplePath. 2024-01-16 Arthur Cohen * ast/rust-ast.h: Call SimplePath constructor differently in SimplePath::from_str 2024-01-16 Arthur Cohen * hir/rust-ast-lower-type.h: Move all remaining definitions to source file. * hir/rust-ast-lower-type.cc (ASTLoweringType::translate): Moved to source file. (ASTLoweringType::visit): Likewise. (ASTLowerGenericParam::translate): Likewise. (ASTLowerGenericParam::visit): Likewise. (ASTLoweringTypeBounds::translate): Likewise. (ASTLoweringTypeBounds::visit): Likewise. (ASTLowerWhereClauseItem::translate): Likewise. (ASTLowerWhereClauseItem::visit): Likewise. 2024-01-16 Owen Avery * ast/rust-pattern.h: Remove commented out code. 2024-01-16 emanuele-em * typecheck/rust-casts.cc (TypeCastRules::cast_rules): BOOL removed from switch cases 2024-01-16 Arthur Cohen * Make-lang.in: Rename rust-asttribute-visitor.o -> rust-cfg-strip.o * expand/rust-attribute-visitor.cc: Moved to... * expand/rust-cfg-strip.cc: ...here. * expand/rust-attribute-visitor.h: Moved to... * expand/rust-cfg-strip.h: ...here. * expand/rust-macro-expand.cc: Fix include of rust-attribute-visitor.h * expand/rust-macro-builtins.cc: Likewise. * rust-session-manager.cc (Session::expansion): Call CfgStrip instead of AttrVisitor. 2024-01-16 Arthur Cohen * Make-lang.in: Add new object file. * expand/rust-attribute-visitor.cc (AttrVisitor::go): Visit all items of a crate. (AttrVisitor::expand_struct_fields): Do not perform macro expansion anymore. (AttrVisitor::expand_function_params): Likewise. (AttrVisitor::expand_generic_args): Likewise. (AttrVisitor::expand_qualified_path_type): Likewise. (AttrVisitor::expand_self_param): Likewise. (AttrVisitor::expand_trait_function_decl): Likewise. (AttrVisitor::expand_trait_method_decl): Likewise. (AttrVisitor::visit): Likewise. (AttrVisitor::maybe_expand_expr): Remove function. (AttrVisitor::maybe_expand_type): Likewise. * expand/rust-attribute-visitor.h: Do not keep MacroExpander inside AttrVisitor anymore. * expand/rust-macro-expand.h (struct MacroExpander): Turn ContextType into an enum class for more type safety. * expand/rust-macro-expand.cc (MacroExpander::expand_crate): Use new ContextType API. * rust-session-manager.cc (Session::expansion): Call into ExpandVisitor. * expand/rust-expand-visitor.cc: New file. * expand/rust-expand-visitor.h: New file. 2024-01-16 Arthur Cohen * expand/rust-macro-expand.cc (MacroExpander::expand_crate): Do not cfg-attr strip in MacroExpander (MacroExpander::fails_cfg): Function moved... (MacroExpander::fails_cfg_with_expand): Function moved... (MacroExpander::expand_cfg_attrs): Function moved... * expand/rust-attribute-visitor.cc (fails_cfg): ...here. (fails_cfg_with_expand): ...here. (expand_cfg_attrs): ...here. (AttrVisitor::expand_struct_fields): Use new functions. (AttrVisitor::expand_tuple_fields): Likewise. (AttrVisitor::expand_function_params): Likewise. (AttrVisitor::visit): Likewise. (AttrVisitor::go): New function. * expand/rust-attribute-visitor.h: Declare AttrVisitor::go. * expand/rust-macro-expand.h (struct MacroExpander): Remove cfg-attr related functions. 2024-01-16 Arthur Cohen * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_macro_definition): New function. * hir/rust-ast-lower-base.h: Declare `lower_macro_definition`. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Lower public macro definitions. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise. * hir/rust-ast-lower-stmt.h: Add visitor for `AST::MacroRulesDefinition`. * hir/rust-ast-lower.cc (ASTLowering::go): Formatting. (ASTLoweringBlock::visit): Visit `AST::MacroRulesDefinition` (ASTLoweringIfLetBlock::visit): Formatting. (ASTLoweringExprWithBlock::visit): Formatting. 2024-01-16 Arthur Cohen * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Add new visitor for AST::MacroRulesDefinition. * hir/rust-ast-lower-item.h: Declare above mentioned visitor. * metadata/rust-export-metadata.cc (ExportContext::emit_macro): New function. * metadata/rust-export-metadata.h: Declare it. (PublicInterface::gather_export_data): Go through each exported macro. * util/rust-hir-map.cc (Mappings::insert_exported_macro): New function. (Mappings::get_exported_macros): New function. * util/rust-hir-map.h: Add new mappings for exported macros. 2024-01-16 Arthur Cohen * 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-16 Philip Herron * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): return a TraitObject 2024-01-16 Philip Herron * typecheck/rust-hir-trait-resolve.cc: don't inject extra inference variables 2024-01-16 Arthur Cohen * ast/rust-ast-dump.cc (Dump::visit): Remove extraneous semicolon when dumping macro rules. 2024-01-16 Arthur Cohen * metadata/rust-imports.cc (add_search_path): Change `Go` -> `Rust`. (Import::try_package_in_directory): Likewise. (Import::find_export_data): Likewise. 2024-01-16 Owen Avery * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Lower AltPattern. * hir/rust-ast-lower-pattern.h: (ASTLoweringPattern::visit): Add AltPattern visitor. 2024-01-16 Xiao Ma Thomas Schwinge * checks/errors/rust-feature-gate.cc: Adjust 'ld'->'u'. * checks/errors/rust-feature.h: Adjust the type of `m_issue`: 'uint64_t' -> 'unsigned'. 2024-01-16 Philip Herron * ast/rust-ast.h: add const get_final_segment helper * hir/rust-ast-lower-enumitem.h: dont add an item mapping for enumitems * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): add enum to enum-items mappings * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): likewise * hir/tree/rust-hir-item.h: add non const helper to get variants * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): resolve the use declaration * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): handle self * resolve/rust-ast-resolve-toplevel.h: add enum item mappings to module mappings * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): ensure variant (TypeCheckExpr::resolve_segments): likewise * typecheck/rust-type-util.cc (query_type): lookup enum's * util/rust-hir-map.cc (Mappings::insert_hir_enumitem): enum item mappings (Mappings::lookup_hir_enumitem): likewise * util/rust-hir-map.h: likewise 2024-01-16 Philip Herron * resolve/rust-ast-resolve-path.cc (ResolvePath::ResolvePath): return NodeId (ResolvePath::go): update signiture (ResolvePath::resolve_path): return resolved_node_id * resolve/rust-ast-resolve-path.h: update prototypes 2024-01-16 Mahmoud Mohamed * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add lowering for SlicePattern. * hir/rust-ast-lower-pattern.h: Likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Add name resolution visit for SlicePattern. * resolve/rust-ast-resolve-pattern.h: Likewise. 2024-01-16 Philip Herron * hir/rust-ast-lower-implitem.h (RUST_AST_LOWER_IMPLITEM_H): cleanup header usage * hir/rust-ast-lower-item.cc: likewise * hir/rust-ast-lower-item.h (RUST_AST_LOWER_ITEM): likewise * hir/rust-ast-lower-stmt.cc: likewise * hir/rust-ast-lower-stmt.h (RUST_AST_LOWER_STMT): likewise * hir/rust-ast-lower-type.h: likewise * hir/rust-ast-lower.cc: likewise * hir/rust-ast-lower.h: likewise * resolve/rust-ast-resolve-expr.h: likewise * resolve/rust-ast-resolve-item.cc: likewise * resolve/rust-ast-resolve-item.h: likewise * resolve/rust-ast-resolve-stmt.cc: likewise * resolve/rust-ast-resolve-stmt.h: likewise * resolve/rust-ast-resolve-struct-expr-field.h: likewise * resolve/rust-ast-resolve-toplevel.h: likewise * resolve/rust-ast-resolve-type.h: likewise * resolve/rust-ast-resolve.h: likewise 2024-01-16 Mahmoud Mohamed * resolve/rust-ast-resolve-pattern.h (class ResolvePattern): Removed. 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (move_val_init_handler): new intrinsice (uninit_handler): use a builtin memcpy 2024-01-16 Philip Herron * typecheck/rust-coercion.cc (TypeCoercionRules::select): use the result 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): fix ctor * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): likewise * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise * typecheck/rust-typecheck-context.cc (TypeCheckContext::push_new_loop_context): likewise * typecheck/rust-tyty-util.cc (TyVar::get_implicit_infer_var): likewise * typecheck/rust-tyty.cc (InferType::InferType): new ctor with type hint (InferType::clone): fix ctor (InferType::apply_primitive_type_hint): new function to apply possible hint * typecheck/rust-tyty.h: update prototypes * typecheck/rust-unify.cc (UnifyRules::expect_inference_variable): apply type hints (UnifyRules::expect_bool): likewise (UnifyRules::expect_char): likewise (UnifyRules::expect_int): likewise (UnifyRules::expect_uint): likewise (UnifyRules::expect_float): likewise (UnifyRules::expect_isize): likewise (UnifyRules::expect_usize): likewise 2024-01-16 Jiakun Fan <120090316@link.cuhk.edu.cn> * hir/rust-hir-dump.cc (Dump::go): fix format (Dump::visit): impl `visit (AST::Attribute &)`, dump inner attrs and `visit (Lifetime &)` * hir/rust-hir-dump.h:add `visit (AST::Attribute &)` 2024-01-16 Mahmoud Mohamed * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): Print out consistency errors. (PatternDeclaration::visit): Implement visit for AltPattern. (PatternDeclaration::add_new_binding): New helper function for adding a binding to identifier. * resolve/rust-ast-resolve-pattern.h (struct BindingInfo): New struct to facilitate checking for inconsistencies between bindings. 2024-01-16 Owen Avery * 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. 2024-01-16 Owen Avery * 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. 2024-01-16 Mahmoud Mohamed * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Push a Product context instead of an Or context. 2024-01-16 Philip Herron * typecheck/rust-hir-inherent-impl-overlap.h (class ImplItemToName): remove 2024-01-16 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): remove unused code 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): remove infer call (TypeCheckExpr::resolve_root_path): only infer when we need to 2024-01-16 Philip Herron * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): add debug 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * typecheck/rust-coercion.cc (TypeCoercionRules::select): use new unify_and interface * typecheck/rust-hir-dot-operator.cc (MethodResolver::try_hook): grab bounds behind refs 2024-01-16 Philip Herron * 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 2024-01-16 Philip Herron * typecheck/rust-tyty.cc (BaseType::has_subsititions_defined): new implementation (BaseType::needs_generic_substitutions): likewise (ProjectionType::needs_generic_substitutions): remove (ProjectionType::has_subsititions_defined): remove * typecheck/rust-tyty.h: update header 2024-01-16 Philip Herron * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): update to use new interface (TypeCheckExpr::resolve_root_path): likewise (TypeCheckExpr::resolve_segments): likewise * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise (TypeCheckType::resolve_root_path): likewise * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): likewise * typecheck/rust-tyty.cc (BaseType::supports_substitutions): likewise (BaseType::can_substitute): remove (BaseType::contains_type_parameters): remove (handle_substitions): cleanup (TupleType::handle_substitions): update (FnType::handle_substitions): update (ProjectionType::supports_substitutions): update * typecheck/rust-tyty.h: update header 2024-01-16 Philip Herron * typecheck/rust-tyty.h: cleanup ordering of header 2024-01-16 Philip Herron * typecheck/rust-tyty.cc (BaseType::monomorphized_clone): new impl (InferType::monomorphized_clone): remove (ErrorType::monomorphized_clone): likewise (ADTType::monomorphized_clone): likewise (TupleType::monomorphized_clone): likewise (FnType::monomorphized_clone): likewise (FnPtr::monomorphized_clone): likewise (ClosureType::monomorphized_clone): likewise (ArrayType::clone): likewise (ArrayType::get_var_element_type): likewise (ArrayType::monomorphized_clone): likewise (SliceType::clone): likewise (SliceType::get_var_element_type): likewise (SliceType::monomorphized_clone): likewise (BoolType::monomorphized_clone): likewise (IntType::monomorphized_clone): likewise (UintType::monomorphized_clone): likewise (FloatType::monomorphized_clone): likewise (USizeType::monomorphized_clone): likewise (ISizeType::monomorphized_clone): likewise (CharType::monomorphized_clone): likewise (ReferenceType::clone): likewise (ReferenceType::get_var_element_type): likewise (ReferenceType::monomorphized_clone): likewise (PointerType::clone): likewise (PointerType::get_var_element_type): likewise (PointerType::monomorphized_clone): likewise (ParamType::monomorphized_clone): likewise (StrType::monomorphized_clone): likewise (NeverType::monomorphized_clone): likewise (PlaceholderType::monomorphized_clone): likewise (ProjectionType::monomorphized_clone): likewise (DynamicObjectType::monomorphized_clone): likewise * typecheck/rust-tyty.h: update header 2024-01-16 Philip Herron * typecheck/rust-tyty.cc (BaseType::is_unit): new implementation (ErrorType::is_unit): remove (TupleType::is_unit): likewise (NeverType::is_unit): likewise (PlaceholderType::is_unit): likewise (ProjectionType::is_unit): likewise * typecheck/rust-tyty.h: update header 2024-01-16 Philip Herron * typecheck/rust-tyty.cc (BaseType::is_concrete): new implementation (InferType::is_concrete): remove (ErrorType::is_concrete): likewise (StructFieldType::is_concrete): likewise (ADTType::is_concrete): likewise (TupleType::is_concrete): likewise (BoolType::is_concrete): likewise (IntType::is_concrete): likewise (UintType::is_concrete): likewise (FloatType::is_concrete): likewise (USizeType::is_concrete): likewise (ISizeType::is_concrete): likewise (CharType::is_concrete): likewise (ReferenceType::is_concrete): likewise (PointerType::is_concrete): likewise (ParamType::is_concrete): likewise (StrType::is_concrete): likewise (NeverType::is_concrete): likewise (PlaceholderType::is_concrete): likewise (ProjectionType::is_concrete): likewise (DynamicObjectType::is_concrete): likewise * typecheck/rust-tyty.h: update header 2024-01-16 Philip Herron * backend/rust-compile-type.cc (TyTyResolveCompile::TyTyResolveCompile): call destructure (TyTyResolveCompile::compile): use error_mark_node (TyTyResolveCompile::visit): use error_mark_node * backend/rust-compile-type.h: remove recursive ops 2024-01-16 Tage Johansson * parse/rust-parse.cc: fix follow-sets 2024-01-16 Mahmoud Mohamed * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit) :declare and pass bindings to PatternDeclaration::go. (ResolveExpr::resolve_closure_param): Likewise. * resolve/rust-ast-resolve-expr.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): Likewise. (PatternDeclaration::visit): check for previous identifier bindings before inserting the new one. * resolve/rust-ast-resolve-pattern.h (enum PatternBoundCtx): New enum. * resolve/rust-ast-resolve-stmt.h: pass bindings to PatterDeclaration::go. 2024-01-16 Mahmoud Mohamed * backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): handle closure parameters pattern bindings using CompilePatternBindings visitor 2024-01-16 Arthur Cohen * README.md (process): Rename `rust1` to `crab1` in examples. * Make-lang.in: Rename `rust1` to `crab1`. * config-lang.in: Likewise. * lang-specs.h: Likewise. * rustspec.cc (lang_specific_driver): Likewise. 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (SlicePattern::get_items): Add. 2024-01-16 Owen Avery * hir/tree/rust-hir-full-decls.h (struct GenericArgsBinding): Convert to class. (class GenericArgsBinding): Convert from struct. (struct TypePathFunction): See above. (class TypePathFunction): See above. (struct QualifiedPathType): See above. (class QualifiedPathType): See above. * ast/rust-ast-full-decls.h (struct WhereClause): See above. (class WhereClause): See above. (struct SelfParam): See above. (class SelfParam): See above. (struct FunctionQualifiers): See above. (class FunctionQualifiers): See above. (struct FunctionParam): See above. (class FunctionParam): See above. (struct StructField): See above. (class StructField): See above. (struct TupleField): See above. (class TupleField): See above. (struct TraitFunctionDecl): See above. (class TraitFunctionDecl): See above. (struct TraitMethodDecl): See above. (class TraitMethodDecl): See above. (struct NamedFunctionParam): See above. (class NamedFunctionParam): See above. * hir/tree/rust-hir-path.h (struct GenericArgsBinding): See above. (class GenericArgsBinding): See above. (struct TypePathFunction): See above. (class TypePathFunction): See above. (struct QualifiedPathType): See above. (class QualifiedPathType): See above. * ast/rust-item.h (struct WhereClause): See above. (class WhereClause): See above. (struct SelfParam): See above. (class SelfParam): See above. (struct FunctionQualifiers): See above. (class FunctionQualifiers): See above. (struct FunctionParam): See above. (class FunctionParam): See above. (struct StructField): See above. (class StructField): See above. (struct TupleField): See above. (class TupleField): See above. (struct TraitFunctionDecl): See above. (class TraitFunctionDecl): See above. (struct TraitMethodDecl): See above. (class TraitMethodDecl): See above. (struct NamedFunctionParam): See above. (class NamedFunctionParam): See above. 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (class AltPattern): Remove duplicate access specifier. (AltPattern::get_alts): Add. * hir/tree/rust-hir.cc (AltPattern::as_string): Add. (AltPattern::accept_vis): Add. 2024-01-16 Arthur Cohen * hir/tree/rust-hir-item.h (class ExportedMacro): Add new ExportedMacro class. * hir/tree/rust-hir.cc (ExportedMacro::accept_vis): New function. (ExportedMacro::get_locus): Likewise. (ExportedMacro::get_item_kind): Likewise. (ExportedMacro::clone_item_impl): Likewise. * hir/tree/rust-hir-full-decls.h (class ExportedMacro): Forward declare class. * backend/rust-compile-item.h: Add visitor for ExportedMacro. * 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-visitor.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. * hir/tree/rust-hir.h: Add new ItemKind::MacroExport variant. * util/rust-attributes.cc: Add #[macro_export] attribute. 2024-01-16 Mahmoud Mohamed * backend/rust-compile-fnparam.cc (CompileFnParam::visit): Added visit implementation for ReferencePattern. (CompileFnParam::create_tmp_param_var): Refactored duplicated code into a helper function. * backend/rust-compile-fnparam.h: Added visit implementation for ReferencePattern. * backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Added visit implementation for ReferencePattern and IdentifierPattern. * backend/rust-compile-pattern.h: Added visit implementation for ReferencePattern and IdentifierPattern. 2024-01-16 Arthur Cohen * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Move unloaded module item loading to... * expand/rust-attribute-visitor.cc (AttrVisitor::visit): ...here. 2024-01-16 Jakub Dupak * hir/rust-hir-dump.cc (Dump::visit): Simplify indentation dump to single line. 2024-01-16 Jakub Dupak * ast/rust-ast-dump.cc (Indent::Indent): Move to separate file. (operator<<): Move to separate file. (Indent::increment): Move to separate file. (Indent::decrement): Move to separate file. * ast/rust-ast-dump.h (class Indent): Move to separate file. * hir/rust-hir-dump.cc (Dump::Dump): Use new indentation object. (Dump::go): Use new indentation object. (Dump::visit): Use new indention object. * hir/rust-hir-dump.h: Use new indentation object. * util/rust-dump.h: New file. Moved Indentation from rust-ast-dump.cc 2024-01-16 Mahmoud Mohamed * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add the missing infered type assignment 2024-01-16 Marc Poulhiès PR rust/108111 * ast/rust-ast-full-decls.h (StructPatternElements): Declare as a class. * ast/rust-item.h (EnumItem): Mark several method as being overrides. * ast/rust-pattern.h (StructPattern::get_locus): Add override. * lex/rust-lex.h (BufferInputSource): Use reference_wrapper instead of bare reference. (TokenSource::get): Add method to implement the reference_wrapper interface. * typecheck/rust-tyty.h (TypeBoundPredicate): Add empty dtor. * util/rust-buffered-queue.h (peek): Source token stream is now using a reference_wrapper, use .get() 2024-01-16 vincent * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): rewrite part code to helper function (TypeCheckPattern::typecheck_range_pattern_bound): helper function * typecheck/rust-hir-type-check-pattern.h (TypeCheckPattern::typecheck_range_pattern_bound): change the parameter of the function 2024-01-16 goar5670 * hir/tree/rust-hir-pattern.h (HIR::ReferencePattern): added get_referenced_pattern function. * resolve/rust-ast-resolve-pattern.h (Resolve::PatternDeclaration): add visit function for AST::ReferencePattern * typecheck/rust-hir-type-check-pattern.cc (Resolver::TypeCheckPattern): add visit function for HIR::ReferencePattern 2024-01-16 Owen Avery * util/rust-lang-item.h (RustLangItem::ItemType): New enumerators. (RustLangItem::Parse): Parse new enumerators. (RustLangItem::ToString): Handle new enumerators. 2024-01-16 Owen Avery * backend/rust-compile-fnparam.h: (CompileFnParam::visit): Add AltPattern visitor. * backend/rust-compile-pattern.h: (CompilePatternCaseLabelExpr::visit): Add AltPattern visitor. (CompilePatternBindings::visit): Add AltPattern visitor. (CompilePatternLet::visit): Add AltPattern visitor. * backend/rust-compile-resolve-path.h: (ResolvePathRef::visit): Add AltPattern visitor. * backend/rust-compile-var-decl.h: (CompileVarDecl::visit): Add AltPattern visitor. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Add AltPattern visitor. * checks/errors/rust-const-checker.h: (ConstChecker::visit): Add AltPattern visitor. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Add AltPattern visitor. * checks/errors/rust-unsafe-checker.h: (UnsafeChecker::visit): Add AltPattern visitor. * hir/rust-hir-dump.cc (Dump::visit): Add AltPattern visitor. * hir/rust-hir-dump.h: (Dump::visit): Add AltPattern visitor. * hir/tree/rust-hir-full-decls.h (class AltPattern): Add forward declaration. * hir/tree/rust-hir-pattern.h (class AltPattern): New class. * hir/tree/rust-hir-visitor.h: (HIRFullVisitor::visit): Add AltPattern visitor. (HIRFullVisitorBase::visit): Add AltPattern visitor. (HIRPatternVisitor::visit): Add AltPattern visitor. * hir/tree/rust-hir.h: (Pattern::PatternType::ALT): New enumerator. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add AltPattern visitor. * typecheck/rust-hir-type-check-pattern.h: (TypeCheckPattern::visit): Add AltPattern visitor. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-macro.cc (builtin_macro_from_string): Add identifier identification. * ast/rust-macro.h (enum class): Add Stringify builtin macro type. * expand/rust-macro-builtins.cc (make_macro_path_str): Add path for builtin stringify macro. (MacroBuiltin::stringify_handler): Add handler for builtin stringify macro. * expand/rust-macro-builtins.h: Add stringify handler's prototype. * util/rust-hir-map.cc (Mappings::insert_macro_def): Add stringify handler to builtin hir map. 2024-01-16 Nikos Alexandris * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add length checking for tuple patterns. (TypeCheckPattern::emit_pattern_size_error): New function. * typecheck/rust-hir-type-check-pattern.h: New function emit_pattern_size_error. 2024-01-16 goar5670 * parse/rust-parse-impl.h (Parser::parse_expr): split LEFT_SHIFT before null_denotation. 2024-01-16 Parthib * rust-object-export.cc: Modified * hir/rust-ast-lower-type.cc (rust_fatal_error): Removed (rust_assert): Added 2024-01-16 Owen Avery * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Check for closure parameter without given type. 2024-01-16 Philip Herron * typecheck/rust-typecheck-context.cc (TypeCheckContext::insert_resolved_predicate): remove 2024-01-16 Philip Herron * resolve/rust-ast-resolve-type.cc (ResolveRelativeQualTypePath::resolve_qual_seg): fix 2024-01-16 Philip Herron * ast/rust-path.h: add missing copy for node_id 2024-01-16 Philip Herron * rust-gcc.h: remove unused headers 2024-01-16 Philip Herron * ast/rust-ast.cc (QualifiedPathInType::as_string): add missing to string * ast/rust-path.h: add missing copy+move constructors and assignment overloads * hir/tree/rust-hir-path.h: likewise * hir/tree/rust-hir.cc (QualifiedPathInType::as_string): add missing to string 2024-01-16 Philip Herron * typecheck/rust-tyty.cc (ParamType::get_name): call destructure 2024-01-16 Philip Herron * typecheck/rust-hir-trait-resolve.cc: use unify_and infer 2024-01-16 goar5670 * parse/rust-parse-impl.h (Parser::parse_closure_param): Replace parse_pattern with parse_pattern_no_alt. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_while_let_loop_expr): Prevent hard error on token skip. (Parser::null_denotation): Fix parser for while let expressions. 2024-01-16 Philip Herron * backend/rust-builtins.cc (BuiltinsContext::setup): add memset builtin to the map * backend/rust-compile-intrinsic.cc (uninit_handler): implement uninit intrinsic 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_slice_pattern): Add closing square bracket check. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_external_type_item): Fix compilation error due to unnecessary move. 2024-01-16 Abdul Rafey * hir/rust-hir-dump.cc (Dump::go): support inner attrs, crate items and node mappings (Dump::visit): support functions, arith/logical exprs, let stmts and literals 2024-01-16 Nikos Alexandris * expand/rust-macro-builtins.cc (load_file_bytes): Add location parameter. (MacroBuiltin::include_bytes_handler): Pass location to load_file_bytes. (MacroBuiltin::include_str_handler): Pass location to load_file_bytes. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_pattern_no_alt): Handle RestPattern correctly. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-pattern.h (class RestPattern): Add NodeId as well as the clone_impl function. 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::null_denotation): Fix if let parsing. 2024-01-16 Philip Herron * backend/rust-compile-intrinsic.cc (op_with_overflow_inner): wraps op_with_overflow (std::function * Make-lang.in: Add rust-ast-lower-stmt.o * hir/rust-ast-lower-stmt.h: Move definitions to... * hir/rust-ast-lower-stmt.cc: ...here. 2024-01-16 mxlol233 * checks/errors/rust-feature-gate.cc: Add definition for `extern_types`. * checks/errors/rust-feature-gate.h: Likewise. * checks/errors/rust-feature.cc: Likewise. * checks/errors/rust-feature.h: Likewise. 2024-01-16 Owen Avery * ast/rust-pattern.h (StructPatternElements::operator=): Clear vector before inserting. (TupleStructItemsNoRange::operator=): Clear vector before inserting. (TupleStructItemsRange::operator=): Clear vectors before inserting. (TuplePatternItemsMultiple::operator=): Clear vector before inserting. (TuplePatternItemsRanged::operator=): Clear vectors before inserting. (SlicePattern::operator=): Clear vector before inserting. (AltPattern::operator=): Clear vector before inserting. * hir/tree/rust-hir-pattern.h (StructPatternElements::operator=): Clear vector before inserting. (TupleStructItemsNoRange::operator=): Clear vector before inserting. (TupleStructItemsRange::operator=): Clear vectors before inserting. (TuplePatternItemsMultiple::operator=): Clear vector before inserting. (TuplePatternItemsRanged::operator=): Clear vectors before inserting. (SlicePattern::operator=): Clear vector before inserting. 2024-01-16 bl7awy * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Perform destructure on `from` type. 2024-01-16 Owen Avery * ast/rust-pattern.h (struct StructPatternElements): Change to class. (class StructPatternElements): Change from struct. * hir/tree/rust-hir-pattern.h (struct StructPatternElements): Change to class. (class StructPatternElements): Change from struct. 2024-01-16 Owen Avery * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Improve error messages. 2024-01-16 Owen Avery * hir/tree/rust-hir-pattern.h (class TupleStructItemsNoRange): Fix formatting. (class TupleStructItemsRange): Fix formatting. (class TuplePatternItemsMultiple): Fix formatting. (class TuplePatternItemsRanged): Fix formatting. (class SlicePattern): Fix formatting. 2024-01-16 Pierre-Emmanuel Patry * ast/rust-ast-dump.cc (Dump::visit): Add visitor. * ast/rust-ast-dump.h: Add visitor prototype. * ast/rust-ast-full-decls.h (class RestPattern): Add forward declaration for class RestPattern. * ast/rust-ast-visitor.h: Add visitor prototype. * ast/rust-ast.cc (RestPattern::accept_vis): Add function to accept a foreign visitor. * ast/rust-pattern.h (class RestPattern): Add class RestPattern. * checks/errors/rust-feature-gate.h: Add visitor prototype. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Add visitor implementation. * expand/rust-attribute-visitor.h: Add visitor prototype. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add visitor implementation. * hir/rust-ast-lower-base.h: Add visitor prototype. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add visitor implementation. * resolve/rust-ast-resolve-base.h: Add visitor prototype. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Add visitor implementation. * resolve/rust-early-name-resolver.h: Add visitor prototype. * util/rust-attributes.cc (AttributeChecker::visit): Add visitor implementation. * util/rust-attributes.h: Add visitor prototype. 2024-01-16 Philip Herron * typecheck/rust-tyty-cmp.h: remove * typecheck/rust-tyty.cc (set_cmp_autoderef_mode): likewise (reset_cmp_autoderef_mode): likewise * typecheck/rust-tyty.h (set_cmp_autoderef_mode): likewise (reset_cmp_autoderef_mode): likewise 2024-01-16 Philip Herron * typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): Add new try_flag (TypeCoercionRules::TypeCoercionRules): set new try flag (TypeCoercionRules::do_coercion): default to a final unify_and in the else case (TypeCoercionRules::coerce_unsafe_ptr): cannot coerce to a ptr from ref during autoderef (TypeCoercionRules::coerce_borrowed_pointer): respect coerceable mutability * typecheck/rust-coercion.h: update header * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): use new TryCoerce interface (MethodResolver::append_adjustments): ensure we maintain adjustment mappings * typecheck/rust-hir-dot-operator.h: add new method append_adjustments * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): extra logging 2024-01-16 Philip Herron * typecheck/rust-unify.cc (UnifyRules::go): fix inference check 2024-01-16 Philip Herron * backend/rust-compile-base.h: unconsify * backend/rust-compile.cc (HIRCompileBase::coercion_site): likewise (HIRCompileBase::coercion_site1): likewise * typecheck/rust-autoderef.cc (Adjuster::try_deref_type): likewise (Adjuster::try_raw_deref_type): likewise (Adjuster::try_unsize_type): likewise (AutoderefCycle::cycle): likewise (AutoderefCycle::try_autoderefed): likewise * typecheck/rust-autoderef.h: likewise * typecheck/rust-coercion.cc (TypeCoercionRules::select): likewise * typecheck/rust-coercion.h: likewise * typecheck/rust-hir-dot-operator.cc (MethodResolver::Probe): likewise (MethodResolver::select): likewise * typecheck/rust-hir-dot-operator.h: likewise 2024-01-16 Philip Herron * typecheck/rust-unify.cc (UnifyRules::go): respect the emit_errors flag 2024-01-16 Philip Herron * typecheck/rust-casts.cc (TypeCastRules::check): update to new interface * typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): likewise (TypeCoercionRules::TryCoerce): likewise (TypeCoercionRules::TypeCoercionRules): likewise * typecheck/rust-coercion.h: likewise * typecheck/rust-type-util.cc (coercion_site): likewise 2024-01-16 Philip Herron * typecheck/rust-unify.cc (UnifyRules::go): allow lhs infer vars 2024-01-16 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): update to new inteface * typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsafe_ptr): likewise (TypeCoercionRules::coerce_borrowed_pointer): likewise * typecheck/rust-hir-type-check.h: likewise * typecheck/rust-type-util.cc (unify_site_and): new interface to allow for infer and commit * typecheck/rust-type-util.h (unify_site_and): likewise * typecheck/rust-typecheck-context.cc (TypeCheckContext::clear_type): new interface * typecheck/rust-unify.cc (UnifyRules::UnifyRules): update (UnifyRules::Resolve): new optional flags for commit and infer (UnifyRules::go): likewise (UnifyRules::expect_adt): refactor to use new interface (UnifyRules::expect_reference): likewise (UnifyRules::expect_pointer): likewise (UnifyRules::expect_array): likewise (UnifyRules::expect_slice): likewise (UnifyRules::expect_fndef): likewise (UnifyRules::expect_fnptr): likewise (UnifyRules::expect_tuple): likewise (UnifyRules::expect_closure): likewise * typecheck/rust-unify.h: refactor interface 2024-01-16 Philip Herron * typecheck/rust-unify.cc (UnifyRules::Resolve): refactor (UnifyRules::commit): refactor * typecheck/rust-unify.h: likewise 2024-01-16 Philip Herron * typecheck/rust-tyty.cc (ADTType::is_concrete): need to consider if is a num_variant * typecheck/rust-tyty.h: refactor to cc file 2024-01-16 Pierre-Emmanuel Patry * parse/rust-parse-impl.h (Parser::parse_external_type_item): Add function to parser an external type item. (Parser::parse_external_item): Add identification and parsing for external type items. * parse/rust-parse.h: Add parser_external_type_item prototype. 2024-01-16 omkar-mohanty * expand/rust-macro-builtins.cc (MacroBuiltin::include_str_handler): eager expansion (make_macro_path_str): macto to string (parse_single_string_literal): check for eager invocation (MacroBuiltin::assert_handler): eager expansion (MacroBuiltin::include_bytes_handler): eager expansion (MacroBuiltin::include_str_handler): eager expansion (MacroBuiltin::compile_error_handler): eager expansion (MacroBuiltin::include_handler): eager expansion 2024-01-16 Arthur Cohen * ast/rust-item.h (class Method): Add `is_default` field. (class Function): Likewise. * parse/rust-parse-impl.h (Parser::parse_item): Add nice error when parsing `default` outside of an `impl` block (Parser::parse_trait_impl_item): Allow parsing functions or methods when seeing `default`. 2024-01-16 Pierre-Emmanuel Patry * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::cast_site): Remove cast_site. * typecheck/rust-hir-type-check-base.h: Remove cast_site prototype. * typecheck/rust-type-util.cc (cast_site): Add cast_site. * typecheck/rust-type-util.h (cast_site): Add cast_site prototype. 2024-01-16 Arthur Cohen * ast/rust-item.h: Add non-const `get_visibility` to ExternalTypeItem. * ast/rust-ast-dump.cc (Dump::visit): Add implementation for ExternalTypeItem. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Likewise. 2024-01-16 Arthur Cohen * ast/rust-item.h (class ExternalTypeItem): New class. * ast/rust-ast.cc (ExternalTypeItem::as_string): New function. (ExternalTypeItem::accept_vis): Likewise. * ast/rust-ast-full-decls.h (class ExternalTypeItem): Declare class. * ast/rust-ast-dump.cc (Dump::visit): Add base visitor for ExternalTypeItem. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast-visitor.h: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Likewise. * expand/rust-attribute-visitor.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h: Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h: Likewise. 2024-01-16 Arthur Cohen * expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::split_current_token): Add proper implementation. 2024-01-16 Arthur Cohen * ast/rust-item.h (class Trait): Add `has_auto` field. * checks/errors/rust-feature.cc: Add handling for `feature(optin_builtin_traits)` * checks/errors/rust-feature.h: Likewise. * lex/rust-lex.cc: Fix keyword classification using hashmap. * lex/rust-token.h: Add `auto` keyword token. * parse/rust-parse-impl.h (Parser::parse_vis_item): Parse auto traits on `auto` keyword. 2024-01-16 Pierre-Emmanuel Patry * typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): Remove TypeCheckBase namespace qualifier. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::coercion_site): Remove coercion_site function. * typecheck/rust-hir-type-check-base.h: Remove coercion_site prototype. * typecheck/rust-type-util.cc (coercion_site): Add coercion_site function. * typecheck/rust-type-util.h (coercion_site): Add coercion_site prototype. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Remove TypeCheckBase namespace qualifier. (TypeCheckMethodCallExpr::check): Remove TypeCheckBase namespace qualifier. 2024-01-16 Pierre-Emmanuel Patry * typecheck/rust-autoderef.cc: Remove TypeCheckBase qualifier. * typecheck/rust-hir-trait-resolve.cc: Remove TypeCheckBase qualifier. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site): Remove unify_site. * typecheck/rust-hir-type-check-base.h: Remove unify_site header. * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Remove TypeCheckBase qualifier. * typecheck/rust-type-util.cc (unify_site): Add unify_site function. * typecheck/rust-type-util.h (unify_site): Add unify_site prototype. * typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::check): Remove TypeCheckBase qualifier. 2024-01-16 Arthur Cohen * parse/rust-parse-impl.h (Parser::parse_type): Allow LEFT_SHIFT to start a type and then split it in `parse_qualified_path_type` 2024-01-16 Arthur Cohen * parse/rust-parse-impl.h (Parser::parse_path_generic_args): Split leading `LEFT_SHIFT` token into two `LEFT_ANGLE` tokens when parsing generic arguments. (Parser::parse_type_path_segment): Allow `LEFT_ANGLE` as starting token for parsing generic arguments. 2024-01-16 mxlol233 * checks/errors/rust-feature-gate.cc: Add implementations for `rustc_attri`. * checks/errors/rust-feature-gate.h: Likewise. 2024-01-16 Owen Avery * parse/rust-parse-impl.h (Parser::parse_pattern): Add. (Parser::parse_pattern_no_alt): Rename. * parse/rust-parse.h: (Parser::parse_pattern): Add. (Parser::parse_pattern_no_alt): Rename. 2024-01-04 David Malcolm * lang.opt.urls: New file, autogenerated by regenerate-opt-urls.py. 2023-12-14 Pierre-Emmanuel Patry Thomas Schwinge * config-lang.in: Add libgrust as a target module for the rust language. 2023-11-19 David Malcolm * rust-location.h: Include "rich-location.h". 2023-10-20 Patrick Palka PR rust/111899 * backend/rust-constexpr.cc (potential_constant_expression_1): Remove NON_DEPENDENT_EXPR handling. * backend/rust-tree.cc (mark_exp_read): Likewise. (mark_use): Likewise. (lvalue_kind): Likewise. 2023-09-28 Richard Sandiford * backend/rust-constexpr.cc (rs_fold_indirect_ref): Remove unused variables. 2023-09-21 Iain Buclaw * rust-session-manager.cc (Session::init): Call targetrustm.rust_os_info. * rust-target.def (rust_os_info): New hook. 2023-09-21 Iain Buclaw * rust-lang.cc (rust_add_target_info): Remove sorry. * rust-session-manager.cc: Replace include of target.h with include of tm.h and rust-target.h. (Session::init): Call targetrustm.rust_cpu_info. * rust-target.def (rust_cpu_info): New hook. * rust-target.h (rust_add_target_info): Declare. 2023-09-21 Iain Buclaw * rust-target-def.h: New file. * rust-target.def: New file. * rust-target.h: New file. 2023-09-11 Parthib <94271200+Parthib314@users.noreply.github.com> * Make-lang.in: Removed rust-gcc-diagnostics object file. * rust-diagnostics.cc (rust_be_get_quotechars): Added from original file. (rust_be_internal_error_at): Likewise. (rust_be_error_at): Likewise. (class rust_error_code_rule): Likewise. (rust_be_warning_at): Likewise. (rust_be_fatal_error): Likewise. (rust_be_inform): Likewise. (rust_be_debug_p): Likewise. * rust-gcc-diagnostics.cc: Removed. 2023-09-07 David Malcolm * rust-diagnostics.cc (rust_error_at): New overload. * rust-diagnostics.h (struct ErrorCode): New struct. (rust_error_at): New. (rust_be_error_at): Likewise. * rust-gcc-diagnostics.cc (class rust_error_code_rule): New class. (rust_be_error_at): New function. * typecheck/rust-casts.cc (TypeCastRules::emit_cast_error): Emit E0054 when reporting invalid cast error. 2023-07-05 Robin Dapp Juzhe-Zhong * backend/rust-tree.cc (c_common_type_for_mode): Ditto. 2023-06-22 Paul E. Murphy * rust-object-export.cc [TARGET_AIX]: Rename and update usage to TARGET_AIX_OS. 2023-04-06 Owen Avery * parse/rust-parse-impl.h (Parser::parse_stmt): Handle unsafe expression statements. 2023-04-06 Owen Avery * parse/rust-parse-impl.h (Parser::parse_expr_stmt): Remove hypothetical unsafe + expr_stmt_without_block handling. 2023-04-06 M V V S Manoj Kumar * ast/rust-ast-full-decls.h (class InlineAsm):Added class declaration. * ast/rust-expr.h (class InlineAsm):Added class definition. 2023-04-06 Arthur Cohen * rust-diagnostics.h (struct Error): Add new Kind enum and various new static constructors to allow for hints as well. * rust-diagnostics.cc (Error::Error): Use new `kind` field properly. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::resolve_module_path): Use new Error API. * expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Likewise. * expand/rust-macro-expand.cc (parse_many): Likewise. (transcribe_type): Likewise. * parse/rust-parse-impl.h (Parser::parse_crate): Likewise. * rust-session-manager.cc (Session::handle_crate_name): Likewise. * ast/rust-ast.cc (Module::load_items): Likewise. 2023-04-06 Arthur Cohen * ast/rust-ast.h: Keep location in TraitItem base class * ast/rust-item.h (class TraitItemFunc): Use base class location instead. (class TraitItemMethod): Likewise. (class TraitItemConst): Likewise. (class TraitItemType): Likewise. * ast/rust-macro.h: Likewise. 2023-04-06 SainiAditya1 * hir/tree/rust-hir-full-test.cc: Moved to... * hir/tree/rust-hir.cc: ...here. * Make-lang.in: Rename rust-hir-full-test. 2023-04-06 Owen Avery * ast/rust-ast-dump.cc (Dump::visit): Add AltPattern visitor. * ast/rust-ast-dump.h: (Dump::visit): Add AltPattern visitor. * ast/rust-ast-full-decls.h (class AltPattern): Add declaration. * ast/rust-ast-visitor.h: (ASTVisitor::visit): Add AltPattern visitor. * ast/rust-ast.cc (AltPattern::as_string): Add definition. (AltPattern::accept_vis): Add definition. * ast/rust-pattern.h (class AltPattern): Add declaration. * checks/errors/rust-feature-gate.h: (FeatureGate::visit) Add AltPattern visitor * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Add AltPattern visitor. * expand/rust-attribute-visitor.h: (AttrVisitor::visit): Add AltPattern visitor. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add AltPattern visitor. * hir/rust-ast-lower-base.h: (ASTLoweringBase::visit): Add AltPattern visitor. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add AltPattern visitor. * resolve/rust-ast-resolve-base.h: (ResolverBase::visit): Add AltPattern visitor. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Add AltPattern visitor. * resolve/rust-early-name-resolver.h: (EarlyNameResolver::visit): Add AltPattern visitor. * util/rust-attributes.cc (AttributeChecker::visit): Add AltPattern visitor. * util/rust-attributes.h: (AttributeChecker::visit): Add AltPattern visitor. 2023-04-06 Owen Avery * ast/rust-pattern.h: Fix formatting. 2023-04-06 Arthur Cohen * expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Do not return nullptr token in expansion of `include!()` 2023-04-06 Owen Avery * checks/errors/rust-feature-gate.h: Add trailing newline before EOF. 2023-04-06 Philip Herron * typecheck/rust-hir-trait-reference.cc (TraitReference::clear_associated_types): make const (TraitReference::clear_associated_type_projections): new interface * typecheck/rust-hir-trait-reference.h: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): refactor (TraitItemReference::associated_type_reset): reset projections * typecheck/rust-hir-type-bounds.h: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): fix bounds * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::TypeBoundsProbe): refactor into cc file (TypeBoundsProbe::Probe): refactor (TypeBoundsProbe::is_bound_satisfied_for_type): likewise (TypeBoundsProbe::assemble_sized_builtin): add builtin for Sized (TypeCheckBase::get_predicate_from_bound): refactor (TypeBoundPredicate::lookup_associated_type): refactor * typecheck/rust-tyty-subst.cc (SubstitutionRef::lookup_associated_impl) (SubstitutionRef::prepare_higher_ranked_bounds): new interface to clear hanging bounds (SubstitutionRef::monomorphize): refactor * typecheck/rust-tyty-subst.h: * typecheck/rust-tyty.cc (BaseType::get_locus): helper (BaseType::satisfies_bound): ensure bounds are satisfied and assoicated types (ParamType::ParamType): new field in constructor (ParamType::clone): update clone (ParamType::set_implicit_self_trait): new interface (ParamType::is_implicit_self_trait): likewise * typecheck/rust-tyty.h: cleanup * util/rust-hir-map.cc (Mappings::Mappings): builtin marker (Mappings::~Mappings): delete marker (Mappings::lookup_builtin_marker): lookup * util/rust-hir-map.h: update header 2023-04-06 Philip Herron * hir/tree/rust-hir-item.h: implement virtual function * hir/tree/rust-hir.h: add virtual function 2023-04-06 Philip Herron * Make-lang.in: add new dependancy * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): refactor * typecheck/rust-hir-type-check-base.h: refactor * typecheck/rust-hir-type-check.h (RUST_HIR_TYPE_CHECK): refactor * typecheck/rust-type-util.cc: New file. * typecheck/rust-type-util.h: New file. 2023-04-06 Owen Avery * expand/rust-macro-builtins.cc (MacroBuiltin::include_str_handler): Add check for valid UTF-8. 2023-04-06 Owen Avery * parse/rust-parse-impl.h (Parser::parse_grouped_or_tuple_pattern): Add support for empty tuple patterns. 2023-04-06 Pierre-Emmanuel Patry * lex/rust-lex.h: Add file type check. 2023-04-06 Owen Avery * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Simplify WildcardPattern compilation for let statements. * backend/rust-compile-var-decl.h: (CompileVarDecl::visit): Remove variable declaration for WildcardPattern. * resolve/rust-ast-resolve-pattern.h: (PatternDeclaration::visit): Remove name resolution for WildcardPattern. 2023-04-06 Owen Avery * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Add variadic argument type checking. (TypeCheckCallExpr::visit): Fix comment spelling ("varadic"). 2023-04-06 mxlol233 * checks/errors/rust-feature-gate.cc: Add implementation for `void FeatureGate::visit (AST::ExternBlock &block)`. Add `valid_feature` construction process in `FeatureGate::check`. * checks/errors/rust-feature-gate.h: Add declaration for `void FeatureGate::visit (AST::ExternBlock &block)`. Add private variable `valid_feature`. * checks/errors/rust-feature.h: Change `issue` to `m_issue`. 2023-04-06 Thomas Schwinge * ast/rust-ast-fragment.cc: Update copyright years. * ast/rust-ast-fragment.h: Likewise. * ast/rust-macro.cc: Likewise. * checks/errors/rust-feature-gate.cc: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * checks/errors/rust-feature.cc: Likewise. * checks/errors/rust-feature.h: Likewise. * hir/rust-ast-lower-expr.cc: Likewise. * hir/rust-ast-lower-type.cc: Likewise. * resolve/rust-early-name-resolver.cc: Likewise. * resolve/rust-early-name-resolver.h: Likewise. * rust-gcc.h: Likewise. * typecheck/rust-hir-path-probe.cc: Likewise. * typecheck/rust-hir-trait-reference.cc: Likewise. * typecheck/rust-tyty-bounds.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-unify.cc: Likewise. * typecheck/rust-unify.h: Likewise. * util/rust-inline-visitor.h: Likewise. 2023-04-06 Pierre-Emmanuel Patry * rust-session-manager.cc (Session::compile_crate): Update the environment variable name. 2023-04-06 Pierre-Emmanuel Patry * Make-lang.in: Add `rust-hir-trait-reference.o`. * typecheck/rust-hir-trait-reference.h: Remove multiple function body. * typecheck/rust-hir-trait-reference.cc: Add multiple function body. 2023-04-06 Arthur Cohen * expand/rust-macro-expand.cc (MacroExpander::expand_eager_invocations): Add documentation explaining the algorithm. 2023-04-06 Arthur Cohen * ast/rust-macro.cc: New file. * Make-lang.in: Add `rust-macro.o` object * ast/rust-ast-fragment.cc (Fragment::Fragment): Change API around the construction of AST fragments. (Fragment::operator=): Correct `Fragment::operator=` to take into account the fragment tokens. (Fragment::create_error): Use new constructor. (Fragment::complete): Remove in favor of new constructor. (Fragment::unexpanded): Remove as that Fragment type is no longer used or possible. (Fragment::get_tokens): Add helper to access a fragment's tokens. * ast/rust-ast-fragment.h (enum class): Remove `FragmentKind::Unused` * ast/rust-ast.cc (MacroInvocation::as_string): Display builtin macro invocations properly. * ast/rust-ast.h: Fix `DelimTokenTree` class copy constructors and handling of its token vector. * ast/rust-macro.h (class MacroMatcher): Format. (class MetaItemSeq): Likewise. (builtin_macro_from_string): Get a `BuiltinMacroKind` from a given string, i.e the name of the macro (`assert!`, `cfg!` and so on). * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Do not expand macros recursively anymore. (AttrVisitor::maybe_expand_expr): Likewise. (AttrVisitor::maybe_expand_type): Likewise. * expand/rust-attribute-visitor.h: Likewise, and remove `expand_macro_fragment_recursively` function. * expand/rust-macro-builtins.cc (make_token): Add shorthand for returning `std::unique_ptr`s. (make_macro_invocation): Add shorthand for returning fragments containing builtin macro invocations. (try_expand_macro_expression): Do not expand macros recursively. (try_expand_single_string_literal): Likewise. (try_expand_many_expr): Likewise. (parse_single_string_literal): Error out more appropriately. (MacroBuiltin::compile_error_handler): Add explanation for eager invocation (MacroBuiltin::file_handler): Return the proper tokens associated with macro invocation, and builtin macros in the case of necessary eager expansion. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::include_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_eager_invocations): Add function to expand eager invocations *once* in the fixed point pipeline. (MacroExpander::expand_invoc): Call into `expand_eager_invocations` for builtin macro invocations. (MacroExpander::expand_crate): Use new `AttrVisitor` API. (parse_many): Return tokens in `AST::Fragment`. (transcribe_expression): Likewise. (transcribe_type): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Add `has_changed` flag for fixed point checking. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver): Keep track of the current macro scope. (EarlyNameResolver::go): Use `scoped` API. (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h: Add `scoped` API. * rust-session-manager.cc (Session::expansion): Perform macro expansion in a fixed-point fashion. 2023-04-06 Arthur Cohen * expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::get_token_slice): Add API to retrieve token slices when lexing macro expansions. * expand/rust-macro-invoc-lexer.h: Declare `get_token_slice`. 2023-04-06 Arthur Cohen * parse/rust-parse.h: Move `parse_macro_invocation` to public API. 2023-04-06 Arthur Cohen * ast/rust-item.h (class BlockExpr): Remove forward declaration of class `BlockExpr`. 2023-04-06 Owen Avery * hir/tree/rust-hir-pattern.h (TuplePatternItemsRanged::get_lower_patterns): Add method. (TuplePatternItemsRanged::get_upper_patterns): Add method. * backend/rust-compile-pattern.cc (CompilePatternLet::visit): Implement TuplePattern visitor. * backend/rust-compile-pattern.h (CompilePatternLet::visit): Move TuplePattern visitor out of header file. 2023-04-06 Philip Herron * typecheck/rust-unify.cc (UnifyRules::go): ensure the bounds are checked 2023-04-06 Philip Herron * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): remove error message 2023-04-06 Philip Herron * typecheck/rust-hir-trait-reference.h: add const infterface * typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): make const (SubstitutionRef::monomorphize): fix issue * typecheck/rust-tyty-subst.h: constify interface 2023-04-06 Philip Herron * util/rust-lang-item.h: 2023-04-06 Philip Herron * typecheck/rust-tyty-subst.cc (SubstitutionArg::is_conrete): fix check 2023-04-06 Philip Herron * Make-lang.in: update names * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): update to use new interface * typecheck/rust-coercion.cc (TypeCoercionRules::coerce_borrowed_pointer): likewise * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site): likewise * typecheck/rust-tyty.cc (BaseType::destructure): likewise (InferType::unify): removed old unify interface (ErrorType::unify): likewise (ADTType::unify): likewise (TupleType::unify): likewise (FnType::unify): likewise (FnPtr::unify): likewise (ClosureType::unify): likewise (ArrayType::unify): likewise (SliceType::unify): likewise (BoolType::unify): likewise (IntType::unify): likewise (UintType::unify): likewise (FloatType::unify): likewise (USizeType::unify): likewise (ISizeType::unify): likewise (CharType::unify): likewise (ReferenceType::unify): likewise (PointerType::unify): likewise (ParamType::unify): likewise (StrType::unify): likewise (NeverType::unify): likewise (PlaceholderType::unify): likewise (ProjectionType::unify): likewise (DynamicObjectType::unify): likewise * typecheck/rust-tyty.h: update destructure interface * typecheck/rust-tyty-rules.h: Removed. * typecheck/rust-unify.cc: New file. * typecheck/rust-unify.h: New file. 2023-04-06 Philip Herron * typecheck/rust-hir-trait-reference.h: change interface to return self * typecheck/rust-hir-trait-resolve.cc: likewise * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): likewise * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): remove monomorphization hack 2023-04-06 Philip Herron * typecheck/rust-tyty-subst.cc: add missing callback 2023-04-06 Philip Herron * typecheck/rust-tyty-subst.cc: update copy constructors 2023-04-06 Philip Herron * typecheck/rust-tyty-bounds.cc: refactor to take a reference * typecheck/rust-tyty-subst.cc: likewise (SubstitutionRef::get_substitution_arguments): likewise (SubstitutionRef::infer_substitions): likewise * typecheck/rust-tyty-subst.h: likewise * typecheck/rust-tyty.cc (ADTType::handle_substitions): likewise (TupleType::handle_substitions): likewise (FnType::handle_substitions): likewise (ClosureType::handle_substitions): likewise (ArrayType::handle_substitions): likewise (SliceType::handle_substitions): likewise (ReferenceType::handle_substitions): likewise (PointerType::handle_substitions): likewise (ParamType::handle_substitions): likewise (ProjectionType::handle_substitions): likewise * typecheck/rust-tyty.h: likewise 2023-04-06 Philip Herron * typecheck/rust-hir-trait-ref.h: Moved to... * typecheck/rust-hir-trait-reference.h: ...here. * typecheck/rust-hir-trait-resolve.cc: refactor * typecheck/rust-hir-trait-resolve.h (RUST_HIR_TRAIT_RESOLVE_H): likewise * typecheck/rust-hir-type-check.h: likewise * typecheck/rust-tyty.cc: likewise 2023-04-06 Philip Herron * Make-lang.in: update name * typecheck/rust-tyctx.cc: Moved to... * typecheck/rust-typecheck-context.cc: ...here. 2023-04-06 Philip Herron * typecheck/rust-hir-type-check.h: refactor * typecheck/rust-tyctx.cc (TypeCheckContext::iterate): refactor (TypeCheckContext::have_loop_context): likewise (TypeCheckContext::push_new_loop_context): likewise (TypeCheckContext::push_new_while_loop_context): likewise (TypeCheckContext::peek_loop_context): likewise (TypeCheckContext::pop_loop_context): likewise (TypeCheckContext::swap_head_loop_context): likewise (TypeCheckContext::insert_trait_reference): likewise (TypeCheckContext::lookup_trait_reference): likewise (TypeCheckContext::insert_receiver): likewise (TypeCheckContext::lookup_receiver): likewise (TypeCheckContext::insert_associated_type_mapping): likewise (TypeCheckContext::clear_associated_type_mapping): likewise (TypeCheckContext::lookup_associated_type_mapping): likewise (TypeCheckContext::insert_variant_definition): likewise (TypeCheckContext::lookup_variant_definition): likewise (TypeCheckContext::insert_operator_overload): likewise (TypeCheckContext::lookup_operator_overload): likewise (TypeCheckContext::insert_unconstrained_check_marker): likewise (TypeCheckContext::have_checked_for_unconstrained): likewise (TypeCheckContext::insert_resolved_predicate): likewise (TypeCheckContext::lookup_predicate): likewise (TypeCheckContext::insert_query): likewise (TypeCheckContext::query_completed): likewise (TypeCheckContext::query_in_progress): likewise (TypeCheckContext::insert_trait_query): likewise (TypeCheckContext::trait_query_completed): likewise (TypeCheckContext::trait_query_in_progress): likewise (TypeCheckContextItem::Item::Item): likewise (TypeCheckContextItem::TypeCheckContextItem): likewise (TypeCheckContextItem::get_item): likewise (TypeCheckContextItem::get_impl_item): likewise (TypeCheckContextItem::get_trait_item): likewise (TypeCheckContextItem::get_type): likewise * typecheck/rust-tyty.cc (StructFieldType::StructFieldType): likewise (StructFieldType::get_ref): likewise (StructFieldType::get_name): likewise (StructFieldType::get_field_type): likewise (StructFieldType::set_field_type): likewise (StructFieldType::is_concrete): likewise (StructFieldType::debug): likewise (StructFieldType::get_locus): likewise (VariantDef::variant_type_string): likewise (VariantDef::VariantDef): likewise (VariantDef::operator=): likewise (VariantDef::get_error_node): likewise (VariantDef::is_error): likewise (VariantDef::get_id): likewise (VariantDef::get_defid): likewise (VariantDef::get_variant_type): likewise (VariantDef::is_data_variant): likewise (VariantDef::is_dataless_variant): likewise (VariantDef::get_identifier): likewise (VariantDef::num_fields): likewise (VariantDef::get_field_at_index): likewise (VariantDef::get_fields): likewise (VariantDef::lookup_field): likewise (VariantDef::get_discriminant): likewise (VariantDef::as_string): likewise (VariantDef::is_equal): likewise (VariantDef::clone): likewise (VariantDef::monomorphized_clone): likewise (VariantDef::get_ident): likewise (TupleType::TupleType): likewise (TupleType::get_unit_type): likewise (TupleType::is_unit): likewise (TupleType::num_fields): likewise (TupleType::is_concrete): likewise (TupleType::get_fields): likewise (BoolType::BoolType): likewise (BoolType::get_name): likewise (BoolType::is_concrete): likewise (IntType::IntType): likewise (IntType::get_name): likewise (IntType::get_int_kind): likewise (IntType::is_concrete): likewise (UintType::UintType): likewise (UintType::get_name): likewise (UintType::get_uint_kind): likewise (UintType::is_concrete): likewise (FloatType::FloatType): likewise (FloatType::get_name): likewise (FloatType::get_float_kind): likewise (FloatType::is_concrete): likewise (USizeType::USizeType): likewise (USizeType::get_name): likewise (USizeType::is_concrete): likewise (ISizeType::ISizeType): likewise (ISizeType::get_name): likewise (ISizeType::is_concrete): likewise (CharType::CharType): likewise (CharType::is_concrete): likewise (CharType::get_name): likewise (ReferenceType::ReferenceType): likewise (ReferenceType::is_concrete): likewise (ReferenceType::mutability): likewise (ReferenceType::is_mutable): likewise (ReferenceType::is_dyn_object): likewise (ReferenceType::is_dyn_slice_type): likewise (ReferenceType::is_dyn_str_type): likewise (PointerType::PointerType): likewise (PointerType::is_concrete): likewise (PointerType::mutability): likewise (PointerType::is_mutable): likewise (PointerType::is_const): likewise (PointerType::is_dyn_object): likewise (PointerType::is_dyn_slice_type): likewise (PointerType::is_dyn_str_type): likewise (ParamType::ParamType): likewise (ParamType::get_generic_param): likewise (ParamType::can_resolve): likewise (ParamType::is_concrete): likewise (StrType::StrType): likewise (StrType::get_name): likewise (StrType::is_concrete): likewise (NeverType::NeverType): likewise (NeverType::get_name): likewise (NeverType::is_unit): likewise (NeverType::is_concrete): likewise (PlaceholderType::PlaceholderType): likewise (PlaceholderType::get_name): likewise (PlaceholderType::is_unit): likewise (PlaceholderType::get_symbol): likewise (PlaceholderType::is_concrete): likewise (ProjectionType::is_unit): likewise (ProjectionType::get_name): likewise (ProjectionType::needs_generic_substitutions): likewise (ProjectionType::supports_substitutions): likewise (ProjectionType::has_subsititions_defined): likewise (ProjectionType::get): likewise (ProjectionType::is_concrete): likewise (DynamicObjectType::is_concrete): likewise * typecheck/rust-tyty.h: likewise 2023-04-06 Philip Herron * typecheck/rust-hir-path-probe.cc (PathProbeCandidate::Candidate::Candidate): refactor (PathProbeCandidate::PathProbeCandidate): likewise (PathProbeCandidate::as_string): likewise (PathProbeCandidate::is_enum_candidate): likewise (PathProbeCandidate::is_impl_candidate): likewise (PathProbeCandidate::is_trait_candidate): likewise (PathProbeCandidate::is_full_trait_item_candidate): likewise (PathProbeCandidate::get_error): likewise (PathProbeCandidate::is_error): likewise (PathProbeCandidate::get_defid): likewise (PathProbeCandidate::operator<): likewise * typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): likewise 2023-04-06 Philip Herron * typecheck/rust-hir-path-probe.cc (PathProbeType::PathProbeType): refactor (PathProbeType::Probe): likewise (PathProbeType::visit): likewise (PathProbeType::process_enum_item_for_candiates): likewise (PathProbeType::process_impl_items_for_candidates): likewise (PathProbeType::is_reciever_generic): likewise (PathProbeImplTrait::PathProbeImplTrait): likewise (PathProbeImplTrait::Probe): likewise (PathProbeImplTrait::process_trait_impl_items_for_candidates): likewise * typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): likewise * typecheck/rust-hir-trait-resolve.cc (PathProbeImplTrait::process_trait_impl_items_for_candidates): likewise 2023-04-06 Philip Herron * typecheck/rust-tyty.cc (BaseType::BaseType): refactor (BaseType::~BaseType): likewise (BaseType::get_ref): likewise (BaseType::set_ref): likewise (BaseType::get_ty_ref): likewise (BaseType::set_ty_ref): likewise (BaseType::is_equal): likewise (BaseType::is_unit): likewise (BaseType::get_kind): likewise (BaseType::get_combined_refs): likewise (BaseType::append_reference): likewise (BaseType::supports_substitutions): likewise (BaseType::has_subsititions_defined): likewise (BaseType::can_substitute): likewise (BaseType::needs_generic_substitutions): likewise (BaseType::contains_type_parameters): likewise (BaseType::get_ident): likewise (BaseType::get_locus): likewise (InferType::InferType): likewise (InferType::get_infer_kind): likewise (InferType::get_name): likewise (InferType::is_concrete): likewise (ErrorType::ErrorType): likewise (ErrorType::is_unit): likewise (ErrorType::is_concrete): likewise (ErrorType::get_name): likewise (ErrorType::monomorphized_clone): likewise * typecheck/rust-tyty.h (class SubstitutionArgumentMappings): likewise 2023-04-06 Philip Herron * typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): refactor (SubstMapper::Resolve): likewise (SubstMapper::InferSubst): likewise (SubstMapper::have_generic_args): likewise (SubstMapper::visit): likewise (SubstMapperInternal::visit): likewise (SubstMapperFromExisting::SubstMapperFromExisting): likewise (SubstMapperFromExisting::Resolve): likewise (SubstMapperFromExisting::visit): likewise (GetUsedSubstArgs::GetUsedSubstArgs): likewise (GetUsedSubstArgs::From): likewise (GetUsedSubstArgs::visit): likewise * typecheck/rust-substitution-mapper.h: refactor * typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): likewise 2023-04-06 Philip Herron * Make-lang.in: update the makefile * typecheck/rust-tyty.cc (SubstitutionParamMapping::need_substitution): likewise (SubstitutionParamMapping::override_context): likewise (SubstitutionRef::get_mappings_from_generic_args): likewise (SubstitutionRef::infer_substitions): likewise (SubstitutionRef::are_mappings_bound): likewise (SubstitutionRef::solve_missing_mappings_from_this): likewise (SubstitutionRef::monomorphize): likewise * typecheck/rust-tyty.h (class SubstitutionParamMapping): likewise (class SubstitutionArg): likewise (std::function * Make-lang.in: update makefile * typecheck/rust-tyty.cc (TyVar::TyVar): move to new file (TyVar::get_tyty): likewise (TyVar::get_implicit_infer_var): likewise (TyVar::subst_covariant_var): likewise (TyVar::clone): likewise (TyVar::monomorphized_clone): likewise (TyWithLocation::TyWithLocation): likewise * typecheck/rust-tyty.h (class BaseType): cleanup (class TypeBoundPredicate): move to its own file (class TypeBoundPredicateItem): likewise (class TypeBoundsMappings): likewise (class TyVar): likewise (class TyWithLocation): likewise * typecheck/rust-tyty-bounds.h: New file. * typecheck/rust-tyty-util.cc: New file. * typecheck/rust-tyty-util.h: New file. 2023-04-06 Philip Herron * typecheck/rust-tyty-bounds.cc (TypeBoundPredicateItem::error): refactor (TypeBoundPredicateItem::is_error): likewise (TypeBoundPredicateItem::get_parent): likewise * typecheck/rust-tyty.h: Move the implementation for the above 2023-04-06 Owen Avery * backend/rust-compile-expr.cc (CompileExpr::visit): Removed copy-pasted comment. 2023-04-06 mxlol233 * Make-lang.in: Add object files: `rust-feature.o` and `rust-feature-gate.o` * checks/errors/rust-feature-gate.cc: New file. * checks/errors/rust-feature-gate.h: New file. * checks/errors/rust-feature.cc: New file. * checks/errors/rust-feature.h: New file. * rust-session-manager.cc: Add FeatureGate check. 2023-04-06 Arthur Cohen * parse/rust-parse-impl.h (Parser::parse_closure_expr): Advance tokens properly when parsing closure param list. 2023-04-06 Arthur Cohen * parse/rust-parse-impl.h (Parser::parse_generic_arg): Handle type paths and nested generics properly. 2023-04-06 Owen Avery * ast/rust-pattern.h: (ReferencePattern::is_double_reference): Add method. (ReferencePattern::get_is_mut): Add method. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add ReferencePattern visitor. * hir/rust-ast-lower-pattern.h: (ASTLoweringPattern::visit): Add ReferencePattern visitor. 2023-04-06 Owen Avery * hir/tree/rust-hir-pattern.h (class ReferencePattern): Remove has_two_amps field. * hir/tree/rust-hir-full-test.cc (ReferencePattern::as_string): Remove usage of ReferencePattern::has_two_amps. 2023-04-06 Owen Avery * backend/rust-compile-fnparam.h (CompileFnParam::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-pattern.h (CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor. (CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor. (CompilePatternLet::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-resolve-path.h (ResolvePathRef::visit): Remove HIR::GroupedPattern visitor. * backend/rust-compile-var-decl.h (CompileVarDecl::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-const-checker.h (ConstChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Remove HIR::GroupedPattern visitor. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Remove HIR::GroupedPattern visitor. * hir/rust-hir-dump.cc (Dump::visit): Remove HIR::GroupedPattern visitor. * hir/rust-hir-dump.h (Dump::visit): Remove HIR::GroupedPattern visitor. * hir/tree/rust-hir-full-decls.h (class GroupedPattern): Remove class. * hir/tree/rust-hir-full-test.cc (GroupedPattern::accept_vis): Remove method. * hir/tree/rust-hir-pattern.h (class GroupedPattern): Remove class. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Remove HIR::GroupedPattern visitor. (HIRFullVisitorBase::visit): Remove HIR::GroupedPattern visitor. (HIRPatternVisitor::visit): Remove HIR::GroupedPattern visitor. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor. * typecheck/rust-hir-type-check-pattern.h (TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor. 2023-04-06 Owen Avery * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Lower AST::GroupedPattern to its inner pattern. 2023-04-06 MAHAD * rust-buffered-queue.h: Moved to... * util/rust-buffered-queue.h: ...here. 2023-04-06 Arthur Cohen * parse/rust-parse-impl.h (Parser::parse_type): Handle double ampersan properly (Parser::parse_reference_type): Call into `parse_reference_type_inner` and wrap double reference types in another `AST::ReferenceType` node (Parser::parse_reference_type_inner): Add parsing implementation which does not care about the leading token (& or &&) (Parser::parse_type_no_bounds): Handle double ampersand properly * parse/rust-parse.h: Declare `parse_reference_type_inner` 2023-04-06 Owen Avery * backend/rust-compile-pattern.cc (CompilePatternLet::visit): New function. * backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise. * backend/rust-compile-pattern.h (class CompilePatternLet): New visitor. 2023-04-06 Arthur Cohen * ast/rust-macro.h (enum class): Add `BuiltinMacro` enum class. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Mention switching on `macro.kind` once builtin macro invocations are properly handled. * parse/rust-parse-impl.h (Parser::parse_macro_invocation): Switch to new MacroInvocation API. (Parser::parse_type): Likewise. (Parser::parse_type_no_bounds): Likewise. 2023-04-06 Abdul Rafey * ast/rust-ast-dump.cc (Dump::visit): removed extra indentations in trait ast dump 2023-04-06 Abdul Rafey * parse/rust-parse-impl.h (Parser::null_denotation): Add proper error when seeing wildcard var on right side of assignment. 2023-04-06 Abdul Rafey * ast/rust-ast.cc: Fix include list. * ast/rust-expr.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * rust-backend.h: Likewise. * util/rust-lang-item.h: Likewise. * operator.h: Moved to... * util/rust-operators.h: ...here. 2023-04-06 Parthib * Make-lang.in: Rename object file. * ast/rust-ast-full-test.cc: Moved to... * ast/rust-ast.cc: ...here. 2023-04-06 Owen Avery * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add proper visitor. (CompilePatternBindings::visit): Likewise. * backend/rust-compile-pattern.h: Declare them. 2023-04-06 Owen Avery * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add proper visitor. 2023-04-06 Owen Avery * hir/tree/rust-hir-pattern.h: Add get_item method. 2023-04-06 Owen Avery * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add proper visitor. * hir/rust-ast-lower-pattern.h: Declare it. 2023-04-06 Lyra * expand/rust-macro-expand.cc (transcribe_expression): Fix ICE when expanding empty macros. 2023-04-06 Owen Avery * resolve/rust-ast-resolve-pattern.h: Support GroupedPattern properly. 2023-04-06 Owen Avery * backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block): Allow patterns to declare zero or multiple variables. * backend/rust-compile-var-decl.h: Change function declaration. 2023-04-06 mxlol233 * lex/rust-lex.cc (Lexer::build_token): Make location enclose entire token. (Lexer::parse_byte_char): Likewise. (Lexer::parse_byte_string): Likewise. (Lexer::parse_raw_byte_string): Likewise. (Lexer::parse_raw_identifier): Likewise. (Lexer::parse_string): Likewise. (Lexer::parse_identifier_or_keyword): Likewise. (Lexer::parse_raw_string): Likewise. (Lexer::parse_non_decimal_int_literal): Likewise. (Lexer::parse_decimal_int_or_float): Likewise. (Lexer::parse_char_or_lifetime): Likewise. 2023-04-06 mxlol233 * ast/rust-ast.h: Add get_locus method. * ast/rust-expr.h: Likewise. * ast/rust-macro.h: Likewise. 2023-04-06 Owen Avery * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Cleanup LetStmt type checking. 2023-04-06 Philip Herron * hir/tree/rust-hir-path.h: Add const get_identifier and get_type method. * typecheck/rust-hir-path-probe.h: Use new SubstitutionArgumentMappings constructor. * typecheck/rust-hir-trait-resolve.cc: Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Do not assert failure on size mismatch anymore. (TypeBoundPredicate::TypeBoundPredicate): Use new SubstitutionArgumentMappings constructor. (TypeBoundPredicate::operator=): Likewise. (TypeBoundPredicate::apply_generic_arguments): Likewise. (TypeBoundPredicateItem::get_tyty_for_receiver): Likewise. (TypeBoundPredicate::get_num_associated_bindings): Likewise. (TypeBoundPredicate::lookup_associated_type): Fix implementation for new system. (TypeBoundPredicate::get_associated_type_items): Likewise. * typecheck/rust-tyty.cc (SubstitutionRef::get_mappings_from_generic_args): Add new behavior. (SubstitutionRef::infer_substitions): Use new constructor and add comment. (SubstitutionRef::solve_missing_mappings_from_this): Use new constructor. * typecheck/rust-tyty.h: Define new constructors. 2023-04-06 Philip Herron * resolve/rust-ast-resolve-type.cc (ResolveGenericArgs::go): Add name resolution to Trait items. 2023-04-06 Raiki Tamura * ast/rust-ast-full-decls.h (class MacroItem): Remove forward declaration. * ast/rust-ast-full-test.cc (MacroRulesDefinition): Rework MacroRulesDefinition class * ast/rust-ast.h (class MacroItem): Remove abstract class. * ast/rust-item.h (class MacroItem): Remove forward declaration. * ast/rust-macro.h (class MacroItem): Likewise. (class MacroRulesDefinition): Add MacroKind enum. (class MacroInvocation): Fix inheritance. * lex/rust-token.h: Token "macro" is now used. * parse/rust-parse-impl.h (Parser::parse_item): Add handling for MACRO. (Parser::parse_vis_item): Call into parse_decl_macro_def. (Parser::parse_macro_item): Delete function. (Parser::parse_macro_rules_def): Return MBE macros only. (Parser::parse_decl_macro_def): New function. (Parser::parse_stmt): Handle MACRO token. (Parser::parse_stmt_or_expr_without_block): Call into parse_macro_rules_def. * parse/rust-parse.h: Declare new function. 2023-04-06 mxlol233 * parse/rust-parse-impl.h (Parser::parse_generic_arg): Add proper bound parsing. 2023-04-06 Dave * checks/errors/rust-const-checker.cc (ConstChecker::visit): Use StackedContext class. 2023-04-06 Prajwal S N * checks/errors/rust-unsafe-checker.cc (check_target_attr): New function. (UnsafeChecker::check_function_attr): Call into `check_target_attr`. (UnsafeChecker::visit): Check for target_feature attributes. * checks/errors/rust-unsafe-checker.h: Add declarations. * util/rust-attributes.cc: Add attribute. 2023-04-06 Arthur Cohen * rust-session-manager.cc (Session::compile_crate): Fix typo. 2023-02-22 Thomas Schwinge * rust-lang.cc (grs_langhook_type_for_mode): Also consider all 'int_n' modes/types. 2023-02-22 Thomas Schwinge * rust-lang.cc (grs_langhook_init): Do not initialize void_list_node. 2023-02-22 Thomas Schwinge * config-lang.in (target_libs): Remove. 2023-02-21 Raiki Tamura * backend/rust-builtins.cc (BuiltinsContext::setup_math_fns): New functions. 2023-02-21 Arthur Cohen * backend/rust-constexpr.cc (get_nth_callarg): Remove function. (rs_bind_parameters_in_call): Use CALL_EXPR_ARG instead. (potential_constant_expression_1): Likewise. 2023-02-21 Thomas Schwinge * lang.opt: Fix ordering of file. 2023-02-21 Philip Herron * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Remove unused parameters. * backend/rust-constexpr.cc (constant_value_1): Likewise. (fold_non_dependent_init): Likewise. * backend/rust-tree.cc (publicly_uniquely_derived_p): Likewise. (instantiation_dependent_expression_p): Likewise. (type_has_nontrivial_copy_init): Likewise. (is_normal_capture_proxy): Likewise. (resolve_nondeduced_context): Likewise. (undeduced_auto_decl): Likewise. (require_deduced_type): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::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::go): Likewise. * checks/lints/rust-lint-unused-var.cc (unused_var_walk_fn): Likewise. * expand/rust-macro-builtins.cc (try_expand_single_string_literal): Likewise. (try_expand_many_expr): Likewise. (parse_single_string_literal): Likewise. (MacroBuiltin::assert_handler): Likewise. (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. (ASTLoweringBase::handle_doc_item_attribute): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/tree/rust-hir-full-test.cc (ConstGenericParam::accept_vis): Likewise. * lex/rust-lex.cc (Lexer::parse_utf8_escape): Likewise. (Lexer::parse_string): Likewise. (Lexer::parse_char_or_lifetime): Likewise. * lex/rust-lex.h: Likewise. * metadata/rust-export-metadata.cc: Likewise. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise. * resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise. (ResolveTypeToCanonicalPath::visit): Likewise. * resolve/rust-ast-verify-assignee.h: Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * typecheck/rust-hir-type-check-item.h: Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise. * typecheck/rust-tyty-rules.h: Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. 2023-02-21 Philip Herron * hir/tree/rust-hir-expr.h: Add const `get_method_name`. * hir/tree/rust-hir-full-decls.h (struct GenericArgs): Move from `struct`... (class GenericArgs): ...to `class`. * hir/tree/rust-hir-path.h (struct GenericArgs): Likewise. (class GenericArgs): Clear `type_args` in copy constructor. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Reorder debug print. * typecheck/rust-tyty.h: Add default constructors for `SubstitutionArgumentMappings`. 2023-02-21 Philip Herron * backend/rust-compile-context.cc (Context::push_closure_context): New function. (Context::pop_closure_context): Likewise. (Context::insert_closure_binding): Likewise. (Context::lookup_closure_binding): Likewise. * backend/rust-compile-context.h: Declare new functions and closure mappings. * backend/rust-compile-expr.cc (CompileExpr::visit): Visit captures properly. (CompileExpr::generate_closure_function): Compile captures properly. * backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Check for closure bindings. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Compile capture list's types as well. 2023-02-21 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Pass captures properly to `TyTy::ClosureType` constructor. * typecheck/rust-tyty.cc (ClosureType::as_string): Fix string representation. (ClosureType::clone): Pass `captures` argument. * typecheck/rust-tyty.h: Add `captures` field. 2023-02-21 Philip Herron * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Use proper closure contexts. * resolve/rust-name-resolver.cc (Scope::lookup_decl_type): New function. (Scope::lookup_rib_for_decl): Likewise. (Resolver::insert_resolved_name): Insert captured items. (Resolver::push_closure_context): New function. (Resolver::pop_closure_context): Likewise. (Resolver::insert_captured_item): Likewise. (Resolver::decl_needs_capture): Likewise. (Resolver::get_captures): Likewise. * resolve/rust-name-resolver.h: Declare new functions. 2023-02-21 Philip Herron * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add Rib argument. (ResolveExpr::resolve_closure_param): Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): 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 (Rib::lookup_decl_type): Likewise. (Scope::insert): Likewise. (Resolver::insert_builtin_types): Likewise. * resolve/rust-name-resolver.h: Likewise. 2023-02-21 Philip Herron * resolve/rust-name-resolver.cc (MKBUILTIN_TYPE): Remove macro. (Rib::Rib): Remove `mappings` field. (Resolver::generate_builtins): Use `setup_builtin` instead of macro. (Resolver::setup_builtin): New function. * resolve/rust-name-resolver.h: Declare `setup_builtin`, add FIXME comment. 2023-02-21 Raiki Tamura * lex/rust-lex.cc (Lexer::Lexer): Add `dump_lex` boolean flag. (Lexer::skip_token): Dump tokens if flag is enabled. (Lexer::dump_and_skip): New function. * lex/rust-lex.h: Include optional.h and declare functions. * parse/rust-parse-impl.h (Parser::debug_dump_lex_output): Remove old unused function. * parse/rust-parse.h: Likewise. * rust-session-manager.cc (Session::compile_crate): Pass lexer dump option to lexer. (Session::dump_lex): New function. * util/rust-optional.h: Add missing constructor. 2023-02-21 Dave * ast/rust-item.h: Remoe default location for Visibility class. * parse/rust-parse-impl.h (Parser::parse_visibility): Pass proper location when instantiating visibilities. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Remove extraneous string when dumping statements. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc: Remove unused include. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Likewise. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Add missing getter declaration. * ast/rust-ast-full-test.cc (BareFunctionType::as_string): Fix bare function string representation. * ast/rust-type.h (class BareFunctionType): Declare said getter. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing tuple type visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing never type visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing RawPointer visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing array visitor 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing slice visitor. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add missing visitors. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast.h: Add `get_lifetime_bounds` method. * ast/rust-item.h: Add missing getter for lifetimes. * ast/rust-type.h: Likewise. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add new reference visitor wrapper. * ast/rust-ast-dump.h: Declare it. * ast/rust-item.h: Add mutable visibility getters. 2023-02-21 Arthur Cohen * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Fix extra call to `delete`. 2023-02-21 Dave * ast/rust-item.h: Add location member. * hir/rust-ast-lower.cc (translate_visibility): Pass location argument. * hir/tree/rust-hir-item.h: Fix constructor to accept Location argument. 2023-02-21 Raiki Tamura * util/rust-lang-item.h: Add handling for `phantom_data` lang item. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add handling for unit structures. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.h: Fix documentation. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::go): Use new API. (Dump::format_function_param): Refactor. (Dump::visit_items_joined_by_separator): New function. (Dump::emit_attrib): Refactor. (Dump::visit_as_line): New function. (Dump::visit_items_as_lines): Likewise. (Dump::visit_items_as_block): Likewise. (Dump::visit): Use new API. (Dump::emit_visibility): Likewise. (Dump::emit_indented_string): Likewise. (Dump::emit_generic_params): Likewise. (Dump::format_tuple_field): Likewise. (Dump::format_struct_field): Likewise. (Dump::format_function_common): Likewise. (Dump::visit_function_common): Likewise. * ast/rust-ast-dump.h: Declare new functions and add documentation. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add new visit function for overloading. * ast/rust-ast-dump.h: Add documentation for layer. 2023-02-21 Arthur Cohen * backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): Declare atomic load intrinsics. * backend/rust-compile-intrinsic.cc (atomic_load_handler_inner): New handler. (atomic_load_handler): Likewise. (unchecked_op_handler): Remove `static` function qualifier. (build_atomic_builtin_name): Handle load intrinsics. (atomic_store_handler_inner): New handler. 2023-02-21 Arthur Cohen * backend/rust-compile-intrinsic.cc (check_for_basic_integer_type): New function. (build_atomic_builtin_name): Use HIR Type instead of `tree`. (atomic_store_handler_inner): Cleanup error handling. (unchecked_op_inner): Likewise. 2023-02-21 Arthur Cohen * backend/rust-compile-intrinsic.cc (wrapping_op_handler): Refactor to return an `std::function`. (wrapping_op_handler_inner): Rename. (wrapping_add_handler): Remove function. (wrapping_sub_handler): Likewise. (wrapping_mul_handler): Likewise. 2023-02-21 Arthur Cohen * backend/rust-compile-intrinsic.cc (is_basic_integer_type): New function. (unchecked_op_inner): New handler. (unchecked_op_handler): New handler. 2023-02-21 Arthur Cohen * backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): New function. (BuiltinsContext::setup): Call `setup_atomic_fns`. * backend/rust-builtins.h: Declare `setup_atomic_fns`. * backend/rust-compile-intrinsic.cc (atomic_store_handler_inner): New function. (atomic_store_handler): New handler. (make_unsigned_long_tree): Add helper around making unsigned long trees. (prefetch_data_handler): Use `make_unsigned_long_tree`. (build_atomic_builtin_name): New function. 2023-02-21 Arthur Cohen * backend/rust-constexpr.cc (build_anon_member_initialization): Workaround uninitialized values. (build_data_member_initialization): Likewise. 2023-02-21 Arthur Cohen * backend/rust-compile-intrinsic.cc (sorry_handler): New intrinsic handler. 2023-02-21 Arthur Cohen * expand/rust-macro-builtins.cc (MacroBuiltin::assert): Rename to... (MacroBuiltin::assert_handler): ..this. (MacroBuiltin::file): Rename to... (MacroBuiltin::file_handler): ..this. (MacroBuiltin::column): Rename to... (MacroBuiltin::column_handler): ..this. (MacroBuiltin::include_bytes): Rename to... (MacroBuiltin::include_bytes_handler): ..this. (MacroBuiltin::include_str): Rename to... (MacroBuiltin::include_str_handler): ..this. (MacroBuiltin::compile_error): Rename to... (MacroBuiltin::compile_error_handler): ..this. (MacroBuiltin::concat): Rename to... (MacroBuiltin::concat_handler): ..this. (MacroBuiltin::env): Rename to... (MacroBuiltin::env_handler): ..this. (MacroBuiltin::cfg): Rename to... (MacroBuiltin::cfg_handler): ..this. (MacroBuiltin::include): Rename to... (MacroBuiltin::include_handler): ..this. (MacroBuiltin::line): Rename to... (MacroBuiltin::line_handler): ..this. * expand/rust-macro-builtins.h: Rename all handlers. * util/rust-hir-map.cc (Mappings::insert_macro_def): Use new handler names. 2023-02-21 Simon Cook * util/rust-inline-visitor.h: Remove some offending system includes. 2023-02-21 YizhePKU * util/rust-inline-visitor.h: New file. 2023-02-21 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::visit): Refactor checking of closures. (CompileExpr::generate_possible_fn_trait_call): New function. * backend/rust-compile-expr.h: Declare `generate_possible_fn_trait_call`. 2023-02-21 Philip Herron * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Add missing implementation. 2023-02-21 Philip Herron * Make-lang.in: Compile rust-ast-lower-type.cc. * ast/rust-path.h: Add `get_locus` method to `TypePathFunction`. * hir/rust-ast-lower-base.cc (ASTLowerTypePath::visit): Move implementation to rust-ast-lower-type.cc. (ASTLowerQualifiedPathInType::visit): Likewise. (ASTLoweringType::visit): Likewise. * hir/rust-ast-lower-type.h: Move implementations to source file. * hir/tree/rust-hir-path.h: Likewise. * hir/rust-ast-lower-type.cc: New file. 2023-02-21 Philip Herron * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Add missing handling of function case. 2023-02-21 Philip Herron * backend/rust-compile-context.h: Add new functions: `insert_closure_decl` and `lookup_closure_decl`. * backend/rust-compile-expr.cc (CompileExpr::visit): Start compiling Closures properly. (CompileExpr::generate_closure_function): New function. (CompileExpr::generate_closure_fntype): Likewise. * backend/rust-compile-expr.h: Declare `generate_closure_function` and `generate_closure_fntype`. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Visit closure types properly. * backend/rust-mangle.cc (legacy_mangle_name): Add support for closures. * backend/rust-tree.h (RS_CLOSURE_FLAG): Add new tree macro. (RS_CLOSURE_TYPE_P): And checking for it on tree nodes. * typecheck/rust-tyty.cc (ClosureType::is_equal): Add implementation. 2023-02-21 Philip Herron * hir/tree/rust-hir-expr.h: Add `get_params` method. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Typecheck closure nodes. (TypeCheckExpr::resolve_fn_trait_call): New function. * typecheck/rust-hir-type-check-expr.h: Declare `resolve_fn_trait_call` and `resolve_possible_fn_trait_call_method_name`. * typecheck/rust-hir-type-check.h: Declare `get_context_type`. * typecheck/rust-tyctx.cc (TypeCheckContextItem::get_context_type): New function. * typecheck/rust-tyty-cmp.h: Visit closures properly. * typecheck/rust-tyty-rules.h: Likewise. * typecheck/rust-tyty.cc (BaseType::bounds_compatible): Add commented out assertin. (ClosureType::as_string): Implement it. (ClosureType::clone): Fix closure cloning. (ClosureType::setup_fn_once_output): New function. * typecheck/rust-tyty.h: Improve `ClosureType` class and declare `setup_fn_once_output`. 2023-02-21 Philip Herron * checks/errors/rust-const-checker.cc (ConstChecker::visit): Visit closures properly. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/lints/rust-lint-marklive.h: Likewise. 2023-02-21 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Simplify method call type checking by removing visitor and instead using one static cast. Use the new interface. * typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::visit): Likewise. (TypeCheckMethodCallExpr::go): Likewise. (TypeCheckMethodCallExpr::check): Likewise. * typecheck/rust-tyty-call.h (class TypeCheckMethodCallExpr): Likewise. (class Argument): Likewise. 2023-02-21 Philip Herron * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Visit closure properly when name resolving. (ResolveExpr::resolve_closure_param): Implement closure name resolving. * resolve/rust-ast-resolve-expr.h: Declare visitors for closure types. 2023-02-21 Philip Herron * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::ASTLoweringPattern): Improve formatting. (ASTLoweringPattern::translate): Likewise. * hir/rust-ast-lower-pattern.h: Likewise. * resolve/rust-ast-resolve-expr.h: Likewise. 2023-02-21 Philip Herron * Make-lang.in: Add new object file for expression lowering. * ast/rust-expr.h: Move implementation of expr lowering to source file. * backend/rust-compile-block.h: Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-expr.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-base.h: Likewise. * hir/rust-ast-lower-expr.h (RUST_AST_LOWER_EXPR): Likewise. * hir/rust-ast-lower.cc (ASTLoweringBase::lower_closure_param): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-expr.h (class ClosureExpr): Likewise. (class ClosureExprInner): Likewise. (class ClosureExprInnerTyped): Likewise. * hir/tree/rust-hir-full-decls.h (class ClosureExprInner): Likewise. (class ClosureExprInnerTyped): Likewise. * hir/tree/rust-hir-full-test.cc (ClosureExprInnerTyped::as_string): Likewise. (ClosureExprInner::as_string): Likewise. (ClosureExprInner::accept_vis): Likewise. (ClosureExpr::accept_vis): Likewise. (ClosureExprInnerTyped::accept_vis): Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * hir/tree/rust-hir.h (class Expr): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * hir/rust-ast-lower-expr.cc: New file. 2023-02-21 Philip Herron * util/rust-lang-item.h: Add handling for `fn_once_output`. 2023-02-21 Arthur Cohen * ast/rust-ast-fragment.cc (Fragment::Fragment): Add better APIs. (Fragment::complete): New function. (Fragment::unexpanded): New function. * ast/rust-ast-fragment.h: Declare new APIs and add documentation. * expand/rust-attribute-visitor.h: Use new Fragment API. * expand/rust-macro-builtins.cc (MacroBuiltin::file): Likewise. (MacroBuiltin::column): Likewise. (MacroBuiltin::include_bytes): Likewise. (MacroBuiltin::include_str): Likewise. (MacroBuiltin::concat): Likewise. (MacroBuiltin::env): Likewise. (MacroBuiltin::cfg): Likewise. (MacroBuiltin::include): Likewise. (MacroBuiltin::line): Likewise. * expand/rust-macro-expand.cc (parse_many): Likewise. (transcribe_expression): Likewise. (transcribe_type): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Likewise. 2023-02-21 Arthur Cohen * ast/rust-ast.h (class ASTFragment): Remove old ASTFragment class. * ast/rust-macro.h (class MacroRulesDefinition): Use new Fragment API. * expand/rust-attribute-visitor.h: Likewise. * expand/rust-macro-builtins.cc (macro_end_token): Likewise. (MacroBuiltin::assert): Likewise. (MacroBuiltin::file): Likewise. (MacroBuiltin::column): Likewise. (MacroBuiltin::include_bytes): Likewise. (MacroBuiltin::include_str): Likewise. (MacroBuiltin::compile_error): Likewise. (MacroBuiltin::concat): Likewise. (MacroBuiltin::env): Likewise. (MacroBuiltin::cfg): Likewise. (MacroBuiltin::include): Likewise. (MacroBuiltin::line): Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise. (MacroExpander::expand_invoc): Likewise. (MacroExpander::match_repetition): Likewise. (parse_many): Likewise. (transcribe_many_items): Likewise. (transcribe_many_ext): Likewise. (transcribe_many_trait_items): Likewise. (transcribe_many_impl_items): Likewise. (transcribe_many_trait_impl_items): Likewise. (transcribe_expression): Likewise. (transcribe_type): Likewise. (transcribe_on_delimiter): Likewise. (tokens_to_str): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Likewise. * util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise. 2023-02-21 Arthur Cohen * Make-lang.in: Add `rust-ast-fragment.o` object file. * ast/rust-ast-fragment.cc: New file. * ast/rust-ast-fragment.h: New file. 2023-02-21 Philip Herron * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Check if a trait query is currently in progress. * typecheck/rust-hir-type-check.h (class TraitQueryGuard): Add helpers around checking for trait queries and inserting them. 2023-02-21 Arthur Cohen * ast/rust-ast-dump.cc (Dump::visit): Add missing visitors for macro definition dumping. (get_delimiters): New function. * ast/rust-ast-dump.h: Declare `get_delimiters` and add documentation. * ast/rust-macro.h: Add `get_token_tree` method. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Properly handle unloaded modules. 2023-02-21 Arthur Cohen * ast/rust-ast-dump.cc (Dump::visit): Fix formatting when dumping modules. 2023-02-21 Arthur Cohen * ast/rust-ast-dump.cc (Dump::visit): Dump items in modules properly. 2023-02-21 Arthur Cohen * ast/rust-ast-dump.cc: Emit visibility when dumping items. 2023-02-21 Philip Herron * hir/rust-ast-lower-base.h (class ItemWrapper): New class. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Use `ItemWrapper` class. (ASTLoweringBase::handle_doc_item_attribute): Likewise. (ASTLoweringBase::handle_lang_item_attribute): Likewise. * hir/rust-ast-lower-implitem.h: Check outer attributes on items. * hir/tree/rust-hir-item.h: Add `get_trait_locus` methods. * hir/tree/rust-hir.h: Likewise. * util/rust-hir-map.h: Add defId mappings and associated functions. * util/rust-hir-map.cc (Mappings::insert_defid_mapping): Implement insertion to said mappings. (Mappings::lookup_trait_item_defid): And looking up said mappings. 2023-02-21 Jakub Dupak * ast/rust-ast-dump.cc (Dump::visit): Add code for dumping type aliases. 2023-02-21 Philip Herron * typecheck/rust-hir-trait-resolve.cc (TraitResolver::TraitResolver): Do not nullptr init `resolved_trait_reference` anymore. (TraitResolver::resolve_path): Simplify function and rename to... (TraitResolver::resolve_path_to_trait): ...this. (TraitResolver::lookup_path): Use new interface. * typecheck/rust-hir-trait-resolve.h (class TraitResolver): Do not inherit `HIRFullVisitor` class anymore. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Add dump for RangeExprs. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Add dump for, BorrowExpr, DereferenceExpr, ErrorPropagationExpr, NegationExpr, TypeCastExpr and GroupedExpr. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Add dump code for ArrayExpr. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Add dumps for ComparisonExpr and LazyBooleanExpr. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Fix IfExpr formatting. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Fix block formatting. 2023-02-21 Philip Herron * typecheck/rust-autoderef.cc: Add support for multiple resolution candidates. * typecheck/rust-hir-dot-operator.cc (MethodResolver::MethodResolver): Edit `try_result` field and change constructor. (MethodResolver::Probe): Return set of candidates instead of singular candidate. (MethodResolver::select): Add better implementation to account for multiple candidates. * typecheck/rust-hir-dot-operator.h (struct MethodCandidate): Overload comparison operator in order to store them in `std::set`. * typecheck/rust-hir-inherent-impl-overlap.h: Do not fail assertion on missing type. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Adapt code to use multiple candidates. * typecheck/rust-tyty.cc (set_cmp_autoderef_mode): Add code to handle automatic derefs properly. (reset_cmp_autoderef_mode): Add helper function to reset said mode. * typecheck/rust-tyty.h (set_cmp_autoderef_mode): Declare function. (reset_cmp_autoderef_mode): Likewise. * typecheck/rust-tyty-cmp.h: Add handling of `autoderef_cmp_flag` 2023-02-21 Philip Herron * util/rust-abi.cc (get_abi_from_string): Add missing "rust-call" possibility for ABI variant. 2023-02-21 Philip Herron * util/rust-lang-item.h: Add `fn_once` lang item. 2023-02-21 Philip Herron * backend/rust-compile.cc: Add note about missing support for super traits. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function. (BaseType::bounds_compatible): New function. (DynamicObjectType::get_object_items): New function. * typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution on dyn objects. 2023-02-21 Arthur Cohen * Make-lang.in: Compile early name resolver. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Move macro name resolution. * expand/rust-macro-builtins.cc (try_expand_macro_expression): Run ENR when recursively expanding macros. * expand/rust-macro-expand.cc (MacroExpander::expand_invoc): No longer perform name resolution in `expand_invoc`. * expand/rust-macro-expand.h (struct MacroExpander): Keep ENR within MacroExpander. * rust-session-manager.cc (Session::expansion): Run ENR. * resolve/rust-early-name-resolver.cc: New file. * resolve/rust-early-name-resolver.h: New file. 2023-02-21 Arthur Cohen * ast/rust-path.h: Add `accept_vis` method to `GenericArg` class. 2023-02-21 Arthur Cohen * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Add note for glob import resolving. 2023-02-21 Arthur Cohen * util/rust-hir-map.h: Add new mappings. * util/rust-hir-map.cc (Mappings::insert_macro_invocation): Add insertion function into mappings. (Mappings::lookup_macro_invocation): Add lookup function for mappings. 2023-02-21 Marc Poulhiès * parse/rust-parse-impl.h (Parser::parse_stmt_or_expr_without_block): Check if `expr` is valid after parsing it. 2023-02-21 Arthur Cohen * backend/rust-builtins.cc (BuiltinsContext::setup): Declare prefetch intrinsics. * backend/rust-compile-intrinsic.cc (enum class Prefetch): Add kinds of prefetch intrinsics. (prefetch_data_handler): New function. (prefetch_read_data): Likewise. (prefetch_write_data): Likewise. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Fill empty functions for structs, enums and unions. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::format_tuple_field): New. (Dump::format_struct_field): New. * ast/rust-ast-dump.h (format_tuple_field): New. (format_struct_field): New. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): move generic params dump ... (Dump::emit_generic_params): ... here. * ast/rust-ast-dump.h (emit_generic_params): New. 2023-02-21 Philip Herron * typecheck/rust-hir-trait-ref.h (lookup_trait_item): Add lookup in super_trait. 2023-02-21 Philip Herron * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): Use auto and minor change in candidate init. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): Likewise. * typecheck/rust-hir-type-check-type.cc: Likewise. * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Likewise. Removecall to set_ty_ref. * typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): Add locus initializer in ctor, implement get_defid. (class PathProbeType::Probe): return a set instead of vector. Adjust class impl. (class ReportMultipleCandidateError): Do not inherit from HIRImplVisitor anymore and remove corresponding impl. Adjust for change in Probe. Simplify Report handling. (class PathProbeImplTrait::Probe): Adjust return type. 2023-02-21 Philip Herron * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Adjust VariantDef ctor calls with DefID. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-tyty.h (VariantDef): Add defid parameter to ctor. 2023-02-21 Arthur Cohen * Make-lang.in: Add `rust-builtins.o` as target * backend/rust-builtins.h: Refactor to new file. * backend/rust-builtins.cc: New file. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Implement visitor for If expressions. 2023-02-21 David Faust * ast/rust-ast-dump.cc (Dump::visit): Dump assignment and compound assignment expressions. 2023-02-21 Philip Herron * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): Check for recursive queries. * typecheck/rust-hir-type-check.h: New functions: `query_completed`, `query_in_progress`, `insert_query`. * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Use `query_type` API. 2023-02-21 Arthur Cohen * ast/rust-ast-dump.cc (Dump::emit_visibility): New function. (Dump::visit): Call into `emit_visibility`. (Dump::format_function_common): Likewise. * ast/rust-ast-dump.h: Declare `emit_visibility`. 2023-02-21 Arthur Cohen * ast/rust-item.h: Rename get_public_vis_type. * hir/rust-ast-lower.cc (translate_visibility): Use new name. 2023-02-21 Philip Herron * resolve/rust-name-resolver.h: Add miscellenaous item mappings. * resolve/rust-name-resolver.cc (Resolver::insert_resolved_misc): Use new mappings. (Resolver::lookup_resolved_misc): Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): Adapt function to insert into miscelleanous mappings. * checks/lints/rust-lint-marklive.cc (MarkLive::find_ref_node_id): Allow lookup in miscelleanous mappings in mark-live phase. 2023-02-20 Rainer Orth * backend/rust-tree.cc: Include memmodel.h. 2023-02-17 Thomas Schwinge * backend/rust-tree.cc: '#include "tm_p.h"'. 2023-01-31 Philip Herron * Make-lang.in: Remove `rust-hir-typecheck-toplevel` object and add `rust-hir-path-probe` one. * typecheck/rust-hir-dot-operator.cc (MethodResolver::MethodResolver): Remove no longer used `context` and `mapping` fields, and use new `query_type` API. (MethodResolver::MethodResolver): Likewise. (MethodResolver::select): Use new `query_type` API. * typecheck/rust-hir-path-probe.h: New header. * typecheck/rust-hir-path-probe.cc: New file. * typecheck/rust-hir-dot-operator.h (class MethodResolver): Remove no longer used `context` and `mapping` fields, and use new `query_type` API. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): New function. * typecheck/rust-hir-type-check-base.h: Declare `query_type` function. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add debug print. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::Resolve): Refactor and make use of new query system. (TypeCheckTopLevelExternItem::Resolve): Likewise. (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckTopLevelImplItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. (TypeCheckImplItem::TypeCheckImplItem): Likewise. (TypeCheckImplItem::Resolve): Likewise. (TypeCheckImplItemWithTrait::visit): Likewise. * typecheck/rust-hir-type-check-implitem.h (class TypeCheckTopLevelImplItem): Likewise. (class TypeCheckImplItemWithTrait): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::TypeCheckItem): Likewise. (TypeCheckItem::Resolve): Likewise. (TypeCheckItem::ResolveImplItem): Likewise. (TypeCheckItem::ResolveImplBlockSelf): Likewise. (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-item.h: Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): Likewise. (TypeCheckExpr::resolve_segments): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h: Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::Resolve): Likewise. (TypeCheckType::visit): Likewise. (TypeCheckType::resolve_root_path): Likewise. * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise. * typecheck/rust-hir-type-check.h: Likewise. * typecheck/rust-substitution-mapper.h: Likewise. * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise. (TypeCheckBase::get_predicate_from_bound): Likewise. (TypeBoundsMappings::add_bound): Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty.h: Likewise. * typecheck/rust-tyty.cc (SubstitutionRef::infer_substitions): Likewise. (ParamType::resolve): Do not infinite loop anymore. * util/rust-hir-map.h: Add new `hirImplBlockTypeMappings` and declare `lookup_impl_block_type`. * util/rust-hir-map.cc (Mappings::insert_hir_impl_block): Use new `hirImplBlockTypeMappings` (Mappings::lookup_impl_block_type): New function. 2023-01-31 Philip Herron * backend/rust-compile-context.h: Add new optional `asm_name` string argument to `lookup_function_decl`. * backend/rust-compile-item.cc (CompileItem::visit): Compute assembly name and pass it to `lookup_function_decl` when calling it. 2023-01-31 Philip Herron * backend/rust-constexpr.cc (eval_store_expression): Remove invalid assertion on constexpr constructors. 2023-01-31 Philip Herron * backend/rust-compile-expr.h: Formatting. 2023-01-31 liushuyu * ast/rust-ast.h (class MacroInvocData): Store expander as member of the class. (class Expr): Add `is_literal` virtual method * ast/rust-expr.h: Override `is_literal` for `LiteralExpr`s. * expand/rust-macro-builtins.cc (try_expand_macro_expression): New function. (try_extract_string_literal_from_fragment): Likewise. (try_expand_single_string_literal): Likewise. (try_expand_many_expr): Likewise. (parse_single_string_literal): Add macro expander as argument. (MacroBuiltin::include_bytes): Pass expander as argument to `parse_single_string_literal`. (MacroBuiltin::include_str): Likewise. (MacroBuiltin::compile_error): Likewise. (MacroBuiltin::include): Likewise. (MacroBuiltin::concat): Likewise and add better error handling. (MacroBuiltin::env): Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Expand invocations recursively. 2023-01-31 Arthur Cohen * lang.opt: Add new ``-frust-compile-until` option. * rust-session-manager.cc (Session::compile_crate): Add stops around various compilation steps in the pipeline. * rust-session-manager.h (struct CompileOptions): Add `CompileStep` enum and field. 2023-01-31 Philip Herron * backend/rust-tree.cc (rs_type_quals): Comment out bad assertion 2023-01-31 Philip Herron * typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit): Make static items behave more similarly to const items. 2023-01-31 Philip Herron * backend/rust-compile-item.cc (CompileItem::visit): Const evaluate static item expressions. 2023-01-31 Arthur Cohen * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Do not lower null items within modules. 2023-01-31 Arthur Cohen * util/rust-attributes.cc: Add `macro_use` to list of builtin attributes. 2023-01-31 Arthur Cohen * checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Allow getting an error string from a specific constant context. (ConstChecker::ctx_allows_default): New function, check if a context allows default values for Const generics. (ConstChecker::visit): Call into `ctx_allows_default`. * checks/errors/rust-const-checker.h: Declare `ctx_allows_default`. 2023-01-31 liushuyu * backend/rust-compile-expr.cc (CompileExpr::visit): Properly formulate exit condition when compiling while loops. 2023-01-31 Faisal Abbas <90.abbasfaisal@gmail.com> * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Turn constant item typechecking into a coercion site instead of a unify site. 2023-01-31 Philip Herron * typecheck/rust-tyty.h: Fix `is_concrete` for unit types with substitutions. 2023-01-31 Philip Herron * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::contains_associated_types): Check if a type bound predicate contains assocated types. * typecheck/rust-tyty.h: Declare the above mentioned function. * typecheck/rust-hir-trait-resolve.cc: Use `contains_associated_types` function. 2023-01-31 Philip Herron * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add more calls to `rust_debug` for development. 2023-01-31 Philip Herron * backend/rust-compile-base.cc: Improve compilation pipeline and simplify function. 2023-01-31 Philip Herron * backend/rust-tree.cc (comptypes): Remove some C++ specific checks in Rust const folder for now. 2023-01-31 Philip Herron * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site): Add better unification function with debug calls. * typecheck/rust-autoderef.cc (AutoderefCycle::cycle): Add more debug calls and use new unify API. * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise. (TypeCoercionRules::coerce_borrowed_pointer): Likewise. (TypeCoercionRules::select): Likewise. * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): Likewise. * typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): Likewise. (TypeCheckBase::coercion_site): Likewise. (TypeCheckBase::cast_site): Likewise. * typecheck/rust-hir-type-check-base.h: Likewise. * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelImplItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): Likewise. * typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise. * typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise. * typecheck/rust-tyctx.cc (TypeCheckContext::peek_return_type): Likewise. * typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::visit): Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-rules.h: Likewise. * typecheck/rust-tyty.cc (BaseType::mappings_str): Likewise. (BaseType::debug): Print type name more clearly. (BaseType::debug_str): Add new function to print type pointer and name. (TupleType::get_name): Improve type name fetching function. (ReferenceType::get_name): Likewise. (PointerType::get_name): Likewise. * typecheck/rust-tyty.h: Refactor definitions outside of the header. 2023-01-31 Philip Herron * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::TypeCheckBase): Remove constructor. (TypeCheckBase::coercion_site): Add `Location` argument to function. * typecheck/rust-hir-type-check-base.h: Use `TypeCheckBase::coercion_site` function with location argument. * 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-expr.h (class TypeCheckExpr): 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-toplevel.cc (TypeCheckTopLevel::visit): Likewise. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. (TypeCheckMethodCallExpr::visit): Likewise. * typecheck/rust-tyty.h: Add missing locus field. * typecheck/rust-tyty.cc (StructFieldType::clone): Use locus field. (StructFieldType::monomorphized_clone): Likewise. 2023-01-31 Philip Herron * typecheck/rust-tyctx.cc (TypeCheckContext::pop_return_type): Add guards around `std::vector.pop_back()`. (TypeCheckContext::peek_context): Likewise for `std::vector.back()`. 2023-01-31 Arthur Cohen philberty * ast/rust-ast.h: Improve assertions within ASTFragment API. 2023-01-31 Arthur Cohen * ast/rust-ast.h: Add assertions and accessors for fragment nodes. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Fix expansion context typo when visiting `InherentImpl` items. (AttrVisitor::maybe_expand_expr): Use new Fragment accessor to fetch properly typed node. (AttrVisitor::maybe_expand_type): Likewise. * expand/rust-macro-expand.cc (transcribe_type): Emit parse errors when trying to parse a type. 2023-01-31 Arthur Cohen * ast/rust-ast-dump.h: Add shorthand `AST::Dump::debug` function to dump an AST node on `stderr`. 2023-01-31 Arthur Cohen philberty * expand/rust-macro-expand.cc (parse_many): Return early from parsing loop if we encounter an error, and emit that error in the meantime. 2023-01-31 Arthur Cohen * expand/rust-macro-expand.cc (MacroExpander::match_matcher): Handle fragments differently based on whether or not we are currently trying to match a matcher in a repetition context. (MacroExpander::match_n_matches): Use new `in_repetition` argument properly when calling `match_matcher`. * expand/rust-macro-expand.h (MacroExpander::match_matcher): Allow passing extra `in_repetition` bool argument 2023-01-31 Arthur Cohen * parse/rust-parse-impl.h: Allow parsing full range expressions without erroring out. 2023-01-31 Arthur Cohen * checks/lints/rust-lint-scan-deadcode.h: Do not report public items as dead code. 2023-01-31 Arthur Cohen * util/rust-attributes.cc: Add `rustc_inherit_overflow_checks` to list of builtin attributes. 2023-01-31 Arthur Cohen * backend/rust-compile-expr.cc (CompileExpr::visit): Insert overflow checks logic. (CompileExpr::array_copied_expr): Insert overflow checks logic. * backend/rust-compile-item.cc (CompileItem::visit): Insert overflow checks logic. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Insert overflow checks logic. * rust-gcc.cc (Gcc_backend::arithmetic_or_logical_expression): Differentiate existing function from `arithmetic_or_logical_expression_checked`. This function does insert perform overflow checks. (Gcc_backend::arithmetic_or_logical_expression_checked): New function. (is_overflowing_expr): New function. Check if an expression is an overflowing one (ADD, SUB, MUL). (fetch_overflow_builtins): New function. * rust-backend.h: Declare `arithmetic_or_logical_expression_checked` in abstract `Backend` class. 2023-01-31 Arthur Cohen * backend/rust-builtins.h: Refactor builtin context class and add overflow builtins. 2023-01-31 Arthur Cohen * rust-gcc.cc (class Bvariable): Move class to `rust-gcc.h` header. * rust-gcc.h: New file. 2023-01-31 Philip Herron * hir/rust-ast-lower-expr.h: Lower double borrow expressions to two `HIR::BorrowExpr`s. * hir/tree/rust-hir-expr.h: Remove `is_double_borrow` field from `HIR::BorrowExpr`. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove call to `gcc_unreachable` on double borrow expressions. 2023-01-31 Faisal Abbas <90.abbasfaisal@gmail.com> * backend/rust-tree.cc : Add new includes. (scope_chain): New. (maybe_add_global): New. (init_modules): New (copied from cp) (var_in_constexpr_fn): Likewise. (member_vec_linear_search): Likewise. (member_vec_binary_search): Likewise. (is_overloaded_fn): Likewise. (ovl_make): Likewise. (lookup_add): Likewise. (type_memfn_quals): Likewise. (struct find_parameter_pack_data): Likewise. (struct conv_type_hasher): Likewise. (make_conv_op_name): Likewise. (builtin_pack_fn_p): Likewise. (builtin_pack_call_p): Likewise. (has_extra_args_mechanism_p): Likewise. (find_parameter_packs_r): Likewise. (WALK_SUBTREE): Likewise. (type_memfn_rqual): Likewise. (maybe_add_lang_type_raw): Likewise. (struct c_fileinfo): Likewise. (get_fileinfo): Likewise. (cxx_make_type): Likewise. (build_min_array_type): Likewise. (fields_linear_search): Likewise. (nothrow_spec_p): Likewise. (maybe_get_fns): Likewise. (get_fns): Likewise. (get_first_fn): Likewise. (dependent_name): Likewise. (called_fns_equal): Likewise. (canonical_eh_spec): Likewise. (rs_tree_code_length): Likewise. (rs_tree_operand_length): Likewise. (rs_tree_equal): Likewise. (publicly_uniquely_derived_p): Likewise. (comp_except_types): Likewise. (comp_except_specs): Likewise. (compparms): Likewise. (set_array_type_canon): Likewise. (struct cplus_array_info): Likewise. (struct cplus_array_hasher): Likewise. (cplus_array_hasher::hash): Likewise. (cplus_array_hasher::equal): Likewise. (is_byte_access_type): Likewise. (build_cplus_array_type): Likewise. (rs_build_qualified_type_real): Likewise. (vector_targets_convertible_p): Likewise. (comp_array_types): Likewise. (same_type_ignoring_top_level_qualifiers_p): Likewise. (comp_ptr_ttypes_const): Likewise. (similar_type_p): Likewise. (structural_comptypes): Likewise. (comptypes): Likewise. (next_initializable_field): Likewise. (sufficient_parms_p): Likewise. (default_ctor_p): Likewise. (user_provided_p): Likewise. (type_has_non_user_provided_default_constructor): Likewise. (default_init_uninitialized_part): Likewise. (extract_conversion_operator): Likewise. (get_class_binding_direct): Likewise. (lang_check_failed): Likewise. (skip_artificial_parms_for): Likewise. (in_class_defaulted_default_constructor): Likewise. (is_instantiation_of_constexpr): Likewise. (check_for_uninitialized_const_var): Likewise. (cv_unqualified): Likewise. (make_tree_vector): Likewise. (release_tree_vector): Likewise. (instantiation_dependent_expression_p): Likewise. (cp_get_callee): Likewise. (build_nop): Likewise. (scalarish_type_p): Likewise. (type_has_nontrivial_copy_init): Likewise. (build_local_temp): Likewise. (is_normal_capture_proxy): Likewise. (reject_gcc_builtin): Likewise. (is_bitfield_expr_with_lowered_type): Likewise. (maybe_undo_parenthesized_ref): Likewise. (fold_offsetof): Likewise. (char_type_p): Likewise. (resolve_nondeduced_context): Likewise. (instantiate_non_dependent_or_null): Likewise. (resolve_nondeduced_context_or_error): Likewise. (really_overloaded_fn): Likewise. (invalid_nonstatic_memfn_p): Likewise. (strip_top_quals): Likewise. (cxx_incomplete_type_inform): Likewise. (cxx_incomplete_type_diagnostic): Likewise. (decl_constant_var_p): Likewise. (undeduced_auto_decl): Likewise. (require_deduced_type): Likewise. * backend/rust-tree.h (enum c_tree_index): Likewise. (GTY): Likewise. (enum cp_tree_index): Likewise. (wchar_decl_node): Likewise. (vtable_entry_type): Likewise. (delta_type_node): Likewise. (vtable_index_type): Likewise. (class_type_node): Likewise. (unknown_type_node): Likewise. (init_list_type_node): Likewise. (explicit_void_list_node): Likewise. (vtbl_type_node): Likewise. (vtbl_ptr_type_node): Likewise. (std_node): Likewise. (abi_node): Likewise. (global_namespace): Likewise. (const_type_info_type_node): Likewise. (conv_op_marker): Likewise. (abort_fndecl): Likewise. (current_aggr): Likewise. (nullptr_node): Likewise. (nullptr_type_node): Likewise. (align_type_node): Likewise. (char8_type_node): Likewise. (char16_type_node): Likewise. (char32_type_node): Likewise. (wchar_type_node): Likewise. (underlying_wchar_type_node): Likewise. (wint_type_node): Likewise. (signed_size_type_node): Likewise. (unsigned_ptrdiff_type_node): Likewise. (intmax_type_node): Likewise. (uintmax_type_node): Likewise. (widest_integer_literal_type_node): Likewise. (widest_unsigned_literal_type_node): Likewise. (sig_atomic_type_node): Likewise. (int8_type_node): Likewise. (int16_type_node): Likewise. (int32_type_node): Likewise. (int64_type_node): Likewise. (uint8_type_node): Likewise. (c_uint16_type_node): Likewise. (c_uint32_type_node): Likewise. (c_uint64_type_node): Likewise. (int_least8_type_node): Likewise. (int_least16_type_node): Likewise. (int_least32_type_node): Likewise. (int_least64_type_node): Likewise. (uint_least8_type_node): Likewise. (uint_least16_type_node): Likewise. (uint_least32_type_node): Likewise. (uint_least64_type_node): Likewise. (int_fast8_type_node): Likewise. (int_fast16_type_node): Likewise. (int_fast32_type_node): Likewise. (int_fast64_type_node): Likewise. (uint_fast8_type_node): Likewise. (uint_fast16_type_node): Likewise. (uint_fast32_type_node): Likewise. (uint_fast64_type_node): Likewise. (intptr_type_node): Likewise. (uintptr_type_node): Likewise. (truthvalue_type_node): Likewise. (truthvalue_true_node): Likewise. (truthvalue_false_node): Likewise. (char_array_type_node): Likewise. (char8_array_type_node): Likewise. (char16_array_type_node): Likewise. (char32_array_type_node): Likewise. (wchar_array_type_node): Likewise. (string_type_node): Likewise. (const_string_type_node): Likewise. (default_function_type): Likewise. (function_name_decl_node): Likewise. (pretty_function_name_decl_node): Likewise. (c99_function_name_decl_node): Likewise. (saved_function_name_decls): Likewise. (null_node): Likewise. (ctor_identifier): Likewise. (complete_ctor_identifier): Likewise. (base_ctor_identifier): Likewise. (dtor_identifier): Likewise. (complete_dtor_identifier): Likewise. (base_dtor_identifier): Likewise. (deleting_dtor_identifier): Likewise. (conv_op_identifier): Likewise. (delta_identifier): Likewise. (in_charge_identifier): Likewise. (vtt_parm_identifier): Likewise. (as_base_identifier): Likewise. (this_identifier): Likewise. (pfn_identifier): Likewise. (vptr_identifier): Likewise. (global_identifier): Likewise. (anon_identifier): Likewise. (auto_identifier): Likewise. (decltype_auto_identifier): Likewise. (init_list_identifier): Likewise. (for_range__identifier): Likewise. (for_begin__identifier): Likewise. (for_end__identifier): Likewise. (for_range_identifier): Likewise. (for_begin_identifier): Likewise. (for_end_identifier): Likewise. (abi_tag_identifier): Likewise. (aligned_identifier): Likewise. (begin_identifier): Likewise. (end_identifier): Likewise. (get__identifier): Likewise. (gnu_identifier): Likewise. (tuple_element_identifier): Likewise. (tuple_size_identifier): Likewise. (type_identifier): Likewise. (value_identifier): Likewise. (fun_identifier): Likewise. (closure_identifier): Likewise. (heap_uninit_identifier): Likewise. (heap_identifier): Likewise. (heap_deleted_identifier): Likewise. (heap_vec_uninit_identifier): Likewise. (heap_vec_identifier): Likewise. (omp_identifier): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (empty_except_spec): Likewise. (noexcept_true_spec): Likewise. (noexcept_false_spec): Likewise. (noexcept_deferred_spec): Likewise. (terminate_fn): Likewise. (call_unexpected_fn): Likewise. (get_exception_ptr_fn): Likewise. (begin_catch_fn): Likewise. (end_catch_fn): Likewise. (allocate_exception_fn): Likewise. (free_exception_fn): Likewise. (throw_fn): Likewise. (rethrow_fn): Likewise. (atexit_fn_ptr_type_node): Likewise. (atexit_node): Likewise. (dso_handle_node): Likewise. (dynamic_cast_node): Likewise. (cleanup_type): Likewise. (vtt_parm_type): Likewise. (any_targ_node): Likewise. (source_location_impl): Likewise. (OVL_FUNCTION): Likewise. (OVL_CHAIN): Likewise. (OVL_DEDUP_P): Likewise. (OVL_USING_P): Likewise. (OVL_HIDDEN_P): Likewise. (OVL_NESTED_P): Likewise. (OVL_LOOKUP_P): Likewise. (OVL_EXPORT_P): Likewise. (OVL_FIRST): Likewise. (OVL_NAME): Likewise. (OVL_P): Likewise. (OVL_SINGLE_P): Likewise. (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise. (CLASSTYPE_LAZY_DEFAULT_CTOR): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (ATTR_IS_DEPENDENT): Likewise. (ABI_TAG_IMPLICIT): Likewise. (PARENTHESIZED_LIST_P): Likewise. (DECL_DEPENDENT_P): Likewise. (USING_DECL_SCOPE): Likewise. (USING_DECL_DECLS): Likewise. (USING_DECL_TYPENAME_P): Likewise. (USING_DECL_UNRELATED_P): Likewise. (DECL_DECLARES_FUNCTION_P): Likewise. (DECL_DECLARES_TYPE_P): Likewise. (IDENTIFIER_KIND_BIT_0): Likewise. (IDENTIFIER_KIND_BIT_1): Likewise. (IDENTIFIER_KIND_BIT_2): Likewise. (IDENTIFIER_MARKED): Likewise. (IDENTIFIER_VIRTUAL_P): Likewise. (IDENTIFIER_KEYWORD_P): Likewise. (IDENTIFIER_CDTOR_P): Likewise. (IDENTIFIER_CTOR_P): Likewise. (IDENTIFIER_DTOR_P): Likewise. (IDENTIFIER_ANY_OP_P): Likewise. (IDENTIFIER_OVL_OP_P): Likewise. (IDENTIFIER_ASSIGN_OP_P): Likewise. (IDENTIFIER_CONV_OP_P): Likewise. (IDENTIFIER_NEWDEL_OP_P): Likewise. (IDENTIFIER_NEW_OP_P): Likewise. (CLASSTYPE_DIAMOND_SHAPED_P): Likewise. (CLASSTYPE_REPEATED_BASE_P): Likewise. (CLASSTYPE_KEY_METHOD): Likewise. (CLASSTYPE_MEMBER_VEC): Likewise. (CLASSTYPE_DECL_LIST): Likewise. (CLASSTYPE_DESTRUCTOR): Likewise. (CLASSTYPE_HAS_PRIMARY_BASE_P): Likewise. (CLASSTYPE_PRIMARY_BINFO): Likewise. (CLASSTYPE_VBASECLASSES): Likewise. (CLASSTYPE_AS_BASE): Likewise. (DECL_CONV_FN_P): Likewise. (DECL_CONV_FN_TYPE): Likewise. (same_type_p): Likewise. (WILDCARD_TYPE_P): Likewise. (MAYBE_CLASS_TYPE_P): Likewise. (FUNCTION_REF_QUALIFIED): Likewise. (FUNCTION_RVALUE_QUALIFIED): Likewise. (TYPE_PTRMEMFUNC_FN_TYPE): Likewise. (TYPE_PTRMEMFUNC_FN_TYPE_RAW): Likewise. (TYPE_DEPENDENT_P): Likewise. (TYPE_DEPENDENT_P_VALID): Likewise. (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise. (TYPE_RAISES_EXCEPTIONS): Likewise. (IDENTIFIER_BINDING): Likewise. (LANG_IDENTIFIER_CAST): Likewise. (IF_COND): Likewise. (THEN_CLAUSE): Likewise. (ELSE_CLAUSE): Likewise. (IF_SCOPE): Likewise. (IF_STMT_CONSTEXPR_P): Likewise. (IF_STMT_CONSTEVAL_P): Likewise. (DECLTYPE_TYPE_EXPR): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (CLASSTYPE_INTERFACE_ONLY): Likewise. (TYPE_NAME_STRING): Likewise. (TYPE_NAME_LENGTH): Likewise. (CONSTRAINT_VAR_P): Likewise. (KOENIG_LOOKUP_P): Likewise. (DECL_PARM_INDEX): Likewise. (DECL_PARM_LEVEL): Likewise. (CONV_IMPLICIT): Likewise. (CONV_STATIC): Likewise. (CONV_CONST): Likewise. (CONV_REINTERPRET): Likewise. (CONV_PRIVATE): Likewise. (CONV_FORCE_TEMP): Likewise. (CONV_FOLD): Likewise. (CONV_OLD_CONVERT): Likewise. (CONV_C_CAST): Likewise. (CONV_BACKEND_CONVERT): Likewise. (WANT_INT): Likewise. (WANT_FLOAT): Likewise. (WANT_ENUM): Likewise. (WANT_POINTER): Likewise. (WANT_NULL): Likewise. (WANT_VECTOR_OR_COMPLEX): Likewise. (WANT_ARITH): Likewise. (COMPARE_STRICT): Likewise. (COMPARE_BASE): Likewise. (COMPARE_DERIVED): Likewise. (COMPARE_REDECLARATION): Likewise. (COMPARE_STRUCTURAL): Likewise. (SF_DEFAULT): Likewise. (SF_PRE_PARSED): Likewise. (SF_INCLASS_INLINE): Likewise. (SD_UNINITIALIZED): Likewise. (SD_INITIALIZED): Likewise. (SD_DECOMPOSITION): Likewise. (SD_DEFAULTED): Likewise. (SD_DELETED): Likewise. (TYPE_PTRDATAMEM_P): Likewise. (RS_TYPE_CONST_P): Likewise. (TYPE_MAIN_DECL): Likewise. (DECL_NONTRIVIALLY_INITIALIZED_P): Likewise. (DECL_DEFAULTED_FN): Likewise. (TYPE_HAS_USER_CONSTRUCTOR): Likewise. (DECL_INITIALIZED_IN_CLASS_P): Likewise. (DECL_DEFAULTED_IN_CLASS_P): Likewise. (DECL_NONSTATIC_MEMBER_FUNCTION_P): Likewise. (DECL_HAS_IN_CHARGE_PARM_P): Likewise. (DECL_HAS_VTT_PARM_P): Likewise. (FUNCTION_FIRST_USER_PARMTYPE): Likewise. (FUNCTION_FIRST_USER_PARM): Likewise. (DECL_CONSTRUCTOR_P): Likewise. (DECL_DELETED_FN): Likewise. (BRACE_ENCLOSED_INITIALIZER_P): Likewise. (DECL_IMMEDIATE_FUNCTION_P): Likewise. (SET_DECL_IMMEDIATE_FUNCTION_P): Likewise. (CONSTRUCTOR_MUTABLE_POISON): Likewise. (PTRMEM_CST_MEMBER): Likewise. (REF_PARENTHESIZED_P): Likewise. (TYPE_PTRMEM_P): Likewise. (TYPE_PTR_OR_PTRMEM_P): Likewise. (DECL_DECOMPOSITION_P): Likewise. (DECL_DECOMP_BASE): Likewise. (DECL_MAYBE_IN_CHARGE_CDTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (cp_function_chain): Likewise. (cdtor_label): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (current_eh_spec_block): Likewise. (current_in_charge_parm): Likewise. (current_vtt_parm): Likewise. (current_retval_sentinel): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_returns_abnormally): Likewise. (current_function_infinite_loop): Likewise. (in_base_initializer): Likewise. (in_function_try_handler): Likewise. (current_function_return_value): Likewise. (current_class_type): Likewise. (TYPE_BEING_DEFINED): Likewise. (DECL_STATIC_FUNCTION_P): Likewise. (DECL_FUNCTION_MEMBER_P): Likewise. (LANG_DECL_MIN_CHECK): Likewise. (LANG_DECL_FN_CHECK): Likewise. (LANG_DECL_NS_CHECK): Likewise. (LANG_DECL_PARM_CHECK): Likewise. (LANG_DECL_DECOMP_CHECK): Likewise. (RS_INTEGRAL_TYPE_P): Likewise. (STAT_HACK_P): Likewise. (STAT_TYPE_VISIBLE_P): Likewise. (STAT_TYPE): Likewise. (STAT_DECL): Likewise. (STAT_VISIBLE): Likewise. (MAYBE_STAT_DECL): Likewise. (MAYBE_STAT_TYPE): Likewise. (STAT_TYPE_HIDDEN_P): Likewise. (STAT_DECL_HIDDEN_P): Likewise. (class warning_sentinel): Likewise. (struct uid_sensitive_constexpr_evaluation_checker): Likewise. (class iloc_sentinel): Likewise. (struct GTY): Likewise. (struct named_decl_hash): Likewise. (enum lang_decl_selector): Likewise. (LANG_DECL_HAS_MIN): Likewise. (struct named_label_entry): Likewise. (struct named_label_hash): Likewise. (enum ref_operator): Likewise. (struct c_fileinfo): Likewise. (class ovl_iterator): Likewise. (class lkp_iterator): Likewise. (enum rs_ref_qualifier): Likewise. (enum tsubst_flags): Likewise. (enum cp_identifier_kind): Likewise. (enum tag_types): Likewise. (enum compare_bounds_t): Likewise. (mark_rvalue_use): Likewise. (type_unknown_p): Likewise. (init_modules): Likewise. (var_in_constexpr_fn): Likewise. (ovl_first): Likewise. (lookup_add): Likewise. (ovl_make): Likewise. (is_overloaded_fn): Likewise. (maybe_add_lang_type_raw): Likewise. (type_memfn_rqual): Likewise. (builtin_pack_fn_p): Likewise. (make_conv_op_name): Likewise. (type_memfn_quals): Likewise. (get_fileinfo): Likewise. (cxx_make_type): Likewise. (build_cplus_array_type): Likewise. (is_byte_access_type): Likewise. (comptypes): Likewise. (canonical_eh_spec): Likewise. (cp_tree_operand_length): Likewise. (rs_tree_equal): Likewise. (compparms): Likewise. (rs_build_qualified_type_real): Likewise. (rs_build_qualified_type): Likewise. (cv_qualified_p): Likewise. (similar_type_p): Likewise. (vector_targets_convertible_p): Likewise. (same_type_ignoring_top_level_qualifiers_p): Likewise. (comp_ptr_ttypes_const): Likewise. (get_class_binding_direct): Likewise. (skip_artificial_parms_for): Likewise. (lang_check_failed): Likewise. (default_init_uninitialized_part): Likewise. (type_has_non_user_provided_default_constructor): Likewise. (default_ctor_p): Likewise. (user_provided_p): Likewise. (sufficient_parms_p): Likewise. (next_initializable_field): Likewise. (in_class_defaulted_default_constructor): Likewise. (is_instantiation_of_constexpr): Likewise. (check_for_uninitialized_const_var): Likewise. (reduced_constant_expression_p): Likewise. (cv_unqualified): Likewise. (cp_get_callee): Likewise. (cp_get_callee_fndecl_nofold): Likewise. (is_nondependent_static_init_expression): Likewise. (maybe_constant_init): Likewise. (build_nop): Likewise. (scalarish_type_p): Likewise. (is_bitfield_expr_with_lowered_type): Likewise. (convert_bitfield_to_declared_type): Likewise. (cp_fold_maybe_rvalue): Likewise. (maybe_undo_parenthesized_ref): Likewise. (fold_offsetof): Likewise. (cp_truthvalue_conversion): Likewise. (fold_non_dependent_expr): Likewise. (char_type_p): Likewise. (instantiation_dependent_expression_p): Likewise. (type_has_nontrivial_copy_init): Likewise. (build_local_temp): Likewise. (is_normal_capture_proxy): Likewise. (reject_gcc_builtin): Likewise. (resolve_nondeduced_context): Likewise. (cxx_incomplete_type_diagnostic): Likewise. (cxx_incomplete_type_error): Likewise. (invalid_nonstatic_memfn_p): Likewise. (really_overloaded_fn): Likewise. (resolve_nondeduced_context_or_error): Likewise. (instantiate_non_dependent_or_null): Likewise. (cxx_incomplete_type_inform): Likewise. (strip_top_quals): Likewise. (undeduced_auto_decl): Likewise. (require_deduced_type): Likewise. (decl_constant_var_p): Likewise. (type_of_this_parm): Likewise. (class_of_this_parm): Likewise. (identifier_p): Likewise. (gnu_vector_type_p): Likewise. (make_tree_vector): Likewise. (release_tree_vector): Likewise. (class releasing_vec): Likewise. (vec_safe_push): Likewise. (null_node_p): Likewise. * backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl): Correctly set fndecl as constexpr from qualifiers. (HIRCompileBase::compile_function): Test if fndecl is constexpr. (HIRCompileBase::compile_constant_item): Set fndecl as constexpr. * backend/rust-compile-intrinsic.cc : Update include. (finalize_intrinsic_block): Set fndecl as constexpr. * backend/rust-constexpr.cc : Update include. (VERIFY_CONSTANT): New. (is_instantiation_of_constexpr): New. (literal_type_p): New. (verify_constant): New. (find_array_ctor_elt): New. (array_index_cmp): New. (potential_constant_expression_1): New. (get_nth_callarg): New. (unshare_constructor): New. (maybe_save_constexpr_fundef): New. (returns): New. (breaks): New. (continues): New. (switches): New. (struct constexpr_global_ctx): Add new fields. (constexpr_fundef): New. (struct constexpr_call): New. (constexpr_call_hasher : ggc_ptr_hash): New. (enum constexpr_switch_state): New. (struct constexpr_ctx): Add new fields. (struct constexpr_fundef_hasher): New. (constexpr_fundef_table): New. (constexpr_fundef_hasher::equal): New. (constexpr_fundef_hasher::hash): New. (retrieve_constexpr_fundef): New. (uid_sensitive_constexpr_evaluation_value): New. (uid_sensitive_constexpr_evaluation_true_counter): New. (uid_sensitive_constexpr_evaluation_p): New. (class temp_override): New. (struct uid_sensitive_constexpr_evaluation_sentinel): New. (struct uid_sensitive_constexpr_evaluation_checker): New. (::uid_sensitive_constexpr_evaluation_sentinel): New. (::uid_sensitive_constexpr_evaluation_checker): New. (uid_sensitive_constexpr_evaluation_checker::evaluation_restricted_p): New. (constexpr_call_table): New. (constexpr_call_hasher::hash): New. (constexpr_call_hasher::equal): New. (maybe_initialize_constexpr_call_table): New. (fundef_copies_table): New. (get_fundef_copy): New. (save_fundef_copy): New. (constexpr_expression): Refactor in ... (eval_constant_expression): ...this. (eval_store_expression): Add 3 bool params. (eval_call_expression): Likewise. (eval_binary_expression): Likewise. (eval_statement_list): New. (extract_string_elt): New. (eval_conditional_expression): New. (eval_bit_field_ref): New. (eval_loop_expr): New. (eval_switch_expr): New. (eval_unary_expression): New. (call_stack): New. (call_stack_tick): New. (last_cx_error_tick): New. (push_cx_call_context): New. (pop_cx_call_context): New. (cx_error_context): New. (fold_expr): Adjust call to eval_constant_expression. (same_type_ignoring_tlq_and_bounds_p): New. (union_active_member): Port more for cxx constexpr. (fold_indirect_ref_1): New. (rs_fold_indirect_ref): Likewise. (rs_eval_indirect_ref): New (from corresponding cxx FE file). (eval_logical_expression): Adjust parameter list. (lookup_placeholder): New (from corresponding cxx FE file). (constant_value_1): Remove. (inline_asm_in_constexpr_error): New (from corresponding cxx FE file). (verify_ctor_sanity): New. (get_callee): Remove. (initialized_type): New. (maybe_constexpr_fn): Remove. (init_subob_ctx): New. (base_field_constructor_elt): New. (get_or_insert_ctor_field): New. (eval_vector_conditional_expression): New (from correponding cxx FE file). (eval_bare_aggregate): New. (cxx_eval_trinary_expression): New. (reduced_constant_expression_p): New. (adjust_temp_type): New. (free_constructor): New. (eval_and_check_array_index): New. (eval_array_reference): New. (eval_component_reference): New. (label_matches): New. (eval_constant_expression): New. (modifying_const_object_error): New. (is_empty_field): New. (eval_store_expression): New. (eval_binary_expression): New. (addr_of_non_const_var): New. (rs_bind_parameters_in_call): New. (eval_builtin_function_call): New. (eval_call_expression): New. (build_anon_member_initialization): New. (build_data_member_initialization): New. (constexpr_fn_retval): New. (constant_value_1): New. (decl_constant_value): New. (non_const_var_error): New. (get_callee): New. (get_function_named_in_call): New. (maybe_constexpr_fn): New. (get_nth_callarg): New. (var_in_maybe_constexpr_fn): New. (instantiate_cx_fn_r): New. (instantiate_constexpr_fns): New. (array_index_cmp): New. (unshare_constructor): New. (find_array_ctor_elt): New. (verify_constant): New. (find_heap_var_refs): New. (find_immediate_fndecl): New. (diag_array_subscript): New. (get_array_or_vector_nelts): New. (eval_and_check_array_index): New. (extract_string_elt): New. (is_valid_constexpr_fn): New. (explain_invalid_constexpr_fn): New. (register_constexpr_fundef): New. (maybe_save_constexpr_fundef): New. (eval_statement_list): New. (eval_conditional_expression): New. (eval_bit_field_ref): New. (returns): New. (breaks): New. (continues): New. (switches): New. (eval_loop_expr): New. (eval_switch_expr): New. (eval_unary_expression): New. (cxx_eval_outermost_constant_expr): New. (is_static_init_expression): New. (is_constant_expression): New. (is_nondependent_static_init_expression): New. (maybe_constant_init_1): New. (maybe_constant_init): New. (is_nondependent_constant_expression): New. (cv_cache): New. (maybe_constant_value): New. (potential_constant_expression): New. (struct check_for_return_continue_data): New. (check_for_return_continue): New. (decl_namespace_context): New. (decl_in_std_namespace_p): New. (is_std_construct_at): New. (cxx_dynamic_cast_fn_p): New. (is_std_allocator_allocate): New. (is_std_allocator_allocate): New. (potential_constant_expression_1): New. (potential_constant_expression_1): New. (fold_non_dependent_init): New. * backend/rust-constexpr.h (maybe_save_constexpr_fundef): New. 2023-01-31 Arthur Cohen * rust-session-manager.cc (Session::compile_crate): Allow the dump of prettified AST (Session::dump_ast_pretty): New * rust-session-manager.h: Add new output file for pretty AST dump 2023-01-05 David Malcolm * resolve/rust-ast-resolve-item.cc (selftest::rust_flatten_list): Remove output to stderr. 2023-01-05 David Malcolm * Make-lang.in (selftest-rust-gdb): New. (selftest-rust-valgrind): New. 2022-12-20 Marc Poulhiès PR rust/108113 * Make-lang.in (rust.serial): New variable. (rust1$(exeext)): Depend on $(rust.prev). Call LINK_PROGRESS. 2022-12-14 Jakub Jelinek PR rust/106072 * parse/rust-parse-impl.h (parse_closure_param): Store pattern->get_locus () in a temporary before std::move (pattern) is invoked. 2022-12-13 Philip Herron * CONTRIBUTING.md: New. * README.md: New. * logo.png: New. 2022-12-13 Philip Herron * config-lang.in: New. 2022-12-13 Arthur Cohen * lang.opt (-frust-incomplete-and-experimental-compiler-do-not-use): New. * rust-session-manager.cc (Session::compile_crate): Check it. * Make-lang.in (RUST_SELFTEST_FLAGS): Add it. 2022-12-13 Philip Herron * Make-lang.in: New. 2022-12-13 Philip Herron * lang.opt: New. 2022-12-13 Philip Herron * lang-specs.h: New. 2022-12-13 Philip Herron * rust-lang.cc: New. * rust-session-manager.cc: New. * rust-session-manager.h: New. 2022-12-13 Philip Herron * rustspec.cc: New. 2022-12-13 Philip Herron * rust-diagnostics.cc: New. * rust-diagnostics.h: New. * rust-gcc-diagnostics.cc: New. * rust-linemap.cc: New. * rust-linemap.h: New. * rust-location.h: New. * rust-system.h: New. 2022-12-13 Philip Herron David Faust Faisal Abbas <90.abbasfaisal@gmail.com> * backend/rust-compile-context.cc: New. * backend/rust-compile-context.h: New. * backend/rust-compile.cc: New. * backend/rust-compile.h: New. * backend/rust-constexpr.cc: New. * backend/rust-constexpr.h: New. 2022-12-13 Philip Herron David Faust * backend/rust-compile-block.cc: New. * backend/rust-compile-block.h: New. * backend/rust-compile-expr.cc: New. * backend/rust-compile-expr.h: New. * backend/rust-compile-extern.h: New. * backend/rust-compile-fnparam.cc: New. * backend/rust-compile-fnparam.h: New. * backend/rust-compile-implitem.cc: New. * backend/rust-compile-implitem.h: New. * backend/rust-compile-intrinsic.cc: New. * backend/rust-compile-intrinsic.h: New. * backend/rust-compile-item.cc: New. * backend/rust-compile-item.h: New. * backend/rust-compile-pattern.cc: New. * backend/rust-compile-pattern.h: New. * backend/rust-compile-resolve-path.cc: New. * backend/rust-compile-resolve-path.h: New. * backend/rust-compile-stmt.cc: New. * backend/rust-compile-stmt.h: New. * backend/rust-compile-struct-field-expr.cc: New. * backend/rust-compile-struct-field-expr.h: New. * backend/rust-compile-type.cc: New. * backend/rust-compile-type.h: New. * backend/rust-compile-var-decl.h: New. 2022-12-13 Philip Herron David Faust * backend/rust-builtins.h: New. * backend/rust-compile-base.cc: New. * backend/rust-compile-base.h: New. * backend/rust-mangle.cc: New. * backend/rust-mangle.h: New. * backend/rust-tree.cc: New. * backend/rust-tree.h: New. * rust-backend.h: New. * rust-gcc.cc: New. 2022-12-13 Philip Herron * metadata/rust-export-metadata.cc: New. * metadata/rust-export-metadata.h: New. * metadata/rust-extern-crate.cc: New. * metadata/rust-extern-crate.h: New. * metadata/rust-import-archive.cc: New. * metadata/rust-imports.cc: New. * metadata/rust-imports.h: New. * rust-object-export.cc: New. * rust-object-export.h: New. 2022-12-13 Philip Herron * checks/lints/rust-lint-unused-var.cc: New. * checks/lints/rust-lint-unused-var.h: New. 2022-12-13 Thomas Young * checks/lints/rust-lint-marklive-base.h: New. * checks/lints/rust-lint-marklive.cc: New. * checks/lints/rust-lint-marklive.h: New. * checks/lints/rust-lint-scan-deadcode.h: New. 2022-12-13 Arthur Cohen * checks/errors/privacy/rust-privacy-check.cc: New. * checks/errors/privacy/rust-privacy-check.h: New. * checks/errors/privacy/rust-privacy-common.h: New. * checks/errors/privacy/rust-privacy-ctx.cc: New. * checks/errors/privacy/rust-privacy-ctx.h: New. * checks/errors/privacy/rust-privacy-reporter.cc: New. * checks/errors/privacy/rust-privacy-reporter.h: New. * checks/errors/privacy/rust-pub-restricted-visitor.cc: New. * checks/errors/privacy/rust-pub-restricted-visitor.h: New. * checks/errors/privacy/rust-reachability.cc: New. * checks/errors/privacy/rust-reachability.h: New. * checks/errors/privacy/rust-visibility-resolver.cc: New. * checks/errors/privacy/rust-visibility-resolver.h: New. 2022-12-13 Arthur Cohen * checks/errors/rust-const-checker.cc: New. * checks/errors/rust-const-checker.h: New. 2022-12-13 Arthur Cohen * checks/errors/rust-unsafe-checker.cc: New. * checks/errors/rust-unsafe-checker.h: New. 2022-12-13 Philip Herron * typecheck/rust-autoderef.cc: New. * typecheck/rust-autoderef.h: New. * typecheck/rust-casts.cc: New. * typecheck/rust-casts.h: New. * typecheck/rust-coercion.cc: New. * typecheck/rust-coercion.h: New. * typecheck/rust-hir-dot-operator.cc: New. * typecheck/rust-hir-dot-operator.h: New. * typecheck/rust-hir-inherent-impl-overlap.h: New. * typecheck/rust-hir-path-probe.h: New. * typecheck/rust-hir-trait-ref.h: New. * typecheck/rust-hir-type-bounds.h: New. * typecheck/rust-substitution-mapper.cc: New. * typecheck/rust-substitution-mapper.h: New. * typecheck/rust-tycheck-dump.h: New. * typecheck/rust-tyctx.cc: New. * typecheck/rust-tyty-bounds.cc: New. * typecheck/rust-tyty-call.cc: New. * typecheck/rust-tyty-call.h: New. * typecheck/rust-tyty-cmp.h: New. * typecheck/rust-tyty-rules.h: New. 2022-12-13 Philip Herron * typecheck/rust-tyty.cc: New. * typecheck/rust-tyty.h: New. 2022-12-13 Philip Herron * typecheck/rust-hir-trait-resolve.cc: New. * typecheck/rust-hir-trait-resolve.h: New. * typecheck/rust-hir-type-check-base.cc: New. * typecheck/rust-hir-type-check-base.h: New. * typecheck/rust-hir-type-check-enumitem.cc: New. * typecheck/rust-hir-type-check-enumitem.h: New. * typecheck/rust-hir-type-check-expr.cc: New. * typecheck/rust-hir-type-check-expr.h: New. * typecheck/rust-hir-type-check-implitem.cc: New. * typecheck/rust-hir-type-check-implitem.h: New. * typecheck/rust-hir-type-check-item.cc: New. * typecheck/rust-hir-type-check-item.h: New. * typecheck/rust-hir-type-check-path.cc: New. * typecheck/rust-hir-type-check-pattern.cc: New. * typecheck/rust-hir-type-check-pattern.h: New. * typecheck/rust-hir-type-check-stmt.cc: New. * typecheck/rust-hir-type-check-stmt.h: New. * typecheck/rust-hir-type-check-struct-field.h: New. * typecheck/rust-hir-type-check-struct.cc: New. * typecheck/rust-hir-type-check-toplevel.cc: New. * typecheck/rust-hir-type-check-toplevel.h: New. * typecheck/rust-hir-type-check-type.cc: New. * typecheck/rust-hir-type-check-type.h: New. * typecheck/rust-hir-type-check-util.cc: New. * typecheck/rust-hir-type-check-util.h: New. * typecheck/rust-hir-type-check.cc: New. * typecheck/rust-hir-type-check.h: New. * typecheck/rust-tyty-visitor.h: New. 2022-12-13 Philip Herron * util/rust-canonical-path.h: New. * util/rust-common.h: New. * util/rust-hir-map.cc: New. * util/rust-hir-map.h: New. * util/rust-identifier.h: New. * util/rust-lang-item.h: New. * util/rust-mapping-common.h: New. * util/rust-stacked-contexts.h: New. 2022-12-13 Arthur Cohen * util/rust-attributes.cc: New. * util/rust-attributes.h: New. 2022-12-13 Arthur Cohen * util/rust-optional-test.cc: New. * util/rust-optional.h: New. 2022-12-13 Arthur Cohen * util/rust-base62.cc: New. * util/rust-base62.h: New. 2022-12-13 Philip Herron * util/rust-abi.cc: New. * util/rust-abi.h: New. 2022-12-13 Philip Herron * util/fnv-hash.h: New. 2022-12-13 Philip Herron * util/rust-make-unique.h: New. 2022-12-13 Philip Herron * hir/rust-ast-lower-base.cc: New. * hir/rust-ast-lower-base.h: New. * hir/rust-ast-lower-block.h: New. * hir/rust-ast-lower-enumitem.h: New. * hir/rust-ast-lower-expr.h: New. * hir/rust-ast-lower-extern.h: New. * hir/rust-ast-lower-implitem.h: New. * hir/rust-ast-lower-item.cc: New. * hir/rust-ast-lower-item.h: New. * hir/rust-ast-lower-pattern.cc: New. * hir/rust-ast-lower-pattern.h: New. * hir/rust-ast-lower-stmt.h: New. * hir/rust-ast-lower-struct-field-expr.h: New. * hir/rust-ast-lower-type.h: New. * hir/rust-ast-lower.cc: New. * hir/rust-ast-lower.h: New. * hir/rust-hir-dump.cc: New. * hir/rust-hir-dump.h: New. 2022-12-13 Philip Herron * hir/tree/rust-hir-full-decls.h: New. * hir/tree/rust-hir-full-test.cc: New. * hir/tree/rust-hir-full.h: New. * hir/tree/rust-hir-visitor.h: New. * hir/tree/rust-hir.h: New. 2022-12-13 Philip Herron * hir/tree/rust-hir-expr.h: New. * hir/tree/rust-hir-item.h: New. * hir/tree/rust-hir-path.h: New. * hir/tree/rust-hir-pattern.h: New. * hir/tree/rust-hir-stmt.h: New. * hir/tree/rust-hir-type.h: New. 2022-12-13 Philip Herron * resolve/rust-ast-resolve-base.cc: New. * resolve/rust-ast-resolve-base.h: New. * resolve/rust-ast-resolve-expr.cc: New. * resolve/rust-ast-resolve-expr.h: New. * resolve/rust-ast-resolve-implitem.h: New. * resolve/rust-ast-resolve-item.cc: New. * resolve/rust-ast-resolve-item.h: New. * resolve/rust-ast-resolve-path.cc: New. * resolve/rust-ast-resolve-path.h: New. * resolve/rust-ast-resolve-pattern.cc: New. * resolve/rust-ast-resolve-pattern.h: New. * resolve/rust-ast-resolve-stmt.cc: New. * resolve/rust-ast-resolve-stmt.h: New. * resolve/rust-ast-resolve-struct-expr-field.cc: New. * resolve/rust-ast-resolve-struct-expr-field.h: New. * resolve/rust-ast-resolve-toplevel.h: New. * resolve/rust-ast-resolve-type.cc: New. * resolve/rust-ast-resolve-type.h: New. * resolve/rust-ast-resolve.cc: New. * resolve/rust-ast-resolve.h: New. * resolve/rust-ast-verify-assignee.h: New. * resolve/rust-name-resolver.cc: New. * resolve/rust-name-resolver.h: New. 2022-12-13 Arthur Cohen Philip Herron Joel Phillips * expand/rust-attribute-visitor.cc: New. * expand/rust-attribute-visitor.h: New. * expand/rust-macro-builtins.cc: New. * expand/rust-macro-builtins.h: New. * expand/rust-macro-expand.cc: New. * expand/rust-macro-expand.h: New. * expand/rust-macro-invoc-lexer.cc: New. * expand/rust-macro-invoc-lexer.h: New. * expand/rust-macro-substitute-ctx.cc: New. * expand/rust-macro-substitute-ctx.h: New. 2022-12-13 Joel Phillips Philip Herron Arthur Cohen * parse/rust-parse-impl.h: New, second half. 2022-12-13 Joel Phillips Philip Herron Arthur Cohen * parse/rust-cfg-parser.cc: New. * parse/rust-cfg-parser.h: New. * parse/rust-parse-impl.h: New. * parse/rust-parse.cc: New. * parse/rust-parse.h: New. 2022-12-13 Joel Phillips Philip Herron Arthur Cohen Mark Wielaard * lex/rust-codepoint.h: New. * lex/rust-lex.cc: New. * lex/rust-lex.h: New. * lex/rust-token.cc: New. * lex/rust-token.h: New. * rust-buffered-queue.h: New. 2022-12-13 Joel Phillips Philip Herron Arthur Cohen * ast/rust-ast-dump.cc: New. * ast/rust-ast-dump.h: New. * ast/rust-ast-visitor.h: New. * ast/rust-cond-compilation.h: New. 2022-12-13 Joel Phillips Philip Herron * ast/rust-expr.h: New. * ast/rust-macro.h: New. * ast/rust-path.h: New. * ast/rust-pattern.h: New. * ast/rust-stmt.h: New. * ast/rust-type.h: New. 2022-12-13 Joel Phillips Philip Herron * ast/rust-item.h: New. 2022-12-13 Joel Phillips Philip Herron Arthur Cohen * ast/rust-ast-full-decls.h: New. * ast/rust-ast-full-test.cc: New. * ast/rust-ast-full.h: New. * ast/rust-ast.h: New. * operator.h: New. Copyright (C) 2022-2024 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.