Tracking issue for future-incompatibility lint self_constructor_from_outer_item
#124186
Open
3 tasks
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-future-incompatibility
Category: Future-incompatibility lints
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
This is a tracking issue for the future-incompatibility lint
self_constructor_from_outer_item
.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
Rust doesn't allow referencing generics from outer items in inner nested items:
This includes, interestingly, the
Self
type alias, even if it's not generic itself:However, there was an oversight in the implementation of
Self
constructors in impls, such that this code worked:This lint is implemented for the case where the
Self
constructor doesn't reference any generic parameters. If it does, then a hard error is given instead (since the code will typically ICE or at least almost always fail to compile).How to fix
Replace the
Self
with the relevant type in theimpl
header.Tracking
Self
ctor from outer item is referenced in inner nested item #124187The text was updated successfully, but these errors were encountered: