diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-05-21 22:15:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-21 22:15:00 +0200 |
| commit | fea2e5c74630705def35649c9e33ead6b9474b54 (patch) | |
| tree | 7484c5a5eca4383a2bbc146115760818007d15e0 /compiler/rustc_parse/src/errors.rs | |
| parent | eff339b22c4d6a0503f822fc85654781adf5e5a2 (diff) | |
| parent | 2a403dc81d092ed42edfed48b94ba34c33028ae3 (diff) | |
| download | rust-fea2e5c74630705def35649c9e33ead6b9474b54.tar.gz rust-fea2e5c74630705def35649c9e33ead6b9474b54.zip | |
Rollup merge of #141356 - dianne:thir-lower-params-before-body-expr, r=compiler-errors
lower bodies' params to thir before the body's value Two motivations for this: - Lowering params first means errors from lowering the params are emitted before errors from lowering the body's expression. This comes up in [tests/ui/associated-consts/associated-const-type-parameter-pattern.stderr](https://github.com/rust-lang/rust/compare/master...dianne:rust:thir-lower-params-before-body-expr?expand=1#diff-acac6ea10e991af0da91633e08b2739f9f9ca0c8f826401b6ba829914d0806f2), where both the params and expression encounter errors in translating consts to patterns. This change puts the errors in the order they appear in the source file. - Guard patterns (#129967) contain expressions, so lowering params containing guard patterns may add more expressions to the THIR. However, there's a check for `-Zunpretty=thir-tree` that the final expression in the THIR corresponds to its value [(link)](https://github.com/rust-lang/rust/blob/c43786c9b7b8d8dcc3f9c604e0e3074c16ed69d3/compiler/rustc_mir_build/src/builder/mod.rs#L453-L455); lowering params last would break this. As an alternative way to get guard patterns to work, I think the pretty-printer could use the expression returned by `thir_body` and the check could be removed or changed (#141357).
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
