Skip to content

Commit 6b33d5b

Browse files
committed
Make destructuring a defining use
1 parent 728c7e8 commit 6b33d5b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,14 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
793793
ProjectionElem::OpaqueCast(ty) => {
794794
let ty = self.sanitize_type(place, ty);
795795
let ty = self.cx.normalize(ty, location);
796+
self.cx
797+
.eq_types(
798+
base.ty,
799+
ty,
800+
location.to_locations(),
801+
ConstraintCategory::TypeAnnotation,
802+
)
803+
.unwrap();
796804
PlaceTy::from_ty(ty)
797805
}
798806
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(type_alias_impl_trait)]
2+
// check-pass
3+
4+
type T = impl Copy;
5+
6+
fn foo(foo: T) {
7+
let (mut x, mut y) = foo;
8+
x = 42;
9+
y = "foo";
10+
}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)