Closed
Description
having a function signature like the following, results in a stack overflow during compilation on rustc 1.26.0 (a775680 2018-05-07), rustc 1.26.0-beta.18 (2018-05-03 1f200ac), and rustc 1.27.0-nightly (e5f80f2 2018-05-09)
fn test_impl_Add() -> impl std::ops::Add {1 + 1}
fn test_impl_Sub() -> impl std::ops::Sub {1 - 1}
fn test_impl_Mul() -> impl std::ops::Mul {1 * 1}
fn test_impl_Div() -> impl std::ops::Div {2 / 1}
fn test_impl_AddAssign() -> impl std::ops::AddAssign { 1 }
fn test_impl_SubAssign() -> impl std::ops::SubAssign { 1 }
fn test_impl_MulAssign() -> impl std::ops::MulAssign { 1 }
fn test_impl_DivAssign() -> impl std::ops::DivAssign { 1 }
Adding the Output parameter, like the example below, still results in a stack overflow:
fn test_impl_Add() -> impl std::ops::Add<Output = i32> {1 + 1}
fn test_impl_Sub() -> impl std::ops::Sub<Output = i32> {1 - 1}
fn test_impl_Mul() -> impl std::ops::Mul<Output = i32> {1 * 1}
fn test_impl_Div() -> impl std::ops::Div<Output = i32> {2 / 1}
A signature looking like fn test_iml_add() -> impl std::ops::Add<u32> {1 + 1}
however does compile.
A playground link to make things more clear: https://play.rust-lang.org/?gist=9990fff6d401794400ba4d424ec89f54&version=beta&mode=debug