-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc panics compiling async_trait with an associated type #65500
Comments
Why |
@Gymmasssorla Your code still depends on |
I have executed trait MyTrait {
type MyType;
fn call_boxed<'life0, 'async_trait>(
&'life0 self,
) -> ::core::pin::Pin<
Box<
dyn ::core::future::Future<Output = Self::MyType> + ::core::marker::Send + 'async_trait,
>,
>
where
'life0: 'async_trait,
Self: 'async_trait;
}
struct MyStruct;
impl MyTrait for MyStruct {
type MyType = i32;
fn call_boxed<'life0, 'async_trait>(
&'life0 self,
) -> ::core::pin::Pin<
Box<
dyn ::core::future::Future<Output = Self::MyType> + ::core::marker::Send + 'async_trait,
>,
>
where
'life0: 'async_trait,
Self: 'async_trait,
{
#[allow(clippy::used_underscore_binding)]
async fn __call_boxed(_self: &MyStruct) -> <MyStruct as MyTrait>::MyType {
_self.call().await
}
Box::pin(__call_boxed(self))
}
}
impl MyStruct {
async fn call(&self) -> Self::Output {
5
}
}
fn main() {} The playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f0658bacf89df3cd99dfa092c82ffd9a. |
I might have a minimal case: rustc 1.40.0-nightly (e413dc3 2019-10-14) [dependencies]
tiberius = "0.3.2" use tiberius::transaction::Transaction;
async fn suivi_log(
conn: Transaction<std::boxed::Box<dyn tiberius::BoxableIo>>,
) -> Transaction<std::boxed::Box<dyn tiberius::BoxableIo>> {
conn
}
fn main() {}
|
I can no longer reproduce this with a fresh master build and I believe this was fixed by https://github.com/rust-lang/rust/pull/65235/files#diff-35fad773654cfed45bea0a2abcbe12a6L691-L692 |
I am too, closing the issue. |
rustc
panics if I define an associated type inside an#[async_trait]
trait and implement it for a structure:Inside
src/main.rs
:Inside
Cargo.toml
:Meta
The text was updated successfully, but these errors were encountered: