diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2023-08-25 14:33:36 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 16:52:24 +0200 |
commit | 786bc62f957e373d40a8c11fa4e607383ab2e2f1 (patch) | |
tree | 9168cfef6f69aa79d8fbbc4f23758992024de67e /gcc/rust/backend/rust-compile-expr.cc | |
parent | e476d3234468f4b565467bfe09722abcc959d934 (diff) | |
download | gcc-786bc62f957e373d40a8c11fa4e607383ab2e2f1.zip gcc-786bc62f957e373d40a8c11fa4e607383ab2e2f1.tar.gz gcc-786bc62f957e373d40a8c11fa4e607383ab2e2f1.tar.bz2 |
gccrs: backend: Use new name resolver where necessary
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: Use new ImmutableNrCtx.
* backend/rust-compile-context.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-item.cc: Likewise.
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 65de24b..6a9bb73 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -2311,11 +2311,23 @@ CompileExpr::generate_closure_function (HIR::ClosureExpr &expr, if (is_block_expr) { auto body_mappings = function_body->get_mappings (); - Resolver::Rib *rib = nullptr; - bool ok - = ctx->get_resolver ()->find_name_rib (body_mappings.get_nodeid (), - &rib); - rust_assert (ok); + if (flag_name_resolution_2_0) + { + auto nr_ctx + = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); + + auto candidate = nr_ctx.values.to_rib (body_mappings.get_nodeid ()); + + rust_assert (candidate.has_value ()); + } + else + { + Resolver::Rib *rib = nullptr; + bool ok + = ctx->get_resolver ()->find_name_rib (body_mappings.get_nodeid (), + &rib); + rust_assert (ok); + } } tree enclosing_scope = NULL_TREE; |