]> git.lizzy.rs Git - rust.git/commitdiff
Misc code review changes
authorcjkenn <cam.j.kennedy@gmail.com>
Fri, 20 Oct 2017 06:06:22 +0000 (23:06 -0700)
committercjkenn <cam.j.kennedy@gmail.com>
Fri, 20 Oct 2017 06:22:04 +0000 (23:22 -0700)
src/librustc/ty/context.rs
src/librustc_typeck/check/mod.rs

index 8232c0ed46096997e961edc0050724347822a684..80a9cda1e183277c069388e9ee52c30333d735b7 100644 (file)
@@ -388,7 +388,8 @@ pub struct TypeckTables<'tcx> {
 
     /// Set of trait imports actually used in the method resolution.
     /// This is used for warning unused imports. During type
-    /// checking, this field should not be cloned.
+    /// checking, this `Rc` should not be cloned: it must have a ref-count
+    /// of 1 so that we can insert things into the set mutably.
     pub used_trait_imports: Rc<DefIdSet>,
 
     /// If any errors occurred while type-checking this body,
index c4c8f65a994a8918242780a80ccda0a401f0be4b..7807c4c7352262a5f56e8a7a7de503a2375d3d14 100644 (file)
@@ -850,7 +850,7 @@ fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 fn used_trait_imports<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                               def_id: DefId)
                               -> Rc<DefIdSet> {
-    Rc::clone(&tcx.typeck_tables_of(def_id).used_trait_imports)
+    tcx.typeck_tables_of(def_id).used_trait_imports.clone()
 }
 
 fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,