resolve: Avoid some unstable iteration 3
This commit is contained in:
parent
0ce1369bde
commit
c25e4bfe68
2 changed files with 6 additions and 12 deletions
|
@ -272,7 +272,7 @@ impl RibKind<'_> {
|
|||
/// resolving, the name is looked up from inside out.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Rib<'ra, R = Res> {
|
||||
pub bindings: FxHashMap<Ident, R>,
|
||||
pub bindings: FxIndexMap<Ident, R>,
|
||||
pub patterns_with_skipped_bindings: UnordMap<DefId, Vec<(Span, Result<(), ErrorGuaranteed>)>>,
|
||||
pub kind: RibKind<'ra>,
|
||||
}
|
||||
|
@ -1642,8 +1642,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
|
||||
// Allow all following defaults to refer to this type parameter.
|
||||
let i = &Ident::with_dummy_span(param.ident.name);
|
||||
forward_ty_ban_rib.bindings.remove(i);
|
||||
forward_ty_ban_rib_const_param_ty.bindings.remove(i);
|
||||
forward_ty_ban_rib.bindings.swap_remove(i);
|
||||
forward_ty_ban_rib_const_param_ty.bindings.swap_remove(i);
|
||||
}
|
||||
GenericParamKind::Const { ref ty, kw_span: _, ref default } => {
|
||||
// Const parameters can't have param bounds.
|
||||
|
@ -1678,8 +1678,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
|
||||
// Allow all following defaults to refer to this const parameter.
|
||||
let i = &Ident::with_dummy_span(param.ident.name);
|
||||
forward_const_ban_rib.bindings.remove(i);
|
||||
forward_const_ban_rib_const_param_ty.bindings.remove(i);
|
||||
forward_const_ban_rib.bindings.swap_remove(i);
|
||||
forward_const_ban_rib_const_param_ty.bindings.swap_remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2888,7 +2888,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
break;
|
||||
}
|
||||
|
||||
#[allow(rustc::potential_query_instability)] // FIXME
|
||||
seen_bindings
|
||||
.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
|
||||
}
|
||||
|
@ -4003,7 +4002,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxHashMap<Ident, Res> {
|
||||
fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxIndexMap<Ident, Res> {
|
||||
&mut self.ribs[ns].last_mut().unwrap().bindings
|
||||
}
|
||||
|
||||
|
|
|
@ -830,7 +830,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
if let Some(rib) = &self.last_block_rib
|
||||
&& let RibKind::Normal = rib.kind
|
||||
{
|
||||
#[allow(rustc::potential_query_instability)] // FIXME
|
||||
for (ident, &res) in &rib.bindings {
|
||||
if let Res::Local(_) = res
|
||||
&& path.len() == 1
|
||||
|
@ -1019,7 +1018,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
if let Some(err_code) = err.code {
|
||||
if err_code == E0425 {
|
||||
for label_rib in &self.label_ribs {
|
||||
#[allow(rustc::potential_query_instability)] // FIXME
|
||||
for (label_ident, node_id) in &label_rib.bindings {
|
||||
let ident = path.last().unwrap().ident;
|
||||
if format!("'{ident}") == label_ident.to_string() {
|
||||
|
@ -2265,7 +2263,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
};
|
||||
|
||||
// Locals and type parameters
|
||||
#[allow(rustc::potential_query_instability)] // FIXME
|
||||
for (ident, &res) in &rib.bindings {
|
||||
if filter_fn(res) && ident.span.ctxt() == rib_ctxt {
|
||||
names.push(TypoSuggestion::typo_from_ident(*ident, res));
|
||||
|
@ -2793,7 +2790,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
let within_scope = self.is_label_valid_from_rib(rib_index);
|
||||
|
||||
let rib = &self.label_ribs[rib_index];
|
||||
#[allow(rustc::potential_query_instability)] // FIXME
|
||||
let names = rib
|
||||
.bindings
|
||||
.iter()
|
||||
|
@ -2805,7 +2801,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||
// Upon finding a similar name, get the ident that it was from - the span
|
||||
// contained within helps make a useful diagnostic. In addition, determine
|
||||
// whether this candidate is within scope.
|
||||
#[allow(rustc::potential_query_instability)] // FIXME
|
||||
let (ident, _) = rib.bindings.iter().find(|(ident, _)| ident.name == symbol).unwrap();
|
||||
(*ident, within_scope)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue