about summary refs log tree commit diff
diff options
context:
space:
mode:
authorcjkenn <cam.j.kennedy@gmail.com>2017-10-19 23:06:22 -0700
committercjkenn <cam.j.kennedy@gmail.com>2017-10-19 23:22:04 -0700
commit6f30ce0be2240758889224781a9f727e7bc325e1 (patch)
tree900c62d37df496173fa1b9395b9d86d670c8076f
parent24b4dfcf1b9862d3a8fa15a36f1d39ae0971d9f9 (diff)
downloadrust-6f30ce0be2240758889224781a9f727e7bc325e1.tar.gz
rust-6f30ce0be2240758889224781a9f727e7bc325e1.zip
Misc code review changes
-rw-r--r--src/librustc/ty/context.rs3
-rw-r--r--src/librustc_typeck/check/mod.rs2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 8232c0ed460..80a9cda1e18 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -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,
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index c4c8f65a994..7807c4c7352 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -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>,