File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -751,7 +751,7 @@ impl<'db> InferenceContext<'_, 'db> {
751751
752752 if let Some ( lhs_ty) = lhs_ty {
753753 self . write_pat_ty ( target, lhs_ty) ;
754- self . infer_expr_coerce ( value, & Expectation :: has_type ( lhs_ty) , ExprIsRead :: No ) ;
754+ self . infer_expr_coerce ( value, & Expectation :: has_type ( lhs_ty) , ExprIsRead :: Yes ) ;
755755 } else {
756756 let rhs_ty = self . infer_expr ( value, & Expectation :: none ( ) , ExprIsRead :: Yes ) ;
757757 let resolver_guard =
Original file line number Diff line number Diff line change @@ -786,6 +786,22 @@ fn coerce_ref_mut_binding() -> ! {
786786 )
787787}
788788
789+ #[ test]
790+ fn assign_never_place_no_mismatch ( ) {
791+ check_no_mismatches (
792+ r#"
793+ //- minicore: sized
794+ fn foo() {
795+ unsafe {
796+ let p: *mut ! = 0 as _;
797+ let mut x: () = ();
798+ x = *p;
799+ }
800+ }
801+ "# ,
802+ ) ;
803+ }
804+
789805#[ test]
790806fn never_place_isnt_diverging ( ) {
791807 check_infer_with_mismatches (
You can’t perform that action at this time.
0 commit comments