From: Owen Avery Date: Sun, 18 May 2025 02:26:20 +0000 (-0400) Subject: gccrs: nr2.0: Adjust pub_restricted tests X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9a9d97b6944007159ae090b2639122ec68dbe990;p=thirdparty%2Fgcc.git gccrs: nr2.0: Adjust pub_restricted tests gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. * rust/compile/pub_restricted_1.rs: Adjust expected error messages and only run with name resolution 2.0 enabled. * rust/compile/pub_restricted_2.rs: Likewise. Signed-off-by: Owen Avery --- diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 9d5b7dfbbd3..c02805fd227 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -1,7 +1,5 @@ issue-3315-2.rs privacy8.rs -pub_restricted_1.rs -pub_restricted_2.rs issue-2905-2.rs torture/alt_patterns1.rs torture/name_resolve1.rs diff --git a/gcc/testsuite/rust/compile/pub_restricted_1.rs b/gcc/testsuite/rust/compile/pub_restricted_1.rs index 9bda9682403..44989a887e9 100644 --- a/gcc/testsuite/rust/compile/pub_restricted_1.rs +++ b/gcc/testsuite/rust/compile/pub_restricted_1.rs @@ -1,3 +1,5 @@ +// { dg-additional-options "-frust-name-resolution-2.0" } + pub mod foo { pub mod bar { pub fn baz() {} @@ -6,8 +8,8 @@ pub mod foo { } } -pub(in foo::fah::baz) struct A1; // { dg-error "cannot find simple path segment .fah." } -pub(in fro::bulator::saindoux) struct A2; // { dg-error "cannot find simple path segment .fro." } -pub(in foo::bar::saindoux) struct A3; // { dg-error "cannot find simple path segment .saindoux." } +pub(in foo::fah::baz) struct A1; // { dg-error "could not resolve path .foo::fah::baz." } +pub(in fro::bulator::saindoux) struct A2; // { dg-error "could not resolve path .fro::bulator::saindoux." } +pub(in foo::bar::saindoux) struct A3; // { dg-error "could not resolve path .foo::bar::saindoux." } fn main() {} diff --git a/gcc/testsuite/rust/compile/pub_restricted_2.rs b/gcc/testsuite/rust/compile/pub_restricted_2.rs index 8588f2775ca..91f072e890f 100644 --- a/gcc/testsuite/rust/compile/pub_restricted_2.rs +++ b/gcc/testsuite/rust/compile/pub_restricted_2.rs @@ -1,18 +1,18 @@ -// { dg-additional-options "-w" } +// { dg-additional-options "-w -frust-name-resolution-2.0" } mod foo { mod bar { mod baz { - pub(in baz) struct A0; - pub(in bar::baz) struct A1; + pub(in super::baz) struct A0; + pub(in super::super::bar::baz) struct A1; pub(in foo::bar::baz) struct A2; mod sain { mod doux {} } - pub(in sain) struct A3; // { dg-error "restricted path is not an ancestor of the current module" } - pub(in sain::doux) struct A4; // { dg-error "restricted path is not an ancestor of the current module" } + pub(in self::sain) struct A3; // { dg-error "restricted path is not an ancestor of the current module" } + pub(in self::sain::doux) struct A4; // { dg-error "restricted path is not an ancestor of the current module" } } } }