-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
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.
lloydmeta, asonix, LukasKalbertodt, pcpthm, Frizi and 11 more
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.