-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking issue for future-incompatibility lint unstable_name_collisions #48919
Copy link
Copy link
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Idea
This is the summary issue for the
unstable_name_collisionsfuture-incompatibility lint and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.What is the warning for?
Rust's standard library is evolving, and will sometimes add new functions we found useful, e.g.
Ord::clamporIterator::flatten. Unfortunately, there will often be popular third-party packages already implemented the same function with the same name. The compiler, when seeing the nameflatten, cannot decide whether you want the one from the standard library or the third-party library, and gives up with the multiple applicable items in scope error.As an inference breakage canary, the compiler will emit a warning whenever it detected a name conflict with an unstable standard library function.
To stop this warning and the future hard error, you could use fully-qualified name to explicitly tell the compiler to use the third-party function:
When will this warning become a hard error?
This warning will be emitted for every unstable library feature having name conflicts. When a particular library feature is stabilized, this name conflict will cause a hard error.
Please follow the tracking issue for each library feature for their stabilization progress. Some current unstable method which is known to cause conflict in the wild are:
Vec::try_reserve— Tracking issue fortry_reserve: RFC 2116 fallible collection allocation #48043Ord::clamp— Tracking issue for clamp RFC #44095