Implement the ! type by canndrew · Pull Request #35162 · rust-lang/rust (original) (raw)

OK so @eddyb and I chatted a bunch on IRC. In general, I'm feeling nervous about how the "never-to-any" adjustment is different from other adjustments. For one thing, it's applied eagerly, in write_ty, and we want it to be reflected in expr_ty (which until now was basically an alias for node_ty). This also seems to suggest that some of the other logic for applying adjustments may be wrong -- although it seems like we already in some cases apply coercions even when another coerce exists, and the code is handling that case.

I can see various ways to go forward:

Honestly without trying to work through either of those latter two options, I'm not quite sure how easy/hard they would be, but it seems like option 3 probably leaves us with a cleaner setup than we started with overall (presuming it works), so maybe worth a try.