Skip to content

Conversation

@politikl
Copy link
Contributor

@politikl politikl commented Nov 9, 2025

Fixes #148558

Summary

This PR merges the redundant error codes E0412 and E0425 into a single unified error code (E0425).

Background

E0412 ("type name is not in scope") and E0425 ("unresolved name") conveyed essentially the same information to users - that an identifier cannot be found in the current scope. The only difference was that E0412 was used for type positions while E0425 was used for value/expression positions. This distinction was not meaningful to users and created unnecessary complexity.

Changes

  • Compiler changes:

    • Updated error code mapping in rustc_resolve to use E0425 for both type and expression positions
    • Updated diagnostic handling code and comments throughout the codebase to reflect the merge
  • Documentation changes:

    • Marked E0412 documentation as no longer emitted, with a note that it has been merged into E0425
    • Enhanced E0425 documentation to include examples for both type and value resolution errors
  • Test changes:

    • Updated all test files (21 .rs files and 173 .stderr files) to expect E0425 instead of E0412
    • Blessed all affected tests to update expected outputs

Testing

All tests pass successfully:

  • ✓ tests/ui/error-codes/E0412.rs (with --bless)
  • ✓ tests/ui/resolve/* (292 tests)
  • ✓ tests/ui/typeck/* (262 tests)
  • ✓ tests/ui/trait-bounds/* (140 tests)
  • ✓ rustdoc error code tests
  • ✓ All tidy checks

This is a cleanup change that improves consistency in error reporting without changing the user-facing error messages themselves.

@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2025

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2025
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Nov 9, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment has been minimized.

E0412 ("type name is not in scope") and E0425 ("unresolved name")
convey essentially the same information to users - that an identifier
cannot be found in the current scope. The only difference was that
E0412 was used for type positions while E0425 was used for value/
expression positions. This distinction was not meaningful to users.

This commit merges E0412 into E0425, making E0425 the unified error
code for all unresolved name errors regardless of position.

Changes made:
- Updated error code mapping in rustc_resolve to use E0425 for both
  type and expression positions
- Updated diagnostic handling code and comments to reflect the merge
- Marked E0412 documentation as no longer emitted, noting it has been
  merged into E0425
- Enhanced E0425 documentation to include type resolution examples
- Updated all test files and expected outputs to use E0425 instead of
  E0412
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Kivooeo
Copy link
Member

Kivooeo commented Nov 9, 2025

As far as I see there is already a PR for that? #148678

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

Kivooeo

This comment was marked as duplicate.

@politikl
Copy link
Contributor Author

politikl commented Nov 9, 2025

Thank you @Kivooeo for pointing out that PR #148678 already addresses this issue! I didn't see it when I started working on this.

Since #148678 was opened first, I'm closing this PR to avoid duplication. If helpful, the maintainers are welcome to reference any parts of my implementation.

Apologies for the duplicate work!

@politikl politikl closed this Nov 9, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2025
@politikl politikl reopened this Nov 9, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2025
@politikl politikl closed this Nov 9, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2025
@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@politikl politikl deleted the merge-e0412-e0425 branch November 9, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E0412 and E0425 are redundant

5 participants