Improve type mismatch annotation for lets with block-wrapped initializers - #161730
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| parent => Some(parent), | ||
| }, | ||
| ) else { | ||
| return; |
There was a problem hiding this comment.
why is this early return correct? Maybe add a comment?
There was a problem hiding this comment.
i think it's better to change it to expect here, an expression must have a non-block ancestor.
| match (self.tcx.parent_hir_node(expr.hir_id), error) { | ||
| // Skip nested block find the correct parent node to point at | ||
| let mut current_hir_id = expr.hir_id; | ||
| let Some(parent) = self.tcx.hir_parent_iter(expr.hir_id).find_map( |
There was a problem hiding this comment.
I played around with a labeled block here instead but it's not obviously better.
ca30e20 to
a83939a
Compare
|
CI got stuck somehow. Maybe just rebase on current main and try again? |
a83939a to
ef175bb
Compare
|
This PR was rebased onto a different main 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. |
|
@bors r+ rollup |
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
Rollup of 7 pull requests Successful merges: - #150075 (Implement clamp_to) - #157145 (Codegen Overloaded LLVM intrinsics based on their name) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #161456 (reduce perf impact of scalar size checks) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161860 (atomicptr.rs test: remove unused import)
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
Rollup of 14 pull requests Successful merges: - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #161456 (reduce perf impact of scalar size checks) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`)
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…-type-mismatch-attribution, r=folkertdev Improve type mismatch annotation for lets with block-wrapped initializers Fixes rust-lang#127048
…uwer Rollup of 21 pull requests Successful merges: - #158609 (Update sccache to 0.16.0) - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160562 (add target feature ABI checks for SPARC) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #161456 (reduce perf impact of scalar size checks) - #161528 (Add regression test to ensure optimal compilation) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161859 (Do not optimize MIR for comptime ConstFns) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - #161889 (Add link to ownership section in ptr::read docs) - #161890 (rustdoc: some clarifying comments) - #161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - #161702 (Use `drop_guard` in some places in {core,alloc,std})
…uwer Rollup of 21 pull requests Successful merges: - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160562 (add target feature ABI checks for SPARC) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #157218 (Track items behind `cfg_select` in the same way we do for `cfg`) - #161456 (reduce perf impact of scalar size checks) - #161528 (Add regression test to ensure optimal compilation) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161859 (Do not optimize MIR for comptime ConstFns) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - #161889 (Add link to ownership section in ptr::read docs) - #161890 (rustdoc: some clarifying comments) - #161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - #161702 (Use `drop_guard` in some places in {core,alloc,std})
Fixes #127048