Incorporating functions in Rust lang/prelude with clashing function name with a dependency crate in cargo toml
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
I have some suggestions as to how to go about incorporating functions with the same function name as that of a dependency crate in order to prevent conflicts.
rust-lang/rust#79524 has inspired me to create this RFC.
My suggestion goes something like this:
- Add a flag to
Cargo.tomlto load std functions before dependency functions which is by default added for new rust versions (personally I would want to include it as a feature of a new Rust edition, but since 2021 got released just now I am not so sure) even if the user declares to use the dependency crate globally unless the user marks it as something like!importantorpriority use - If there is a function with the same name in the std lib as that of dependency, and if the stdlib function is used
clippyshould show a warning. Needless to say if any error occurs while compiling, proper source of the function should be made evident in the error messages. - All of this is not required if the dependency crate is not called upon in the
Cargo.toml
Contributor guide
No contributing guide indexed for this repository
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 reading rust-lang/rust#79524 and the proposed behavior in this issue. Define how Cargo.toml dependency declarations, standard-library name precedence, clippy warnings, and compiler diagnostics should interact. Done means the proposal has a settled, implementable design with clear behavior when the dependency is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100