Skip to content

Apply MCP 1003 and move diagnostics.rs into its own module - part 2#159096

Closed
GuillaumeGomez wants to merge 2 commits into
rust-lang:mainfrom
GuillaumeGomez:rename-diagnostics-2
Closed

Apply MCP 1003 and move diagnostics.rs into its own module - part 2#159096
GuillaumeGomez wants to merge 2 commits into
rust-lang:mainfrom
GuillaumeGomez:rename-diagnostics-2

Conversation

@GuillaumeGomez

@GuillaumeGomez GuillaumeGomez commented Jul 10, 2026

Copy link
Copy Markdown
Member

Part of #158699.

First commit comes from #158732, I'll rebase once merged.

This PR moves the content of late/diagnostics.rs into diagnostics/impls.rs as mentioned by @petrochenkov (please correct me if I misunderstood).

r? @JonathanBrouwer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 10, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
To only update this specific test, also pass `--test-args track-diagnostics/track.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="0" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/track-diagnostics/track.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/track-diagnostics/track" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "track-diagnostics"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find value `rust` in this scope
##[error]  --> /checkout/tests/ui/track-diagnostics/track.rs:18:11
   |
---
   |     ^^^^^^^^^^ cannot `break` outside of a loop or labeled block
   |
   = note: -Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/loops.rs:388:32

error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?
##[error]  --> /checkout/tests/ui/track-diagnostics/track.rs:18:5
   |
LL |     break rust;
   |     ^^^^^^^^^^
   |
   = note: -Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/lib.rs:681:24
   = note: the compiler expectedly panicked. this is a feature.
   = note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675
   = note: rustc 1.99.0-nightly (83d9dce32 2026-07-10) running on aarch64-unknown-linux-gnu
   = note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0 -Z track-diagnostics


thread 'rustc' (177496) panicked at compiler/rustc_hir_typeck/src/lib.rs:697:10:
Box<dyn Any>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.99.0-nightly (83d9dce32 2026-07-10) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0 -Z track-diagnostics

query stack during panic:
#0 [typeck_root] type-checking `main`
#1 [analysis] running analysis passes on crate `track`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0268, E0425.
For more information about an error, try `rustc --explain E0268`.
------------------------------------------

---- [ui] tests/ui/track-diagnostics/track.rs stdout end ----
---- [ui] tests/ui/track-diagnostics/track3.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/track-diagnostics/track3/track3.stderr`
diff of stderr:

4 LL |     let _unimported = Blah { field: u8 };
5    |                       ^^^^ not found in this scope
6    |
-    = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
+    = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/diagnostics/impls.rs:LL:CC
8 
9 error[E0423]: expected value, found builtin type `u8`
10   --> $DIR/track3.rs:LL:CC

12 LL |     let _unimported = Blah { field: u8 };
13    |                                     ^^ not a value
14    |
-    = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
+    = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/diagnostics/impls.rs:LL:CC
16 
---
To only update this specific test, also pass `--test-args track-diagnostics/track3.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/track-diagnostics/track3.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/track-diagnostics/track3" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "track-diagnostics"
stdout: none
--- stderr -------------------------------
error[E0422]: cannot find struct, variant or union type `Blah` in this scope
##[error]  --> /checkout/tests/ui/track-diagnostics/track3.rs:10:23
   |
LL |     let _unimported = Blah { field: u8 };
   |                       ^^^^ not found in this scope
   |
   = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/diagnostics/impls.rs:4769:36

error[E0423]: expected value, found builtin type `u8`
##[error]  --> /checkout/tests/ui/track-diagnostics/track3.rs:10:37
   |
LL |     let _unimported = Blah { field: u8 };
   |                                     ^^ not a value
   |
   = note: -Ztrack-diagnostics: created at compiler/rustc_resolve/src/diagnostics/impls.rs:4769:36

error: aborting due to 2 previous errors

@petrochenkov

petrochenkov commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR moves the content of late/diagnostics.rs into diagnostics/impls.rs

No, no, we certainly shouldn't do that.
There may be several (former) diagnostics.rs files in a crate, and this is an example.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Indeed this move is not needed, I think this file is fine where it is :)

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

So I leave the sub-diagnostics.rs files as is? If so, I can close this PR. :)

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Perfect, closing then!

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 10, 2026
@GuillaumeGomez GuillaumeGomez deleted the rename-diagnostics-2 branch July 10, 2026 20:29
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants