crates are considered for `fn() -> type` name resolution if they have generic parameters
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
extern crate libc as usize;
extern crate libc as Option;
#[usize::inner] //~ ERROR could not find `inner` in `usize`
fn foo() {}
fn bar() -> usize { 0 } // OK
fn baz() -> Option<T> { 0 } //~ ERROR type arguments not allowed on crate
I expected to see this happen: usize and Option should both consistently resolve to the crate, or they should consistently resolve to the builtin type.
Instead, this happened: In return position, usize resolves to the builtin type and Option resolves to the crate.
In attribute position, usize resolves to the crate (which seems reasonable, because associated macros aren't a thing.)
Meta
rustc --version --verbose: 1.87.0-nightly (2025-03-28 920d95eaf23d7eb6b415)
@rustbot label A-resolve
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Rust reproducer in the issue and inspect compiler name resolution for return types, generic arguments, and attribute paths. Done means usize and Option resolve consistently in the shown cases, with the reported diagnostics behaving as intended.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100