From b4db9829aafa87cd28687d70e7f95328849e7d93 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Tue, 19 Nov 2024 13:57:34 -0500 Subject: [PATCH] Use nr2.0 in PrivacyReporter gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Use name resolver 2.0. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery --- .../checks/errors/privacy/rust-privacy-reporter.cc | 10 +++++++++- gcc/testsuite/rust/compile/nr2/exclude | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc index b7abed256290..ead3f8a28463 100644 --- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc +++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc @@ -127,8 +127,16 @@ PrivacyReporter::check_for_privacy_violation (const NodeId &use_id, { NodeId ref_node_id = UNKNOWN_NODEID; + if (flag_name_resolution_2_0) + { + auto &nr_ctx + = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); + + if (auto id = nr_ctx.lookup (use_id)) + ref_node_id = *id; + } // FIXME: Don't assert here - we might be dealing with a type - if (!resolver.lookup_resolved_name (use_id, &ref_node_id)) + else if (!resolver.lookup_resolved_name (use_id, &ref_node_id)) resolver.lookup_resolved_type (use_id, &ref_node_id); // FIXME: Assert here. For now, we return since this causes issues when diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index a73b1f027b1d..2e956960dad6 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -145,8 +145,6 @@ parse_complex_generic_application.rs parse_complex_generic_application2.rs path_as_generic_arg.rs pattern-struct.rs -privacy1.rs -privacy3.rs privacy4.rs privacy5.rs privacy8.rs