remove unnecessary Rc
This commit is contained in:
parent
63ef74b6aa
commit
e386d410e0
3 changed files with 8 additions and 15 deletions
|
@ -141,7 +141,7 @@ fn has_typeck_results(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDefId> {
|
fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDefId> {
|
||||||
&*tcx.typeck(def_id).used_trait_imports
|
&tcx.typeck(def_id).used_trait_imports
|
||||||
}
|
}
|
||||||
|
|
||||||
fn typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &ty::TypeckResults<'tcx> {
|
fn typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &ty::TypeckResults<'tcx> {
|
||||||
|
|
|
@ -12,7 +12,6 @@ pub use self::MethodError::*;
|
||||||
|
|
||||||
use crate::errors::OpMethodGenericParams;
|
use crate::errors::OpMethodGenericParams;
|
||||||
use crate::FnCtxt;
|
use crate::FnCtxt;
|
||||||
use rustc_data_structures::sync::Lrc;
|
|
||||||
use rustc_errors::{Applicability, Diagnostic, SubdiagnosticMessage};
|
use rustc_errors::{Applicability, Diagnostic, SubdiagnosticMessage};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{CtorOf, DefKind, Namespace};
|
use rustc_hir::def::{CtorOf, DefKind, Namespace};
|
||||||
|
@ -190,11 +189,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
self.lint_dot_call_from_2018(self_ty, segment, span, call_expr, self_expr, &pick, args);
|
self.lint_dot_call_from_2018(self_ty, segment, span, call_expr, self_expr, &pick, args);
|
||||||
|
|
||||||
for import_id in &pick.import_ids {
|
for &import_id in &pick.import_ids {
|
||||||
debug!("used_trait_import: {:?}", import_id);
|
debug!("used_trait_import: {:?}", import_id);
|
||||||
Lrc::get_mut(&mut self.typeck_results.borrow_mut().used_trait_imports)
|
self.typeck_results.borrow_mut().used_trait_imports.insert(import_id);
|
||||||
.unwrap()
|
|
||||||
.insert(*import_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tcx.check_stability(pick.item.def_id, Some(call_expr.hir_id), span, None);
|
self.tcx.check_stability(pick.item.def_id, Some(call_expr.hir_id), span, None);
|
||||||
|
@ -567,10 +564,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
debug!(?pick);
|
debug!(?pick);
|
||||||
{
|
{
|
||||||
let mut typeck_results = self.typeck_results.borrow_mut();
|
let mut typeck_results = self.typeck_results.borrow_mut();
|
||||||
let used_trait_imports = Lrc::get_mut(&mut typeck_results.used_trait_imports).unwrap();
|
|
||||||
for import_id in pick.import_ids {
|
for import_id in pick.import_ids {
|
||||||
debug!(used_trait_import=?import_id);
|
debug!(used_trait_import=?import_id);
|
||||||
used_trait_imports.insert(import_id);
|
typeck_results.used_trait_imports.insert(import_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,8 @@ use crate::{
|
||||||
GenericArgKind, InternalSubsts, SubstsRef, Ty, UserSubsts,
|
GenericArgKind, InternalSubsts, SubstsRef, Ty, UserSubsts,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use rustc_data_structures::{
|
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
||||||
fx::{FxHashMap, FxIndexMap},
|
use rustc_data_structures::unord::{UnordItems, UnordSet};
|
||||||
sync::Lrc,
|
|
||||||
unord::{UnordItems, UnordSet},
|
|
||||||
};
|
|
||||||
use rustc_errors::ErrorGuaranteed;
|
use rustc_errors::ErrorGuaranteed;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::{
|
use rustc_hir::{
|
||||||
|
@ -145,7 +142,7 @@ pub struct TypeckResults<'tcx> {
|
||||||
/// This is used for warning unused imports. During type
|
/// This is used for warning unused imports. During type
|
||||||
/// checking, this `Lrc` should not be cloned: it must have a ref-count
|
/// checking, this `Lrc` should not be cloned: it must have a ref-count
|
||||||
/// of 1 so that we can insert things into the set mutably.
|
/// of 1 so that we can insert things into the set mutably.
|
||||||
pub used_trait_imports: Lrc<UnordSet<LocalDefId>>,
|
pub used_trait_imports: UnordSet<LocalDefId>,
|
||||||
|
|
||||||
/// If any errors occurred while type-checking this body,
|
/// If any errors occurred while type-checking this body,
|
||||||
/// this field will be set to `Some(ErrorGuaranteed)`.
|
/// this field will be set to `Some(ErrorGuaranteed)`.
|
||||||
|
@ -273,7 +270,7 @@ impl<'tcx> TypeckResults<'tcx> {
|
||||||
liberated_fn_sigs: Default::default(),
|
liberated_fn_sigs: Default::default(),
|
||||||
fru_field_types: Default::default(),
|
fru_field_types: Default::default(),
|
||||||
coercion_casts: Default::default(),
|
coercion_casts: Default::default(),
|
||||||
used_trait_imports: Lrc::new(Default::default()),
|
used_trait_imports: Default::default(),
|
||||||
tainted_by_errors: None,
|
tainted_by_errors: None,
|
||||||
concrete_opaque_types: Default::default(),
|
concrete_opaque_types: Default::default(),
|
||||||
closure_min_captures: Default::default(),
|
closure_min_captures: Default::default(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue