Open
Description
Reduced test case:
#![recursion_limit = "5"]
fn main() {}
trait Serialize {}
struct Ser<'a, T: 'a>(&'a T);
impl<'a, T> Ser<'a, T> where Ser<'a, T>: Serialize {
pub fn new(value: &'a T) -> Self {
Ser(value)
}
}
impl<'a, T> Serialize for Ser<'a, Option<T>> where Ser<'a, T>: Serialize {}
fn serialize<'a, T>(value: &'a T) where Ser<'a, T>: Serialize {
Ser::new(value);
}
Output in rustc 1.17.0-nightly (536a900 2017-02-17):
error[E0275]: overflow evaluating the requirement `_: std::marker::Sized`
--> a.rs:20:5
|
20 | Ser::new(value);
| ^^^^^^^^
|
= note: consider adding a `#![recursion_limit="10"]` attribute to your crate
= note: required because of the requirements on the impl of `Serialize` for `Ser<'_, std::option::Option<_>>`
= note: required because of the requirements on the impl of `Serialize` for `Ser<'_, std::option::Option<std::option::Option<_>>>`
= note: required because of the requirements on the impl of `Serialize` for `Ser<'_, std::option::Option<std::option::Option<std::option::Option<_>>>>`
= note: required because of the requirements on the impl of `Serialize` for `Ser<'_, std::option::Option<std::option::Option<std::option::Option<std::option::Option<_>>>>>`
= note: required because of the requirements on the impl of `Serialize` for `Ser<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<_>>>>>>`
error: aborting due to previous error
Without #![recursion_limit = "5"]
, the error message is similar but much larger. If this isn’t a bug, at least the diagnostic should be improved.