PRs/Issues

This is intended to give a relatively quick link list to relevant issues/PRs or individual comments, for possible referencing/inclusion elsewhere.

Necessity of fallback changes

Canonical example of inference failure with no-inference-change scenario.


#![allow(unused)]
fn main() {
struct E;

impl From<!> for E {
    fn from(_: !) -> E {
        E
    }
}

#[allow(unreachable_code)]
fn foo(never: !) {
    <E as From<!>>::from(never);  // Ok
    <E as From<_>>::from(never);  // Inference fails here
}
}

Discussion in:

Conditional fallback

See v1 explainer for the details of the core algorithm.

Most of this code is implemented, gated on never_type_fallback, landed in #88149 (primarily refactoring) and #88804 (most of the changes).

Pain point / confusing behavior

  • Closure return types are () even if body !
  • Missing From<!> for T
    • Conflicts with From<T> for <T>
    • After stabilizing !, a crate can add From<!> for MyType preventing a std impl.
  • Uninhabited enums (e.g., for errors)

Miscellaneous