#include "rust-hir-type-check-expr.h"
#include "rust-substitution-mapper.h"
#include "rust-type-util.h"
+#include "rust-immutable-name-resolution-context.h"
+
+// used for flag_name_resolution_2_0
+#include "options.h"
namespace Rust {
namespace Resolver {
HIR::Trait **resolved) const
{
NodeId ref;
- if (!resolver->lookup_resolved_type (path.get_mappings ().get_nodeid (),
- &ref))
+ bool ok;
+ if (flag_name_resolution_2_0)
+ {
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ auto ref_opt = nr_ctx.lookup (path.get_mappings ().get_nodeid ());
+
+ if ((ok = ref_opt.has_value ()))
+ ref = *ref_opt;
+ }
+ else
+ {
+ ok = resolver->lookup_resolved_type (path.get_mappings ().get_nodeid (),
+ &ref);
+ }
+
+ if (!ok)
{
rust_error_at (path.get_locus (), "Failed to resolve path to node-id");
return false;