1
Fork 0

Remove #![allow(rustc::potential_query_instability)] from rustc_infer

Change reported_violations to use IndexSet

It is being used to iterate and to insert, without a lot of lookups
so hopefully it won't be a perf hit

Change MiniGraph.nodes to use IndexSet

It is being used to iterate and to insert, without performing lookups
so hopefully it won't be a perf hit

Change RegionConstraintData.givens to a FxIndexSet

This might result in a perf hit. Remove was being used in `givens`,
and `FxIndexSet` doesn't allow calling remove without losing the
fixed iteration order. So it was necessary to change remove to
`shift_remove`, but this method is slower.

Change OpaqueTypesVisitor to use stable sets and maps

This could also be a perf hit.

Make TraitObject visitor use a stable set
This commit is contained in:
CastilloDel 2022-10-28 12:20:45 +02:00
parent a9ef10019f
commit e9502010b4
10 changed files with 31 additions and 26 deletions

View file

@ -2,7 +2,7 @@
#![deny(rustc::diagnostic_outside_of_impl)]
//! Error reporting machinery for lifetime errors.
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, MultiSpan};
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::Visitor;
@ -276,7 +276,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
fn get_impl_ident_and_self_ty_from_trait(
&self,
def_id: DefId,
trait_objects: &FxHashSet<DefId>,
trait_objects: &FxIndexSet<DefId>,
) -> Option<(Ident, &'tcx hir::Ty<'tcx>)> {
let tcx = self.infcx.tcx;
match tcx.hir().get_if_local(def_id) {
@ -830,7 +830,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
};
debug!(?param);
let mut visitor = TraitObjectVisitor(FxHashSet::default());
let mut visitor = TraitObjectVisitor(FxIndexSet::default());
visitor.visit_ty(param.param_ty);
let Some((ident, self_ty)) =
@ -843,7 +843,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
fn suggest_constrain_dyn_trait_in_impl(
&self,
err: &mut Diagnostic,
found_dids: &FxHashSet<DefId>,
found_dids: &FxIndexSet<DefId>,
ident: Ident,
self_ty: &hir::Ty<'_>,
) -> bool {