Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d8c7a15

Browse files
cjgillotMark-Simulacrum
authored andcommitted
Return a FxIndexSet in is_late_bound query.
This return value is iterated upon by borrowck, hence the need to preserve a deterministic iteration order.
1 parent f835f9c commit d8c7a15

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

compiler/rustc_middle/src/arena.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ macro_rules! arena_types {
8585
[] attribute: rustc_ast::Attribute,
8686
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
8787
[] hir_id_set: rustc_hir::HirIdSet,
88+
[] late_bound_lifetimes: rustc_data_structures::fx::FxIndexSet<rustc_hir::def_id::LocalDefId>,
8889

8990
// Interned types
9091
[] tys: rustc_data_structures::intern::WithStableHash<rustc_middle::ty::TyS<'tcx>>,

compiler/rustc_middle/src/middle/resolve_lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::ty;
44

5-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5+
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
66
use rustc_hir::def_id::{DefId, LocalDefId};
77
use rustc_hir::ItemLocalId;
88
use rustc_macros::HashStable;
@@ -64,7 +64,7 @@ pub struct ResolveLifetimes {
6464
/// Set of lifetime def ids that are late-bound; a region can
6565
/// be late-bound if (a) it does NOT appear in a where-clause and
6666
/// (b) it DOES appear in the arguments.
67-
pub late_bound: FxHashMap<LocalDefId, FxHashSet<LocalDefId>>,
67+
pub late_bound: FxHashMap<LocalDefId, FxIndexSet<LocalDefId>>,
6868

6969
pub late_bound_vars: FxHashMap<LocalDefId, FxHashMap<ItemLocalId, Vec<ty::BoundVariableKind>>>,
7070
}

compiler/rustc_middle/src/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ rustc_queries! {
15371537
Option<&'tcx FxHashMap<ItemLocalId, Region>> {
15381538
desc { "looking up a named region" }
15391539
}
1540-
query is_late_bound_map(_: LocalDefId) -> Option<(LocalDefId, &'tcx FxHashSet<LocalDefId>)> {
1540+
query is_late_bound_map(_: LocalDefId) -> Option<(LocalDefId, &'tcx FxIndexSet<LocalDefId>)> {
15411541
desc { "testing if a region is late bound" }
15421542
}
15431543
/// For a given item (like a struct), gets the default lifetimes to be used

compiler/rustc_middle/src/ty/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::ty::{self, AdtSizedConstraint, CrateInherentImpls, ParamEnvAnd, Ty, T
3636
use rustc_ast as ast;
3737
use rustc_ast::expand::allocator::AllocatorKind;
3838
use rustc_attr as attr;
39-
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
39+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
4040
use rustc_data_structures::steal::Steal;
4141
use rustc_data_structures::svh::Svh;
4242
use rustc_data_structures::sync::Lrc;

compiler/rustc_resolve/src/late/lifetimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
use crate::late::diagnostics::{ForLifetimeSpanType, MissingLifetimeSpot};
1010
use rustc_ast::walk_list;
11-
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
11+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
1212
use rustc_errors::{struct_span_err, Applicability, Diagnostic};
1313
use rustc_hir as hir;
1414
use rustc_hir::def::{DefKind, Res};
@@ -540,7 +540,7 @@ fn item_for(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> LocalDefId {
540540
fn is_late_bound_map<'tcx>(
541541
tcx: TyCtxt<'tcx>,
542542
def_id: LocalDefId,
543-
) -> Option<(LocalDefId, &'tcx FxHashSet<LocalDefId>)> {
543+
) -> Option<(LocalDefId, &'tcx FxIndexSet<LocalDefId>)> {
544544
match tcx.def_kind(def_id) {
545545
DefKind::AnonConst | DefKind::InlineConst => {
546546
let mut def_id = tcx.local_parent(def_id);

0 commit comments

Comments
 (0)