Unnamed repository; edit this file 'description' to name the repository.
fix: Fix `.zip(None)` call
| -rw-r--r-- | crates/hir-ty/src/next_solver/generics.rs | 2 | ||||
| -rw-r--r-- | crates/hir-ty/src/tests/coercion.rs | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/crates/hir-ty/src/next_solver/generics.rs b/crates/hir-ty/src/next_solver/generics.rs index e0a69a6602..9558a8b2b3 100644 --- a/crates/hir-ty/src/next_solver/generics.rs +++ b/crates/hir-ty/src/next_solver/generics.rs @@ -96,7 +96,7 @@ impl<'db> Generics<'db> { (id, None) } }) - .chain(self.additional_param.zip(None)) + .chain(self.additional_param.map(|param| (param, None))) } } diff --git a/crates/hir-ty/src/tests/coercion.rs b/crates/hir-ty/src/tests/coercion.rs index db06d55278..6d4ad93070 100644 --- a/crates/hir-ty/src/tests/coercion.rs +++ b/crates/hir-ty/src/tests/coercion.rs @@ -88,6 +88,24 @@ fn test(a: A<[u8; 2]>, b: B<[u8; 2]>, c: C<[u8; 2]>) { } #[test] +fn coerce_pointee_derive() { + check_no_mismatches( + r#" +//- minicore: coerce_pointee +use core::marker::CoercePointee; + +#[derive(CoercePointee)] +#[repr(transparent)] +struct Pointer<T: ?Sized>(*const T); + +fn coerce(value: Pointer<[u8; 1]>) -> Pointer<[u8]> { + value +} +"#, + ); +} + +#[test] fn unsized_from_keeps_type_info() { check_types( r#" |