File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -710,14 +710,14 @@ impl InferenceContext<'_> {
710
710
false
711
711
}
712
712
713
- fn is_ty_copy ( & self , ty : Ty ) -> bool {
713
+ fn is_ty_copy ( & mut self , ty : Ty ) -> bool {
714
714
if let TyKind :: Closure ( id, _) = ty. kind ( Interner ) {
715
715
// FIXME: We handle closure as a special case, since chalk consider every closure as copy. We
716
716
// should probably let chalk know which closures are copy, but I don't know how doing it
717
717
// without creating query cycles.
718
718
return self . result . closure_info . get ( id) . map ( |x| x. 1 == FnTrait :: Fn ) . unwrap_or ( true ) ;
719
719
}
720
- ty . is_copy ( self . db , self . owner )
720
+ self . table . resolve_completely ( ty ) . is_copy ( self . db , self . owner )
721
721
}
722
722
723
723
fn select_from_expr ( & mut self , expr : ExprId ) {
Original file line number Diff line number Diff line change @@ -301,6 +301,33 @@ fn main() {
301
301
* `(*x.f2.0.0).f` by mutable borrow
302
302
"# ] ] ,
303
303
) ;
304
+ check (
305
+ r#"
306
+ //- minicore: copy, option
307
+
308
+ fn do_char(c: char) {}
309
+
310
+ fn main() {
311
+ let x = None;
312
+ let y = |$0| {
313
+ match x {
314
+ Some(c) => do_char(c),
315
+ None => x = None,
316
+ }
317
+ };
318
+ }
319
+ "# ,
320
+ expect ! [ [ r#"
321
+ *|*
322
+ ```rust
323
+ {closure#0} // size = 8, align = 8
324
+ impl FnMut()
325
+ ```
326
+
327
+ ## Captures
328
+ * `x` by mutable borrow
329
+ "# ] ] ,
330
+ ) ;
304
331
}
305
332
306
333
#[ test]
You can’t perform that action at this time.
0 commit comments