]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
suggest to add move keyword for generator
[rust.git] / src / librustc_mir / borrow_check / nll / explain_borrow / mod.rs
index eae2f832ba7918c80ed68a97061100a312ff8073..5354b45f92d0a236dfd90f1cfa5f0d69db94ed34 100644 (file)
@@ -17,6 +17,7 @@
 
 mod find_use;
 
+#[derive(Debug)]
 pub(in crate::borrow_check) enum BorrowExplanation {
     UsedLater(LaterUseKind, Span),
     UsedLaterInLoop(LaterUseKind, Span),
@@ -35,7 +36,7 @@ pub(in crate::borrow_check) enum BorrowExplanation {
     Unexplained,
 }
 
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Debug)]
 pub(in crate::borrow_check) enum LaterUseKind {
     TraitCapture,
     ClosureCapture,
@@ -95,7 +96,7 @@ pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'tcx>(
                 should_note_order,
             } => {
                 let local_decl = &body.local_decls[dropped_local];
-                let (dtor_desc, type_desc) = match local_decl.ty.sty {
+                let (dtor_desc, type_desc) = match local_decl.ty.kind {
                     // If type is an ADT that implements Drop, then
                     // simplify output by reporting just the ADT name.
                     ty::Adt(adt, _substs) if adt.has_dtor(tcx) && !adt.is_box() => (
@@ -612,7 +613,7 @@ fn was_captured_by_trait_object(&self, borrow: &BorrowData<'tcx>) -> bool {
                             {
                                 debug!("was_captured_by_trait_object: ty={:?}", ty);
                                 // Check the type for a trait object.
-                                return match ty.sty {
+                                return match ty.kind {
                                     // `&dyn Trait`
                                     ty::Ref(_, ty, _) if ty.is_trait() => true,
                                     // `Box<dyn Trait>`