Skip to content

Don't allow subdiagnostic to use variables from their parent#153190

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
JonathanBrouwer:subdiag_variables
Feb 28, 2026
Merged

Don't allow subdiagnostic to use variables from their parent#153190
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
JonathanBrouwer:subdiag_variables

Conversation

@JonathanBrouwer
Copy link
Contributor

@JonathanBrouwer JonathanBrouwer commented Feb 27, 2026

Tangentially related to #151366

This is PR 1/2 for structured diagnostics, will do the unstructured ones next. After the second PR I will be able to remove some code that should compensate for this PR being positive.

Regardless of this PR having a positive diff, I feel that subdiagnostics being able to use variables from their parent is very confusing, so this is for the better,.

r? @jdonszelmann

@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2026

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

HIR ty lowering was modified

cc @fmease

rustc_macros::diagnostics was changed

cc @davidtwco, @TaKO8Ki

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Feb 27, 2026
pub struct NonStaticCrateDep {
/// It's different from `crate_name` in main Diagnostic.
pub crate_name_: Symbol,
pub sub_crate_name: Symbol,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a bug! The message should have referred to crate_name_.
I don't think there's an easy way to write a regression test for this, but this shows that this PR is doing good

@jdonszelmann
Copy link
Contributor

r=me on ci

@JonathanBrouwer
Copy link
Contributor Author

@bors r=jdonszelmann rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 27, 2026

📌 Commit 350a964 has been approved by jdonszelmann

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 28, 2026
… r=jdonszelmann

Don't allow subdiagnostic to use variables from their parent

Tangentially related to rust-lang#151366

This is PR 1/2 for structured diagnostics, will do the unstructured ones next. After the second PR I will be able to remove some code that should compensate for this PR being positive.

Regardless of this PR having a positive diff, I feel that subdiagnostics being able to use variables from their parent is very confusing, so this is for the better,.

r? @jdonszelmann
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 28, 2026
… r=jdonszelmann

Don't allow subdiagnostic to use variables from their parent

Tangentially related to rust-lang#151366

This is PR 1/2 for structured diagnostics, will do the unstructured ones next. After the second PR I will be able to remove some code that should compensate for this PR being positive.

Regardless of this PR having a positive diff, I feel that subdiagnostics being able to use variables from their parent is very confusing, so this is for the better,.

r? @jdonszelmann
rust-bors bot pushed a commit that referenced this pull request Feb 28, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #153211 (`rust-analyzer` subtree update)
 - #149027 (Improve cross-crate trait impl param mismatch suggestions )
 - #152730 (add field representing types)
 - #153136 (Correctly handle `#[doc(alias = "...")]` attribute on inlined reexports)
 - #152165 (Normalize capture place `ty`s to prevent ICE)
 - #152615 (refactor 'valid for read/write' definition: exclude null)
 - #153109 (Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug)
 - #153172 (Fix comment about placeholders)
 - #153187 (Fix ICE when macro-expanded extern crate shadows std)
 - #153190 (Don't allow subdiagnostic to use variables from their parent)
 - #153200 (Remove redundant clone)
 - #153216 (mark two polonius tests as known-bug)
@rust-bors rust-bors bot merged commit f3035e7 into rust-lang:main Feb 28, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Feb 28, 2026
rust-timer added a commit that referenced this pull request Feb 28, 2026
Rollup merge of #153190 - JonathanBrouwer:subdiag_variables, r=jdonszelmann

Don't allow subdiagnostic to use variables from their parent

Tangentially related to #151366

This is PR 1/2 for structured diagnostics, will do the unstructured ones next. After the second PR I will be able to remove some code that should compensate for this PR being positive.

Regardless of this PR having a positive diff, I feel that subdiagnostics being able to use variables from their parent is very confusing, so this is for the better,.

r? @jdonszelmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants