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

NR2 does not error out on public crate item usage #3389

Open
1 task
P-E-P opened this issue Jan 27, 2025 · 3 comments
Open
1 task

NR2 does not error out on public crate item usage #3389

P-E-P opened this issue Jan 27, 2025 · 3 comments

Comments

@P-E-P
Copy link
Member

P-E-P commented Jan 27, 2025

Summary

The compiler should error out as MyStruct cannot be accessed.

Reproducer

I tried this code with flag -frust-name-resolution-2.0:

pub struct Str(i32);

mod test {

    pub fn test() -> Str {
        Str(0)
    }
}

Does the code make use of any (1.49) nightly feature ?

  • Nightly

Godbolt link

https://godbolt.org/z/fr1Gs3dTc

Actual behavior

The compiler does not emit an error

Expected behavior

I expected to see an error suggesting use MyStruct.

GCC Version

commit hash: 9c6e09e

@CohenArthur
Copy link
Member

I think this is more of an issue with the privacy checker in gcc/rust/check/errors/privacy/rust-privacy-check.cc. It only uses the old resolver instead of the new one

@P-E-P
Copy link
Member Author

P-E-P commented Jan 28, 2025

I think this is more of an issue with the privacy checker in gcc/rust/check/errors/privacy/rust-privacy-check.cc. It only uses the old resolver instead of the new one

I doubt it, the code also miscompile with old resolver.

@CohenArthur
Copy link
Member

Well to be honest the privacy checker is something I wrote during my internship so it's probably really broken 😬 but since it's not critical for compiling correct code I think we shouldn't focus on this issue for now

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

No branches or pull requests

2 participants