You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Somehow in the second case we think that X is unconstrained even though it doesn't seem to contain more or less type information than the first case. Note also that this does not error if I use RPIT instead.
I think in the second example mir building doesn't generate code for the trailing expression because it's statically known as dead code. But I thought we were keeping around the typeck types nowadays, and typeck should be the same for both functions
If there's a match error, we end up constructing a failure MIR body. This will prevent us from inferring the opaque later on. This is because nothing in HIR actually constrains the TAIT either. edit: that last sentence was a lie
Activity
oli-obk commentedon Oct 30, 2023
I think in the second example mir building doesn't generate code for the trailing expression because it's statically known as dead code. But I thought we were keeping around the typeck types nowadays, and typeck should be the same for both functions
Nadrieril commentedon Oct 30, 2023
I don't think that's it, same error if I put the match in a branch (updated playground link with more variations):
Nadrieril commentedon Oct 30, 2023
In fact this doesn't need an empty type at all:
compiler-errors commentedon Oct 30, 2023
I think we're generating bogus MIR or THIR because of that empty match --
Are you sure the bug doesn't exist on the THIR/MIR building side, @Nadrieril?
(hacked
-Zunpretty=mirto dump themir_builtinstead ofinstance_mir)Nadrieril commentedon Oct 30, 2023
Oh I'm sure of nothing 😄 I just assumed an unreachable in a
if falsebranch would not affect anything elsecompiler-errors commentedon Oct 30, 2023
So:
rust/compiler/rustc_mir_build/src/build/mod.rs
Lines 58 to 60 in e6e931d
If there's a match error, we end up constructing a failure MIR body. This will prevent us from inferring the opaque later on.
This is because nothing in HIR actually constrains the TAIT either.edit: that last sentence was a lieLet me see if I can cook up a quick fix.
Rollup merge of rust-lang#117416 - compiler-errors:tait-in-bad-body, …
Rollup merge of rust-lang#117418 - compiler-errors:better_error_body,…
Rollup merge of rust-lang#117416 - compiler-errors:tait-in-bad-body, …
Unrolled build for rust-lang#117416
Auto merge of rust-lang#117418 - compiler-errors:better_error_body, r…