Rollup merge of #138610 - oli-obk:no-sort-hir-ids, r=compiler-errors
impl !PartialOrd for HirId revive of https://github.com/rust-lang/rust/pull/92233 Another checkbox of https://github.com/rust-lang/rust/issues/90317, another small step in making incremental less likely to die in horrible ways
This commit is contained in:
commit
48a3919884
39 changed files with 295 additions and 240 deletions
|
@ -159,7 +159,7 @@ fn find_capture_matching_projections<'a, 'tcx>(
|
|||
) -> Option<(usize, &'a Capture<'tcx>)> {
|
||||
let hir_projections = convert_to_hir_projections_and_truncate_for_capture(projections);
|
||||
|
||||
upvars.get_by_key_enumerated(var_hir_id.0).find(|(_, capture)| {
|
||||
upvars.get_by_key_enumerated(var_hir_id.0.local_id).find(|(_, capture)| {
|
||||
let possible_ancestor_proj_kinds: Vec<_> =
|
||||
capture.captured_place.place.projections.iter().map(|proj| proj.kind).collect();
|
||||
is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections)
|
||||
|
|
|
@ -13,7 +13,7 @@ use rustc_data_structures::sorted_map::SortedIndexMultiMap;
|
|||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::{self as hir, BindingMode, ByRef, HirId, Node};
|
||||
use rustc_hir::{self as hir, BindingMode, ByRef, HirId, ItemLocalId, Node};
|
||||
use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_index::{Idx, IndexSlice, IndexVec};
|
||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||
|
@ -221,7 +221,7 @@ struct Builder<'a, 'tcx> {
|
|||
coverage_info: Option<coverageinfo::CoverageInfoBuilder>,
|
||||
}
|
||||
|
||||
type CaptureMap<'tcx> = SortedIndexMultiMap<usize, HirId, Capture<'tcx>>;
|
||||
type CaptureMap<'tcx> = SortedIndexMultiMap<usize, ItemLocalId, Capture<'tcx>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Capture<'tcx> {
|
||||
|
@ -853,6 +853,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let capture_tys = upvar_args.upvar_tys();
|
||||
|
||||
let tcx = self.tcx;
|
||||
let mut upvar_owner = None;
|
||||
self.upvars = tcx
|
||||
.closure_captures(self.def_id)
|
||||
.iter()
|
||||
|
@ -866,6 +867,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
HirPlaceBase::Upvar(upvar_id) => upvar_id.var_path.hir_id,
|
||||
_ => bug!("Expected an upvar"),
|
||||
};
|
||||
let upvar_base = upvar_owner.get_or_insert(var_id.owner);
|
||||
assert_eq!(*upvar_base, var_id.owner);
|
||||
let var_id = var_id.local_id;
|
||||
|
||||
let mutability = captured_place.mutability;
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
|
|||
|
||||
/// Whether the `unsafe_op_in_unsafe_fn` lint is `allow`ed at the current HIR node.
|
||||
fn unsafe_op_in_unsafe_fn_allowed(&self) -> bool {
|
||||
self.tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, self.hir_context).0 == Level::Allow
|
||||
self.tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, self.hir_context).level == Level::Allow
|
||||
}
|
||||
|
||||
/// Handle closures/coroutines/inline-consts, which is unsafecked with their parent body.
|
||||
|
@ -292,8 +292,10 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||
});
|
||||
}
|
||||
BlockSafety::ExplicitUnsafe(hir_id) => {
|
||||
let used =
|
||||
matches!(self.tcx.lint_level_at_node(UNUSED_UNSAFE, hir_id), (Level::Allow, _));
|
||||
let used = matches!(
|
||||
self.tcx.lint_level_at_node(UNUSED_UNSAFE, hir_id).level,
|
||||
Level::Allow
|
||||
);
|
||||
self.in_safety_context(
|
||||
SafetyContext::UnsafeBlock {
|
||||
span: block.span,
|
||||
|
|
|
@ -1025,7 +1025,7 @@ fn find_fallback_pattern_typo<'tcx>(
|
|||
pat: &Pat<'tcx>,
|
||||
lint: &mut UnreachablePattern<'_>,
|
||||
) {
|
||||
if let (Level::Allow, _) = cx.tcx.lint_level_at_node(UNREACHABLE_PATTERNS, hir_id) {
|
||||
if let Level::Allow = cx.tcx.lint_level_at_node(UNREACHABLE_PATTERNS, hir_id).level {
|
||||
// This is because we use `with_no_trimmed_paths` later, so if we never emit the lint we'd
|
||||
// ICE. At the same time, we don't really need to do all of this if we won't emit anything.
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue