-
Notifications
You must be signed in to change notification settings - Fork 24
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
Rust 2021 (1.56+) breaks shaku (fixed on 1.59) #30
Comments
Can't seem to replicate it using a simple poc.. use shaku::{module, Component, Interface, HasComponent};
trait User {
fn id(&self) -> u32;
}
trait Repository<T>: Interface where T: ?Sized {
fn get_all(&self) -> Vec<Box<T>>;
}
#[derive(Component)]
#[shaku(interface = Repository<dyn User>)]
struct UserRepositoryImpl;
impl Repository<dyn User> for UserRepositoryImpl {
fn get_all(&self) -> Vec<Box<dyn User>> {
vec![]
}
}
module! {
MyModule {
components = [UserRepositoryImpl],
providers = []
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test() {
let module = MyModule::builder()
.build();
let x: &dyn Repository<dyn User> = module.resolve_ref();
x.get_all();
}
} Code above compiles fine. In my actual codebase I get about 47 errors which all look similar to this:
Note: I removed keywords related to the project with Edit: |
Thanks for opening this issue, I'll take a look soon! |
Weird, it shows an error for me in https://github.com/AzureMarker/shaku/blob/master/shaku/tests/repository_service_provider.rs even when still using Rust 2018. |
Are you using Rust 1.56+ with the 2018 edition or Rust 1.55.0 or lower? |
Yeah, 1.56.1 on 2018 |
Well at least happy to see that it is reproducable. After digging through the release notes of Rust 1.56 nothing really seems like it should affect how this works. |
Opened bug on rustc: rust-lang/rust#90662 |
The rustc issue has been closed with a fix, and it should release in 1.59. |
Hope to see the Rust 1.59 soon then. Thanks for your involvement to help getting this fixed. |
Shaku can't compile in rust 1.56.+ ; track issue here: AzureMarker/shaku#30
Shaku can't compile in rust 1.56.+ ; track issue here: AzureMarker/shaku#30
Shaku can't compile in rust 1.56.+ ; track issue here: AzureMarker/shaku#30
Seems like Rust 1.59 has been released today, I will attempt to build the project I had issues in previously to see if it has been resolved now. For now I had been using nightly to build the project which did not have any issues. |
Fixed on 1.59 🎉 |
Thanks for following up! |
Breaking changes introduced by the new version breaks
HasComponent
impls on the module using theshaku::module
macro.I will try to provide a poc as soon as possible.
https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html
Maybe some documentation as to why this occurs is available.
The text was updated successfully, but these errors were encountered: