https://gcc.gnu.org/g:7d29da360d0515b3b24f3578fc6785a971ceb7f2
commit r17-5164-g7d29da360d0515b3b24f3578fc6785a971ceb7f2 Author: Pierre-Emmanuel Patry <[email protected]> Date: Wed Sep 23 19:39:34 2026 +0200 gccrs: Make hir mapping name plurals When using those mappings, the singular name feels weird and may deceive a developper. gcc/rust/ChangeLog: * backend/rust-compile-item.cc (CompileItem::visit): Adapt call name. * backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): Likewise. * backend/rust-mangle-v0.cc (v0_path): Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::resolve_module_path): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::check_function_call): Likewise. * checks/errors/rust-readonly-check.cc (ReadonlyChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_use_of_static): Likewise. (UnsafeChecker::check_function_call): Likewise. (UnsafeChecker::check_function_attr): Likewise. * checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise. (MarkLive::visit): Likewise. * checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_extern_block): Likewise. * hir/rust-ast-lower-block.h: Likewise. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise. * hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): Likewise. (ASTLowerTraitItem::translate): Likewise. (ASTLowerTraitItem::visit): Likewise. * hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise. (ASTLoweringItem::visit): Likewise. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate): Likewise. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): Likewise. * hir/rust-ast-lower-struct-field-expr.h: Likewise. * hir/rust-ast-lower-type.cc (ASTLoweringType::translate): Likewise. (ASTLowerGenericParam::translate): Likewise. * hir/rust-ast-lower.cc (ASTLowerPathInExpression::visit): Likewise. (ASTLowerQualPathInExpression::visit): Likewise. * hir/tree/rust-hir-pattern-abstract.cc (PathPattern::is_refutable): Likewise. * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait): Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resolve_root_path): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Likewise. * typecheck/rust-type-util.cc (query_type): Likewise. * util/rust-hir-map.cc (Mappings::resolve_nodeid_to_stmt): Likewise. (Mappings::build_impl_indexes): Likewise. (Mappings::insert_trait_item_mapping): Likewise. * util/rust-hir-map.h: Change HIR mapping name to their plural counterpart. Signed-off-by: Pierre-Emmanuel Patry <[email protected]> Diff: --- gcc/rust/backend/rust-compile-item.cc | 2 +- gcc/rust/backend/rust-compile-resolve-path.cc | 4 ++-- gcc/rust/backend/rust-mangle-v0.cc | 6 ++--- .../errors/privacy/rust-visibility-resolver.cc | 2 +- gcc/rust/checks/errors/rust-const-checker.cc | 2 +- gcc/rust/checks/errors/rust-readonly-check.cc | 4 ++-- gcc/rust/checks/errors/rust-unsafe-checker.cc | 8 +++---- gcc/rust/checks/lints/rust-lint-marklive.cc | 4 ++-- .../checks/lints/unused/rust-unused-checker.cc | 2 +- gcc/rust/hir/rust-ast-lower-base.cc | 2 +- gcc/rust/hir/rust-ast-lower-block.h | 10 ++++----- gcc/rust/hir/rust-ast-lower-expr.cc | 2 +- gcc/rust/hir/rust-ast-lower-implitem.cc | 10 ++++----- gcc/rust/hir/rust-ast-lower-item.cc | 6 ++--- gcc/rust/hir/rust-ast-lower-pattern.cc | 2 +- gcc/rust/hir/rust-ast-lower-stmt.cc | 2 +- gcc/rust/hir/rust-ast-lower-struct-field-expr.h | 2 +- gcc/rust/hir/rust-ast-lower-type.cc | 4 ++-- gcc/rust/hir/rust-ast-lower.cc | 4 ++-- gcc/rust/hir/tree/rust-hir-pattern-abstract.cc | 2 +- gcc/rust/typecheck/rust-hir-trait-resolve.cc | 2 +- gcc/rust/typecheck/rust-hir-type-check-path.cc | 6 ++--- gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 2 +- gcc/rust/typecheck/rust-hir-type-check-type.cc | 2 +- gcc/rust/typecheck/rust-type-util.cc | 4 ++-- gcc/rust/util/rust-hir-map.cc | 6 ++--- gcc/rust/util/rust-hir-map.h | 26 +++++++++++----------- 27 files changed, 64 insertions(+), 64 deletions(-) diff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc index 6937492cc238..2d23aa62cdd0 100644 --- a/gcc/rust/backend/rust-compile-item.cc +++ b/gcc/rust/backend/rust-compile-item.cc @@ -228,7 +228,7 @@ CompileItem::visit (HIR::Function &function) if (function.get_qualifiers ().is_const ()) ctx->push_const_context (); - auto lookup_root_item = ctx->get_mappings ().hir.item.lookup ( + auto lookup_root_item = ctx->get_mappings ().hir.items.lookup ( function.get_mappings ().get_hirid ()); bool is_root_item = lookup_root_item.has_value (); tree fndecl diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index 9aa78fd4b1a0..332781e3b188 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -259,7 +259,7 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup, location_t expr_locus, bool is_qualified_path) { bool is_fn = lookup->get_kind () == TyTy::TypeKind::FNDEF; - if (auto resolved_item = ctx->get_mappings ().hir.item.lookup (ref)) + if (auto resolved_item = ctx->get_mappings ().hir.items.lookup (ref)) { if (!lookup->has_substitutions_defined ()) return CompileItem::compile (*resolved_item, ctx, nullptr, expr_locus); @@ -303,7 +303,7 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup, lookup, expr_locus); } else if (auto trait_item - = ctx->get_mappings ().hir.trait_item.lookup (ref)) + = ctx->get_mappings ().hir.trait_items.lookup (ref)) { HIR::Trait *trait = ctx->get_mappings ().lookup_trait_item_mapping ( trait_item.value ()->get_mappings ().get_hirid ()); diff --git a/gcc/rust/backend/rust-mangle-v0.cc b/gcc/rust/backend/rust-mangle-v0.cc index b2a24f385fd3..d3d8e684f76c 100644 --- a/gcc/rust/backend/rust-mangle-v0.cc +++ b/gcc/rust/backend/rust-mangle-v0.cc @@ -406,7 +406,7 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty, break; } } - else if (auto trait_item = mappings.hir.trait_item.lookup (hir_id)) + else if (auto trait_item = mappings.hir.trait_items.lookup (hir_id)) { switch (trait_item.value ()->get_item_kind ()) { @@ -428,7 +428,7 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty, break; } } - else if (auto item = mappings.hir.item.lookup (hir_id)) + else if (auto item = mappings.hir.items.lookup (hir_id)) switch (item.value ()->get_item_kind ()) { case HIR::Item::ItemKind::Function: @@ -468,7 +468,7 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty, cpath.get ().c_str ()); break; } - else if (auto expr = mappings.hir.expr.lookup (hir_id)) + else if (auto expr = mappings.hir.exprs.lookup (hir_id)) { rust_assert (expr.value ()->get_expression_type () == HIR::Expr::ExprType::Closure); diff --git a/gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc b/gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc index 5e65619fe747..d91a2c7d9662 100644 --- a/gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc +++ b/gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc @@ -93,7 +93,7 @@ VisibilityResolver::resolve_module_path (const HIR::SimplePath &restriction, // these items as private? return true; - if (auto module = mappings.hir.module.lookup (ref)) + if (auto module = mappings.hir.modules.lookup (ref)) { // Fill in the resolved `DefId` id = module.value ()->get_mappings ().get_defid (); diff --git a/gcc/rust/checks/errors/rust-const-checker.cc b/gcc/rust/checks/errors/rust-const-checker.cc index 913505f066fb..1147c4d5568c 100644 --- a/gcc/rust/checks/errors/rust-const-checker.cc +++ b/gcc/rust/checks/errors/rust-const-checker.cc @@ -309,7 +309,7 @@ ConstChecker::check_function_call (HirId fn_id, location_t locus) if (!const_context.is_in_context ()) return; - auto maybe_fn = mappings.hir.item.lookup (fn_id); + auto maybe_fn = mappings.hir.items.lookup (fn_id); if (maybe_fn && maybe_fn.value ()->get_item_kind () != Item::ItemKind::Function) return; diff --git a/gcc/rust/checks/errors/rust-readonly-check.cc b/gcc/rust/checks/errors/rust-readonly-check.cc index 8bd3c4e4e7f3..3b608dcf51bb 100644 --- a/gcc/rust/checks/errors/rust-readonly-check.cc +++ b/gcc/rust/checks/errors/rust-readonly-check.cc @@ -75,7 +75,7 @@ ReadonlyChecker::visit (PathInExpression &expr) return; // Check if the local variable is mutable. - auto maybe_pattern = mappings.hir.pattern.lookup (*hir_id); + auto maybe_pattern = mappings.hir.patterns.lookup (*hir_id); if (maybe_pattern && maybe_pattern.value ()->get_pattern_type () == HIR::Pattern::PatternType::IDENTIFIER) @@ -83,7 +83,7 @@ ReadonlyChecker::visit (PathInExpression &expr) expr.get_locus ()); // Check if the static item is mutable. - auto maybe_item = mappings.hir.item.lookup (*hir_id); + auto maybe_item = mappings.hir.items.lookup (*hir_id); if (maybe_item && maybe_item.value ()->get_item_kind () == HIR::Item::ItemKind::Static) { diff --git a/gcc/rust/checks/errors/rust-unsafe-checker.cc b/gcc/rust/checks/errors/rust-unsafe-checker.cc index 22ff986f18f5..d7b24765bd6d 100644 --- a/gcc/rust/checks/errors/rust-unsafe-checker.cc +++ b/gcc/rust/checks/errors/rust-unsafe-checker.cc @@ -92,7 +92,7 @@ UnsafeChecker::check_use_of_static (HirId node_id, location_t locus) bool in_context = unsafe_context.is_in_context (); bool unsafe_op = false; - if (auto maybe_static_mut = mappings.hir.item.lookup (node_id)) + if (auto maybe_static_mut = mappings.hir.items.lookup (node_id)) unsafe_op |= check_static_mut (*maybe_static_mut, locus, in_context); if (auto maybe_extern_static = mappings.lookup_hir_extern_item (node_id)) @@ -198,7 +198,7 @@ UnsafeChecker::check_function_call (HirId node_id, location_t locus) bool in_context = unsafe_context.is_in_context (); bool unsafe_op = false; - auto maybe_fn = mappings.hir.item.lookup (node_id); + auto maybe_fn = mappings.hir.items.lookup (node_id); if (maybe_fn && maybe_fn.value ()->get_item_kind () == Item::ItemKind::Function) @@ -208,7 +208,7 @@ UnsafeChecker::check_function_call (HirId node_id, location_t locus) if (auto maybe_extern = mappings.lookup_hir_extern_item (node_id)) unsafe_op |= check_extern_call (static_cast<ExternalItem *> (maybe_extern->first), - *mappings.hir.extern_block.lookup ( + *mappings.hir.extern_blocks.lookup ( maybe_extern->second), locus, in_context); @@ -240,7 +240,7 @@ UnsafeChecker::check_function_attr (HirId node_id, location_t locus) { bool in_context = unsafe_context.is_in_context (); - auto maybe_fn = mappings.hir.item.lookup (node_id); + auto maybe_fn = mappings.hir.items.lookup (node_id); if (maybe_fn && maybe_fn.value ()->get_item_kind () == Item::ItemKind::Function diff --git a/gcc/rust/checks/lints/rust-lint-marklive.cc b/gcc/rust/checks/lints/rust-lint-marklive.cc index 0685c442beeb..18e206d721e0 100644 --- a/gcc/rust/checks/lints/rust-lint-marklive.cc +++ b/gcc/rust/checks/lints/rust-lint-marklive.cc @@ -91,7 +91,7 @@ MarkLive::go (HIR::Crate &) worklist.pop_back (); scannedSymbols.emplace (hirId); liveSymbols.emplace (hirId); - if (auto item = mappings.hir.item.lookup (hirId)) + if (auto item = mappings.hir.items.lookup (hirId)) item.value ()->accept_vis (*this); else if (auto implItem = mappings.lookup_hir_implitem (hirId)) implItem->first->accept_vis (*this); @@ -125,7 +125,7 @@ MarkLive::visit (HIR::PathInExpression &expr) auto ref = hid.value (); // it must resolve to some kind of HIR::Item or HIR::InheritImplItem - if (auto resolved_item = mappings.hir.item.lookup (ref)) + if (auto resolved_item = mappings.hir.items.lookup (ref)) mark_hir_id (resolved_item.value ()->get_mappings ().get_hirid ()); else if (auto resolved_item = mappings.lookup_hir_implitem (ref)) mark_hir_id (resolved_item->first->get_impl_mappings ().get_hirid ()); diff --git a/gcc/rust/checks/lints/unused/rust-unused-checker.cc b/gcc/rust/checks/lints/unused/rust-unused-checker.cc index 414af54103d9..fa8602acab8b 100644 --- a/gcc/rust/checks/lints/unused/rust-unused-checker.cc +++ b/gcc/rust/checks/lints/unused/rust-unused-checker.cc @@ -358,7 +358,7 @@ UnusedChecker::visit (HIR::BorrowExpr &expr) if (auto def = nr_context.lookup (ast_node_id, Resolver2_0::Namespace::Values)) if (auto id = mappings.lookup_node_to_hir (*def)) - if (auto item = mappings.hir.item.lookup (*id)) + if (auto item = mappings.hir.items.lookup (*id)) if (item.value ()->get_item_kind () == HIR::Item::ItemKind::Static) { auto &static_item = static_cast<HIR::StaticItem &> (*item.value ()); diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index ffe9f91fd7f5..e69b717d06b7 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -1077,7 +1077,7 @@ ASTLoweringBase::lower_extern_block (AST::ExternBlock &extern_block) extern_block.get_outer_attrs (), extern_block.get_locus ()); - mappings.hir.extern_block.insert (hir_extern_block); + mappings.hir.extern_blocks.insert (hir_extern_block); return hir_extern_block; } diff --git a/gcc/rust/hir/rust-ast-lower-block.h b/gcc/rust/hir/rust-ast-lower-block.h index eadaebd7edde..d582a68fbe02 100644 --- a/gcc/rust/hir/rust-ast-lower-block.h +++ b/gcc/rust/hir/rust-ast-lower-block.h @@ -37,7 +37,7 @@ public: expr.accept_vis (resolver); if (resolver.translated != nullptr) { - resolver.mappings.hir.expr.insert (resolver.translated); + resolver.mappings.hir.exprs.insert (resolver.translated); } *terminated = resolver.terminated; @@ -62,7 +62,7 @@ public: std::unique_ptr<HIR::BlockExpr> (block), expr.get_outer_attrs (), expr.get_locus ()); - resolver.mappings.hir.expr.insert (translated); + resolver.mappings.hir.exprs.insert (translated); return translated; } @@ -89,7 +89,7 @@ public: expr.accept_vis (resolver); if (resolver.translated != nullptr) { - resolver.mappings.hir.expr.insert (resolver.translated); + resolver.mappings.hir.exprs.insert (resolver.translated); } *terminated = resolver.terminated; return resolver.translated; @@ -121,7 +121,7 @@ public: expr.accept_vis (resolver); if (resolver.translated != nullptr) { - resolver.mappings.hir.expr.insert (resolver.translated); + resolver.mappings.hir.exprs.insert (resolver.translated); } return resolver.translated; } @@ -152,7 +152,7 @@ public: ASTLoweringExprWithBlock resolver; expr.accept_vis (resolver); if (resolver.translated != nullptr) - resolver.mappings.hir.expr.insert (resolver.translated); + resolver.mappings.hir.exprs.insert (resolver.translated); *terminated = resolver.terminated; return resolver.translated; diff --git a/gcc/rust/hir/rust-ast-lower-expr.cc b/gcc/rust/hir/rust-ast-lower-expr.cc index 5aefbfaa308d..cebc2bff9d6d 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.cc +++ b/gcc/rust/hir/rust-ast-lower-expr.cc @@ -50,7 +50,7 @@ ASTLoweringExpr::translate (AST::Expr &expr, bool *terminated) return nullptr; } - resolver.mappings.hir.expr.insert (resolver.translated); + resolver.mappings.hir.exprs.insert (resolver.translated); resolver.mappings.insert_location ( resolver.translated->get_mappings ().get_hirid (), expr.get_locus ()); diff --git a/gcc/rust/hir/rust-ast-lower-implitem.cc b/gcc/rust/hir/rust-ast-lower-implitem.cc index 736c4619b7ed..fdad7e4f6633 100644 --- a/gcc/rust/hir/rust-ast-lower-implitem.cc +++ b/gcc/rust/hir/rust-ast-lower-implitem.cc @@ -192,7 +192,7 @@ ASTLowerImplItem::visit (AST::Function &function) if (fn->is_method ()) { // insert mappings for self - mappings.hir.self_param.insert (&fn->get_self_param_unchecked ()); + mappings.hir.self_params.insert (&fn->get_self_param_unchecked ()); mappings.insert_location ( fn->get_self_param_unchecked ().get_mappings ().get_hirid (), fn->get_self_param_unchecked ().get_locus ()); @@ -201,7 +201,7 @@ ASTLowerImplItem::visit (AST::Function &function) // add the mappings for the function params at the end for (auto ¶m : fn->get_function_params ()) { - mappings.hir.function_param.insert (¶m); + mappings.hir.function_params.insert (¶m); mappings.insert_location (mapping.get_hirid (), param.get_locus ()); } @@ -222,7 +222,7 @@ ASTLowerTraitItem::translate (AST::AssociatedItem &item) auto locus = resolver.translated->get_trait_locus (); resolver.handle_outer_attributes (*resolver.translated); - resolver.mappings.hir.trait_item.insert (resolver.translated); + resolver.mappings.hir.trait_items.insert (resolver.translated); resolver.mappings.insert_location (id, locus); resolver.mappings.insert_defid_mapping (defid, resolver.translated); } @@ -285,7 +285,7 @@ ASTLowerTraitItem::visit (AST::Function &func) { // insert mappings for self // TODO: Is this correct ? Looks fishy - mappings.hir.self_param.insert (&*self_param); + mappings.hir.self_params.insert (&*self_param); mappings.insert_location (self_param->get_mappings ().get_hirid (), self_param->get_locus ()); } @@ -317,7 +317,7 @@ ASTLowerTraitItem::visit (AST::Function &func) // add the mappings for the function params at the end for (auto ¶m : trait_item->get_decl ().get_function_params ()) { - mappings.hir.function_param.insert (¶m); + mappings.hir.function_params.insert (¶m); mappings.insert_location (mapping.get_hirid (), param.get_locus ()); } } diff --git a/gcc/rust/hir/rust-ast-lower-item.cc b/gcc/rust/hir/rust-ast-lower-item.cc index 03ac6ac9bb9d..7e2f357bef10 100644 --- a/gcc/rust/hir/rust-ast-lower-item.cc +++ b/gcc/rust/hir/rust-ast-lower-item.cc @@ -45,7 +45,7 @@ ASTLoweringItem::translate (AST::Item &item) resolver.handle_outer_attributes (*resolver.translated); resolver.mappings.insert_ast_item (&item); - resolver.mappings.hir.item.insert (resolver.translated); + resolver.mappings.hir.items.insert (resolver.translated); resolver.mappings.insert_location (id, locus); resolver.mappings.insert_defid_mapping (defid, resolver.translated); } @@ -83,7 +83,7 @@ ASTLoweringItem::visit (AST::Module &module) = new HIR::Module (mapping, module.get_name (), module.get_locus (), std::move (items), std::move (vis), std::move (inner_attrs), std::move (outer_attrs)); - mappings.hir.module.insert (static_cast<Module *> (translated)); + mappings.hir.modules.insert (static_cast<Module *> (translated)); } void @@ -507,7 +507,7 @@ ASTLoweringItem::visit (AST::Function &function) // add the mappings for the function params at the end for (auto ¶m : fn->get_function_params ()) { - mappings.hir.function_param.insert (¶m); + mappings.hir.function_params.insert (¶m); mappings.insert_location (mapping.get_hirid (), param.get_locus ()); } diff --git a/gcc/rust/hir/rust-ast-lower-pattern.cc b/gcc/rust/hir/rust-ast-lower-pattern.cc index 6ab109560c1a..d45ad47e80e4 100644 --- a/gcc/rust/hir/rust-ast-lower-pattern.cc +++ b/gcc/rust/hir/rust-ast-lower-pattern.cc @@ -36,7 +36,7 @@ ASTLoweringPattern::translate (AST::Pattern &pattern, bool is_let_top_level) rust_assert (resolver.translated != nullptr); - resolver.mappings.hir.pattern.insert (resolver.translated); + resolver.mappings.hir.patterns.insert (resolver.translated); resolver.mappings.insert_location ( resolver.translated->get_mappings ().get_hirid (), pattern.get_locus ()); diff --git a/gcc/rust/hir/rust-ast-lower-stmt.cc b/gcc/rust/hir/rust-ast-lower-stmt.cc index 5281659a6442..43810ca66070 100644 --- a/gcc/rust/hir/rust-ast-lower-stmt.cc +++ b/gcc/rust/hir/rust-ast-lower-stmt.cc @@ -39,7 +39,7 @@ ASTLoweringStmt::translate (AST::Stmt *stmt, bool *terminated) resolver.mappings.insert_location ( resolver.translated->get_mappings ().get_hirid (), resolver.translated->get_locus ()); - resolver.mappings.hir.stmt.insert (resolver.translated); + resolver.mappings.hir.stmts.insert (resolver.translated); return resolver.translated; } diff --git a/gcc/rust/hir/rust-ast-lower-struct-field-expr.h b/gcc/rust/hir/rust-ast-lower-struct-field-expr.h index 225e5843bf36..7f0b9bd6062d 100644 --- a/gcc/rust/hir/rust-ast-lower-struct-field-expr.h +++ b/gcc/rust/hir/rust-ast-lower-struct-field-expr.h @@ -36,7 +36,7 @@ public: field.accept_vis (compiler); rust_assert (compiler.translated != nullptr); - compiler.mappings.hir.struct_expr_field.insert (compiler.translated); + compiler.mappings.hir.struct_expr_fields.insert (compiler.translated); compiler.mappings.insert_location ( compiler.translated->get_mappings ().get_hirid (), field.get_locus ()); diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc index 10e77e3a6a23..a41d49706c33 100644 --- a/gcc/rust/hir/rust-ast-lower-type.cc +++ b/gcc/rust/hir/rust-ast-lower-type.cc @@ -223,7 +223,7 @@ ASTLoweringType::translate (AST::Type &type, bool default_to_static_lifetime, type.accept_vis (resolver); rust_assert (resolver.translated != nullptr); - resolver.mappings.hir.type.insert (resolver.translated); + resolver.mappings.hir.types.insert (resolver.translated); resolver.mappings.insert_location ( resolver.translated->get_mappings ().get_hirid (), resolver.translated->get_locus ()); @@ -549,7 +549,7 @@ ASTLowerGenericParam::translate (AST::GenericParam ¶m) rust_assert (resolver.translated != nullptr); resolver.mappings.insert_location ( resolver.translated->get_mappings ().get_hirid (), param.get_locus ()); - resolver.mappings.hir.generic_param.insert (resolver.translated); + resolver.mappings.hir.generic_params.insert (resolver.translated); return resolver.translated; } diff --git a/gcc/rust/hir/rust-ast-lower.cc b/gcc/rust/hir/rust-ast-lower.cc index 154468a72b5c..7167a0afb18b 100644 --- a/gcc/rust/hir/rust-ast-lower.cc +++ b/gcc/rust/hir/rust-ast-lower.cc @@ -487,7 +487,7 @@ ASTLowerPathInExpression::visit (AST::PathInExpression &expr) // insert the mappings for the segment HIR::PathExprSegment *lowered_seg = &path_segments.back (); - mappings.hir.path_expr_segment.insert (lowered_seg); + mappings.hir.path_expr_segments.insert (lowered_seg); } translated = new HIR::PathInExpression (mapping, std::move (path_segments), @@ -531,7 +531,7 @@ ASTLowerQualPathInExpression::visit (AST::QualifiedPathInExpression &expr) // insert the mappings for the segment HIR::PathExprSegment *lowered_seg = &path_segments.back (); - mappings.hir.path_expr_segment.insert (lowered_seg); + mappings.hir.path_expr_segments.insert (lowered_seg); } auto crate_num = mappings.crate.get_current_crate (); diff --git a/gcc/rust/hir/tree/rust-hir-pattern-abstract.cc b/gcc/rust/hir/tree/rust-hir-pattern-abstract.cc index 6a1031457a3e..146208c4751a 100644 --- a/gcc/rust/hir/tree/rust-hir-pattern-abstract.cc +++ b/gcc/rust/hir/tree/rust-hir-pattern-abstract.cc @@ -58,7 +58,7 @@ PathPattern::is_refutable (const TyTy::BaseType &scrutinee) const HirId hir_id = get_final_segment ().get_mappings ().get_hirid (); if (hir_id) { - auto item = mappings.hir.item.lookup (hir_id); + auto item = mappings.hir.items.lookup (hir_id); if (item && item.value ()->get_item_kind () == Item::ItemKind::Constant) { return true; diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc index 5ae31122ad42..4393333d15fd 100644 --- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc +++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc @@ -227,7 +227,7 @@ TraitResolver::resolve_path_to_trait (const HIR::TypePath &path, return false; } - auto resolved_item = mappings.hir.item.lookup (hid.value ()); + auto resolved_item = mappings.hir.items.lookup (hid.value ()); if (!resolved_item.has_value ()) { rust_error_at (path.get_locus (), diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc index 665ec0054ce9..4bb325b781f2 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-path.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc @@ -208,7 +208,7 @@ TypeCheckExpr::visit (HIR::PathInExpression &expr) else { TyTy::BaseType *resolved = nullptr; - auto trait_item = mappings.hir.trait_item.lookup (*hir_id); + auto trait_item = mappings.hir.trait_items.lookup (*hir_id); if (trait_item.has_value ()) { HIR::Trait *trait = mappings.lookup_trait_item_mapping (*hir_id); @@ -308,9 +308,9 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset, } auto ref = hid.value (); - auto seg_is_module = mappings.hir.module.lookup (ref).has_value (); + auto seg_is_module = mappings.hir.modules.lookup (ref).has_value (); auto seg_is_crate = mappings.is_local_hirid_crate (ref); - auto seg_is_pattern = mappings.hir.pattern.lookup (ref).has_value (); + auto seg_is_pattern = mappings.hir.patterns.lookup (ref).has_value (); auto seg_is_self = is_root && !have_more_segments && seg.get_segment ().to_string () == "self"; if (seg_is_module || seg_is_crate) diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc index 287a903e12f1..26f3c0c68c35 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc @@ -74,7 +74,7 @@ TypeCheckPattern::visit (HIR::PathInExpression &pattern) rust_assert (definition_id.has_value ()); HirId def_id = definition_id.value (); - tl::optional<HIR::Item *> hir_item = mappings.hir.item.lookup (def_id); + tl::optional<HIR::Item *> hir_item = mappings.hir.items.lookup (def_id); // If the path references an item, it must be constants or structs. if (hir_item.has_value ()) { diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc index 0d4b735c9fec..7b8176508de7 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc @@ -387,7 +387,7 @@ TypeCheckType::resolve_root_path (HIR::TypePath &path, size_t *offset, } auto ref = hid.value (); - auto seg_is_module = mappings.hir.module.lookup (ref).has_value (); + auto seg_is_module = mappings.hir.modules.lookup (ref).has_value (); auto seg_is_crate = mappings.is_local_hirid_crate (ref); if (seg_is_module || seg_is_crate) { diff --git a/gcc/rust/typecheck/rust-type-util.cc b/gcc/rust/typecheck/rust-type-util.cc index 5acbdfa78a80..bdfab3a0c4f0 100644 --- a/gcc/rust/typecheck/rust-type-util.cc +++ b/gcc/rust/typecheck/rust-type-util.cc @@ -70,7 +70,7 @@ query_type (HirId reference, TyTy::BaseType **result) return true; } - if (auto item = mappings.hir.item.lookup (reference)) + if (auto item = mappings.hir.items.lookup (reference)) { rust_debug_loc (item.value ()->get_locus (), "resolved item {%u} to", reference); @@ -233,7 +233,7 @@ query_type (HirId reference, TyTy::BaseType **result) // is it an extern item? if (auto extern_item = mappings.lookup_hir_extern_item (reference)) { - auto block = mappings.hir.extern_block.lookup (extern_item->second); + auto block = mappings.hir.extern_blocks.lookup (extern_item->second); rust_assert (block.has_value ()); *result diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index c3eea4594597..2b4ee2731298 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -570,7 +570,7 @@ Mappings::resolve_nodeid_to_stmt (NodeId id) return tl::nullopt; HirId resolved = it->second; - return hir.stmt.lookup (resolved); + return hir.stmts.lookup (resolved); } void @@ -616,7 +616,7 @@ Mappings::build_impl_indexes () if (!hir_id.has_value ()) return nullptr; - auto item = hir.item.lookup (hir_id.value ()); + auto item = hir.items.lookup (hir_id.value ()); return item.has_value () ? item.value () : nullptr; }; @@ -711,7 +711,7 @@ Mappings::insert_trait_item_mapping (HirId trait_item_id, HIR::Trait *trait) == hirTraitItemsToTraitMappings.end ()); hirTraitItemsToTraitMappings[trait_item_id] = trait; - auto item = hir.trait_item.lookup (trait_item_id); + auto item = hir.trait_items.lookup (trait_item_id); rust_assert (item.has_value ()); if (item.value ()->get_item_kind () != HIR::TraitItem::TraitItemKind::FUNC) return; diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index d9db37b8400e..638b16155f24 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -205,25 +205,25 @@ public: class HIRMappings { public: - PtrMapping<HIR::Item> item; - PtrMapping<HIR::TraitItem> trait_item; - PtrMapping<HIR::ExternBlock> extern_block; - PtrMapping<HIR::Module> module; + PtrMapping<HIR::Item> items; + PtrMapping<HIR::TraitItem> trait_items; + PtrMapping<HIR::ExternBlock> extern_blocks; + PtrMapping<HIR::Module> modules; PtrMapping<HIR::Expr, InsertionPolicy::ALLOW_DUPLICATES, InsertLocation::YES> - expr; + exprs; PtrMapping<HIR::PathExprSegment, InsertionPolicy::FORBID_DUPLICATES, InsertLocation::YES> - path_expr_segment; + path_expr_segments; PtrMapping<HIR::GenericParam, InsertionPolicy::FORBID_DUPLICATES, InsertLocation::YES> - generic_param; - PtrMapping<HIR::Type> type; - PtrMapping<HIR::Stmt> stmt; + generic_params; + PtrMapping<HIR::Type> types; + PtrMapping<HIR::Stmt> stmts; PtrMapping<HIR::FunctionParam, InsertionPolicy::ALLOW_DUPLICATES> - function_param; - PtrMapping<HIR::SelfParam> self_param; - PtrMapping<HIR::StructExprField> struct_expr_field; - PtrMapping<HIR::Pattern> pattern; + function_params; + PtrMapping<HIR::SelfParam> self_params; + PtrMapping<HIR::StructExprField> struct_expr_fields; + PtrMapping<HIR::Pattern> patterns; }; class Mappings
