rust-lang / rust-lang/rust-analyzer
Renaming a struct that has a function with the same name will break code:
Open
Nobody has claimed this yet.
A-ide
C-bug
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
// This currently export both the function and the struct
pub use aligned::Aligned;
mod aligned {
// Renaming this struct will rename the `pub use` above, breaking the use in the test
pub struct Aligned {
size: usize,
}
#[allow(non_snake_case)]
pub fn Aligned(size: usize) -> Aligned {
Aligned {
size
}
}
}
#[test]
fn aligned_rename_failure() {
Aligned(5);
}
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 with the supplied Rust reproducer and trace the rename handling for a public re-export where a struct and function share a name. Add or adapt a regression test around aligned_rename_failure, and consider the issue done when renaming the struct no longer breaks the function-style use shown in the test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100