Closed
Description
#![feature(existential_type)]
trait MyTrait {
type AssocType: Send;
fn ret(&self) -> Self::AssocType;
}
impl MyTrait for () {
existential type AssocType: Send;
fn ret(&self) -> Self::AssocType {
()
}
}
impl<'a> MyTrait for &'a () {
existential type AssocType: Send;
fn ret(&self) -> Self::AssocType {
()
}
}
trait MyLifetimeTrait<'a> {
type AssocType: Send + 'a;
fn ret(&self) -> Self::AssocType;
}
impl<'a> MyLifetimeTrait<'a> for &'a () {
existential type AssocType: Send + 'a;
fn ret(&self) -> Self::AssocType {
*self
}
}
error: could not find defining uses
--> src/lib.rs:16:5
|
16 | existential type AssocType: Send;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> src/lib.rs:28:5
|
28 | existential type AssocType: Send + 'a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: hidden type `&'a ()` captures the lifetime 'a as defined on the impl at 27:6
--> src/lib.rs:27:6
|
27 | impl<'a> MyLifetimeTrait<'a> for &'a () {
| ^^
error: could not find defining uses
--> src/lib.rs:28:5
|
28 | existential type AssocType: Send + 'a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cc @cramertj
(original report at #34511 (comment))
@rustbot modify labels: A-impl-trait C-bug
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done