Skip to content

Nr2 fix privacy path #3770

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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

P-E-P
Copy link
Member

@P-E-P P-E-P commented Apr 28, 2025

Fixes #3571
Fixes #3482

  • privacy5.rs
  • privacy8.rs
  • pub_restricted_1.rs
  • pub_restricted_2.rs
  • pub_restricted_3.rs
  • issue-2905-2.rs

P-E-P added 9 commits April 28, 2025 15:20
Relative module path are only permitted with rust 2015 edition.

gcc/testsuite/ChangeLog:

	* rust/compile/privacy5.rs: Convert test to 2018 edition.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Resolve
	visibility path when it exists.
	* resolve/rust-late-name-resolver-2.0.h: Add function prototype.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): Use getter.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast.cc (Visibility::as_string): Likewise.
	* hir/rust-ast-lower.cc (translate_visibility): Likewise.
	* resolve/rust-ast-resolve-base.cc (ResolverBase::resolve_visibility):
	Likewise.
	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
	* ast/rust-ast.h: Make path optional and change getter name to reflect
	potential unavailability.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* ast/rust-ast.h:
	* ast/rust-item.h:
	* ast/rust-macro.h:
	* hir/rust-ast-lower.cc (translate_visibility):
	* parse/rust-parse-impl.h (Parser::parse_visibility):
	* rust-session-manager.cc (Session::injection):

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go): Insert the
	crate module name at crate root.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
ChangeLog:

	* c/gcc/rust/resolve/rust-late-name-resolver-2.0.cc (Late::visit):

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove several tests from exclusion list.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
	* resolve/rust-forever-stack.h (class ResolutionError):
	* resolve/rust-forever-stack.hxx:
	* resolve/rust-name-resolution-context.h (class PathResolutionError):

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
ChangeLog:

	* c/gcc/rust/resolve/rust-forever-stack.h (class ResolutionError):

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
@@ -213,6 +213,23 @@ class BindingLayer
BindingSource get_source () const;
};

class PathResolutionError
Copy link
Member Author

Choose a reason for hiding this comment

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

Not a fan of this wrapper

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.

NR2: Super privacy path NR2: Non module path as privacy restrictor
1 participant