Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent execution of some nr1.0 functions with nr2.0 #3257

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions gcc/rust/resolve/rust-name-resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include "rust-name-resolver.h"
#include "rust-ast-full.h"

// for flag_name_resolution_2_0
#include "options.h"

namespace Rust {
namespace Resolver {

Expand Down Expand Up @@ -468,6 +471,7 @@ Resolver::setup_builtin (const std::string &name, TyTy::BaseType *tyty)
void
Resolver::insert_resolved_name (NodeId refId, NodeId defId)
{
rust_assert (!flag_name_resolution_2_0);
resolved_names[refId] = defId;
get_name_scope ().append_reference_for_def (refId, defId);
insert_captured_item (defId);
Expand All @@ -476,6 +480,7 @@ Resolver::insert_resolved_name (NodeId refId, NodeId defId)
bool
Resolver::lookup_resolved_name (NodeId refId, NodeId *defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = resolved_names.find (refId);
if (it == resolved_names.end ())
return false;
Expand All @@ -489,6 +494,7 @@ Resolver::insert_resolved_type (NodeId refId, NodeId defId)
{
// auto it = resolved_types.find (refId);
// rust_assert (it == resolved_types.end ());
rust_assert (!flag_name_resolution_2_0);

resolved_types[refId] = defId;
get_type_scope ().append_reference_for_def (refId, defId);
Expand All @@ -497,6 +503,7 @@ Resolver::insert_resolved_type (NodeId refId, NodeId defId)
bool
Resolver::lookup_resolved_type (NodeId refId, NodeId *defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = resolved_types.find (refId);
if (it == resolved_types.end ())
return false;
Expand All @@ -508,6 +515,7 @@ Resolver::lookup_resolved_type (NodeId refId, NodeId *defId)
void
Resolver::insert_resolved_label (NodeId refId, NodeId defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = resolved_labels.find (refId);
rust_assert (it == resolved_labels.end ());

Expand All @@ -518,6 +526,7 @@ Resolver::insert_resolved_label (NodeId refId, NodeId defId)
bool
Resolver::lookup_resolved_label (NodeId refId, NodeId *defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = resolved_labels.find (refId);
if (it == resolved_labels.end ())
return false;
Expand All @@ -529,6 +538,7 @@ Resolver::lookup_resolved_label (NodeId refId, NodeId *defId)
void
Resolver::insert_resolved_macro (NodeId refId, NodeId defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = resolved_macros.find (refId);
rust_assert (it == resolved_macros.end ());

Expand All @@ -539,6 +549,7 @@ Resolver::insert_resolved_macro (NodeId refId, NodeId defId)
bool
Resolver::lookup_resolved_macro (NodeId refId, NodeId *defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = resolved_macros.find (refId);
if (it == resolved_macros.end ())
return false;
Expand All @@ -550,6 +561,7 @@ Resolver::lookup_resolved_macro (NodeId refId, NodeId *defId)
void
Resolver::insert_resolved_misc (NodeId refId, NodeId defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = misc_resolved_items.find (refId);
rust_assert (it == misc_resolved_items.end ());

Expand All @@ -559,6 +571,7 @@ Resolver::insert_resolved_misc (NodeId refId, NodeId defId)
bool
Resolver::lookup_resolved_misc (NodeId refId, NodeId *defId)
{
rust_assert (!flag_name_resolution_2_0);
auto it = misc_resolved_items.find (refId);
if (it == misc_resolved_items.end ())
return false;
Expand Down
Loading