-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-type-systemArea: Type systemArea: Type systemC-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.T-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Consider this snippet [playpen]:
trait Foo {}
impl<'a> Foo for &'a usize {}
// Ok when this impl is commented-out.
impl<'a, T> Foo for &'a Vec<T> where &'a T: Foo {}
fn foo<T>(_: T) where for<'a> &'a T: Foo {}
fn main() {
foo(0);
}
error[E0275]: overflow evaluating the requirement `_: std::marker::Sized`
--> <anon>:11:5
|
11 | foo(0);
| ^^^
|
= note: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because of the requirements on the impl of `for<'a> Foo` for `&'a std::vec::Vec<_>`
= note: required because of the requirements on the impl of `for<'a> Foo` for `&'a std::vec::Vec<std::vec::Vec<_>>`
= note: required because of the requirements on the impl of `for<'a> Foo` for `&'a std::vec::Vec<std::vec::Vec<std::vec::Vec<_>>>`
[ and so on... ]
= note: required by `foo`
There is no issue when trait implementation for &'a Vec<T>
is commented-out, even though Vec
isn't actually used anywhere when calling foo
method.
colt-browning, juancampa, omninonsense, vihdzp, misha-antonenko and 5 more
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemC-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.T-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.