diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c65316..748ac93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.2] - 2023-09-04 +### Changed +- Fixed validation of Catalog self-injection + ## [0.7.1] - 2023-08-30 ### Changed - Linked with latest dependencies diff --git a/Cargo.lock b/Cargo.lock index 0d500f4..ff51a7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "dill" -version = "0.7.1" +version = "0.7.2" dependencies = [ "dill-impl", "multimap", @@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "dill-impl" -version = "0.7.1" +version = "0.7.2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 4acb670..f4c0ee8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["dill-impl", "dill"] [workspace.package] -version = "0.7.1" +version = "0.7.2" edition = "2021" readme = "README.md" homepage = "https://github.com/sergiimk/dill-rs" @@ -17,4 +17,4 @@ include = ["benches/*.rs", "src/**/*.rs", "Cargo.toml"] [workspace.dependencies] -dill-impl = { path = "dill-impl", version = "0.7.1" } +dill-impl = { path = "dill-impl", version = "0.7.2" } diff --git a/dill/src/specs.rs b/dill/src/specs.rs index b6be03c..0997377 100644 --- a/dill/src/specs.rs +++ b/dill/src/specs.rs @@ -68,6 +68,10 @@ impl DependencySpec for OneOf { // TODO: Avoid wrapping in Arc? Ok(Arc::new(cat.clone())) } + + fn check(_: &Catalog) -> Result<(), InjectionError> { + Ok(()) + } } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/dill/tests/tests/test_validation.rs b/dill/tests/tests/test_validation.rs index 2d50558..9d6add0 100644 --- a/dill/tests/tests/test_validation.rs +++ b/dill/tests/tests/test_validation.rs @@ -81,3 +81,27 @@ fn test_validate_ingores_bound_fields() { b.validate().unwrap(); } + +#[test] +fn test_validate_catalog_inject() { + trait A: Send + Sync {} + + #[allow(dead_code)] + struct AImpl { + catalog: Catalog, + } + + #[component] + impl AImpl { + pub fn new(catalog: Catalog) -> Self { + Self { catalog } + } + } + impl A for AImpl {} + + let mut b = CatalogBuilder::new(); + b.add::(); + b.bind::(); + + b.validate().unwrap(); +}