-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Tweak E0401 #148447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Tweak E0401 #148447
+140
−27
Conversation
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
```
error[E0401]: can't use `Self` from outer item
--> $DIR/E0401.rs:22:25
|
LL | impl<T> Iterator for A<T> {
| ---- `Self` type implicitly declared here, by this `impl`
...
LL | fn helper(sel: &Self) -> u8 {
| ------ ^^^^ use of `Self` from outer item
| |
| `Self` used in this inner function
|
help: refer to the type directly here instead
|
LL - fn helper(sel: &Self) -> u8 {
LL + fn helper(sel: &A<T>) -> u8 {
|
```
|
@bors r+ |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Nov 3, 2025
Tweak E0401 More accurate span pointing at use place of outer param (at ident instead of full path). Add note explaining why outer item params can't be used in inner item. Use structured suggestion for what `Self` should have been. Follow up to rust-lang#148370. Fix rust-lang#37892.
bors
added a commit
that referenced
this pull request
Nov 3, 2025
Rollup of 7 pull requests Successful merges: - #147141 (Suggest making binding `mut` on `&mut` reborrow) - #147945 (Port `cfg!()` macro to the new attribute parsing system ) - #147951 (Add check for `+=` typo in let chains) - #148004 (fix: Only special case single line item attribute suggestions) - #148264 (reflect that type and const parameter can be intermixed) - #148363 (Fix `wasm_import_module` attribute cross-crate) - #148447 (Tweak E0401) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Nov 4, 2025
Rollup merge of #148447 - estebank:outer-param-2, r=jackh726 Tweak E0401 More accurate span pointing at use place of outer param (at ident instead of full path). Add note explaining why outer item params can't be used in inner item. Use structured suggestion for what `Self` should have been. Follow up to #148370. Fix #37892.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
More accurate span pointing at use place of outer param (at ident instead of full path).
Add note explaining why outer item params can't be used in inner item.
Use structured suggestion for what
Selfshould have been.Follow up to #148370.
Fix #37892.