Rust-GCC / Rust-GCC/gccrs

NR2 does not error out on public crate item usage

Open
#3,389 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug name resolution
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

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: 9c6e09e2f73

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided reproducer with -frust-name-resolution-2.0 and compare the result with the expected access error. Trace the NR2 name-resolution handling for the public crate item, using the Godbolt link as a reference, and confirm that the compiler emits the expected diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.