<!-- Thank you for filing a regression report! 🐛 A regression is something that changed between versions of Rust but was not supposed to. Please provide a short summary of the regression, along with any information you feel is relevant to replicate it. --> ### Code I tried this code (minimized from [this test] in my library): [this test]: https://github.com/AzureMarker/shaku/blob/a42af9dbf4b3b40ede4ad856e0156c7ab6c196a1/shaku/tests/repository_service_provider.rs ```rust trait HasProvider<T: ?Sized> {} trait Provider<M> { type Interface: ?Sized; } trait Repository {} trait Service {} struct DbConnection; impl<M> Provider<M> for DbConnection { type Interface = DbConnection; } struct RepositoryImpl; impl<M: HasProvider<DbConnection>> Provider<M> for RepositoryImpl { type Interface = dyn Repository; } struct ServiceImpl; impl<M: HasProvider<dyn Repository>> Provider<M> for ServiceImpl { type Interface = dyn Service; } struct TestModule; impl HasProvider<<DbConnection as Provider<Self>>::Interface> for TestModule {} impl HasProvider<<RepositoryImpl as Provider<Self>>::Interface> for TestModule {} impl HasProvider<<ServiceImpl as Provider<Self>>::Interface> for TestModule {} fn main() {} ``` I expected to see this happen: Compile without errors. Instead, this happened: Compiled with errors: ``` error[E0277]: the trait bound `TestModule: HasProvider<(dyn Repository + 'static)>` is not satisfied --> shaku/tests/debug_rust_1_56.rs:26:6 | 26 | impl HasProvider<<RepositoryImpl as Provider<Self>>::Interface> for TestModule {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasProvider<(dyn Repository + 'static)>` is not implemented for `TestModule` | = help: the following implementations were found: <TestModule as HasProvider<(dyn Repository + 'static)>> <TestModule as HasProvider<<ServiceImpl as Provider<TestModule>>::Interface>> <TestModule as HasProvider<DbConnection>> note: required by a bound in `HasProvider` --> shaku/tests/debug_rust_1_56.rs:1:1 | 1 | trait HasProvider<T: ?Sized> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `HasProvider` error[E0277]: the trait bound `TestModule: HasProvider<(dyn Repository + 'static)>` is not satisfied --> shaku/tests/debug_rust_1_56.rs:27:6 | 27 | impl HasProvider<<ServiceImpl as Provider<Self>>::Interface> for TestModule {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasProvider<(dyn Repository + 'static)>` is not implemented for `TestModule` | = help: the following implementations were found: <TestModule as HasProvider<(dyn Repository + 'static)>> <TestModule as HasProvider<<ServiceImpl as Provider<TestModule>>::Interface>> <TestModule as HasProvider<DbConnection>> note: required because of the requirements on the impl of `Provider<TestModule>` for `ServiceImpl` --> shaku/tests/debug_rust_1_56.rs:20:38 | 20 | impl<M: HasProvider<dyn Repository>> Provider<M> for ServiceImpl { | ^^^^^^^^^^^ ^^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. ``` Note that it says `HasProvider<(dyn Repository + 'static)>` is not implemented for `TestModule`, but then lists it as an existing implementation. ### Version it worked on It most recently worked on: 1.55.0 ### Version with regression `rustc --version --verbose`: ``` rustc 1.56.0 (09c42c458 2021-10-18) binary: rustc commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa commit-date: 2021-10-18 host: x86_64-unknown-linux-gnu release: 1.56.0 LLVM version: 13.0.0 ``` <!-- If you know when this regression occurred, please add a line like below, replacing `{channel}` with one of stable, beta, or nightly. @rustbot modify labels: +regression-from-stable-to-{channel} -regression-untriaged -->