Make destructuring a defining use

This commit is contained in:
Oli Scherer 2022-06-28 07:17:43 +00:00
parent 728c7e8bda
commit 6b33d5bfa9
2 changed files with 20 additions and 0 deletions

View File

@ -793,6 +793,14 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
ProjectionElem::OpaqueCast(ty) => {
let ty = self.sanitize_type(place, ty);
let ty = self.cx.normalize(ty, location);
self.cx
.eq_types(
base.ty,
ty,
location.to_locations(),
ConstraintCategory::TypeAnnotation,
)
.unwrap();
PlaceTy::from_ty(ty)
}
}

View File

@ -0,0 +1,12 @@
#![feature(type_alias_impl_trait)]
// check-pass
type T = impl Copy;
fn foo(foo: T) {
let (mut x, mut y) = foo;
x = 42;
y = "foo";
}
fn main() {}