/// 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,
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>,