Skip to content

Conversation

powerboat9
Copy link
Collaborator

No description provided.

@powerboat9 powerboat9 mentioned this pull request Aug 9, 2025
@powerboat9 powerboat9 marked this pull request as draft August 9, 2025 21:48
gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-builder-internal.h
	(BuilderContext::resolver): Remove member variable.
	(BuilderContext::BuilderContext): Remove initialization of
	resolver member variable.
	(AbstractBuilder::resolve_label): Assume nr2.0 is enabled.
	(AbstractBuilder::resolve_variable): Likewise.
	(AbstractBuilder::resolve_variable_or_fn): Likewise.
	* checks/errors/privacy/rust-privacy-check.cc
	(Resolver::resolve): Avoid passing the 1.0 name resolver to
	VisibilityResolver or PrivacyReporter.
	* checks/errors/privacy/rust-privacy-reporter.cc
	(PrivacyReporter::PrivacyReporter): Remove initialization of
	resolver field.
	(is_child_module): Assume nr2.0 is enabled.
	(PrivacyReporter::check_for_privacy_violation): Likewise.
	* checks/errors/privacy/rust-privacy-reporter.h
	(PrivacyReporter::PrivacyReporter): Remove 1.0 resolver
	parameter.
	(PrivacyReporter::resolver): Remove member variable.
	* checks/errors/privacy/rust-visibility-resolver.cc: Remove
	"options.h" inclusion.
	(VisibilityResolver::VisibilityResolver): Remove 1.0 resolver
	parameter.
	(VisibilityResolver::resolve_module_path): Assume nr2.0 is
	enabled.
	* checks/errors/privacy/rust-visibility-resolver.h
	(VisibilityResolver::VisibilityResolver): Remove 1.0 resolver
	parameter.
	(VisibilityResolver::resolver): Remove member variable.
	* checks/errors/rust-const-checker.cc: Remove "options.h"
	inclusion.
	(ConstChecker::ConstChecker): Remove 1.0 resolver parameter.
	(ConstChecker::visit): Assume nr2.0 is enabled.
	* checks/errors/rust-const-checker.h (ConstChecker::resolver):
	Remove member variable.
	* checks/errors/rust-hir-pattern-analysis.cc: Remove "options.h"
	inclusion.
	(PatternChecker::PatternChecker): Remove 1.0 resolver parameter.
	(PatternChecker::visit): Assume nr2.0 is enabled.
	* checks/errors/rust-hir-pattern-analysis.h
	(PatternChecker::resolver): Remove member variable.
	* checks/errors/rust-readonly-check2.cc
	(ReadonlyChecker::ReadonlyChecker): Remove initialization of
	resolver member variable.
	* checks/errors/rust-readonly-check2.h
	(ReadonlyChecker::resolver): Remove member variable.
	* checks/errors/rust-unsafe-checker.cc: Remove "options.h"
	inclusion.
	(UnsafeChecker::UnsafeChecker): Remove 1.0 resolver parameter.
	(UnsafeChecker::visit): Assume nr2.0 is enabled.
	* checks/errors/rust-unsafe-checker.h
	(UnsafeChecker::resolver): Remove member variable.
	* checks/lints/rust-lint-marklive.cc
	(MarkLive::visit_path_segment): Assume nr2.0 is enabled.
	(MarkLive::visit): Likewise.
	(MarkLive::find_ref_node_id): Likewise.
	* checks/lints/rust-lint-marklive.h (MarkLive::resolver): Remove
	member variable.
	(MarkLive::MarkLive): Remove initialization of resolver member
	variable.
	* checks/lints/rust-lint-scan-deadcode.h
	(ScanDeadCode::resolver): Remove member variable.
	(ScanDeadCode::ScanDeadCode): Remove initialization of resolver
	member variable.

Signed-off-by: Owen Avery <[email protected]>
@powerboat9 powerboat9 marked this pull request as ready for review August 10, 2025 14:06
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good but yes slightly harder to use than the nr1.0 resolver, so we should add some member fields with the nr2.0 resolver and then merge this

@@ -75,7 +75,6 @@ struct BuilderContext

// External context.
Resolver::TypeCheckContext &tyctx;
Resolver::Resolver &resolver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably store the NR2.0 resolver instead to avoid having to get it each time we want to use it

BuilderContext ()
: tyctx (*Resolver::TypeCheckContext::get ()),
resolver (*Resolver::Resolver::get ())
BuilderContext () : tyctx (*Resolver::TypeCheckContext::get ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and just add it something like this:

Suggested change
BuilderContext () : tyctx (*Resolver::TypeCheckContext::get ())
BuilderContext () : tyctx (*Resolver::TypeCheckContext::get ()), resolver(ImmutableNameResolutionCtx::get().resolver())

@@ -157,7 +156,6 @@ types
virtual void visit (HIR::ExprStmt &stmt);

Analysis::Mappings &mappings;
Rust::Resolver::Resolver &resolver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants