gccrs: add self_constructor_from_outer_item lint - #4652
Open
lucasly-ba wants to merge 1 commit into
Open
Conversation
lucasly-ba
force-pushed
the
self-constructor-from-outer-item
branch
from
June 29, 2026 16:17
c01321f to
6616157
Compare
Member
|
merge conflicts |
lucasly-ba
force-pushed
the
self-constructor-from-outer-item
branch
from
July 6, 2026 12:02
6616157 to
0e907be
Compare
Collaborator
|
I think this should be an error unassociated with the unused checker |
lucasly-ba
force-pushed
the
self-constructor-from-outer-item
branch
from
July 8, 2026 14:42
0e907be to
7e9b048
Compare
A function nested inside an associated item cannot capture the outer item's Self. gcc/rust/ChangeLog: * Make-lang.in (GRS_OBJS): Add rust-hir-self-constructor.o. * checks/errors/rust-hir-self-constructor.cc: New file. * checks/errors/rust-hir-self-constructor.h: New file. * rust-session-manager.cc (Session::compile_crate): Run the self-constructor checker. gcc/testsuite/ChangeLog: * rust/compile/self-constructor-from-outer-item_0.rs: New test. Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
lucasly-ba
force-pushed
the
self-constructor-from-outer-item
branch
from
July 9, 2026 15:54
7e9b048 to
aee4b85
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warn when the
Selfconstructor is used from an item nested inside an impl or trait, such as a function defined in a method body. Nested items do not inherit theSelfof the surrounding impl. Gated behind-frust-unused-check-2.0.