Skip to content

Commit 58c2dd9

Browse files
committed
Auto merge of rust-lang#139826 - matthiaskrgr:rollup-0q0qvkd, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#139745 (Avoid unused clones in `Cloned<I>` and `Copied<I>`) - rust-lang#139757 (opt-dist: use executable-extension for host llvm-profdata) - rust-lang#139778 (Add test for issue 34834) - rust-lang#139783 (Use `compiletest-ignore-dir` for bootstrap self-tests) - rust-lang#139797 (Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it) - rust-lang#139799 (Specify `--print info=file` syntax in `--help`) - rust-lang#139811 (Use `newtype_index!`-generated types more idiomatically) - rust-lang#139813 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2da29db + 8587c95 commit 58c2dd9

File tree

42 files changed

+353
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+353
-173
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,19 +2038,19 @@ dependencies = [
20382038

20392039
[[package]]
20402040
name = "libffi"
2041-
version = "3.2.0"
2041+
version = "4.0.0"
20422042
source = "registry+https://github.com/rust-lang/crates.io-index"
2043-
checksum = "ce826c243048e3d5cec441799724de52e2d42f820468431fc3fceee2341871e2"
2043+
checksum = "4a9434b6fc77375fb624698d5f8c49d7e80b10d59eb1219afda27d1f824d4074"
20442044
dependencies = [
20452045
"libc",
20462046
"libffi-sys",
20472047
]
20482048

20492049
[[package]]
20502050
name = "libffi-sys"
2051-
version = "2.3.0"
2051+
version = "3.2.0"
20522052
source = "registry+https://github.com/rust-lang/crates.io-index"
2053-
checksum = "f36115160c57e8529781b4183c2bb51fdc1f6d6d1ed345591d84be7703befb3c"
2053+
checksum = "ead36a2496acfc8edd6cc32352110e9478ac5b9b5f5b9856ebd3d28019addb84"
20542054
dependencies = [
20552055
"cc",
20562056
]

compiler/rustc_ast_lowering/src/path.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
448448

449449
generic_args.args.insert_many(
450450
0,
451-
(start.as_u32()..end.as_u32()).map(|i| {
452-
let id = NodeId::from_u32(i);
451+
(start..end).map(|id| {
453452
let l = self.lower_lifetime_anon_in_path(id, elided_lifetime_span);
454453
GenericArg::Lifetime(l)
455454
}),

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ fn sccs_info<'tcx>(infcx: &BorrowckInferCtxt<'tcx>, sccs: &ConstraintSccs) {
338338
let num_components = sccs.num_sccs();
339339
let mut components = vec![FxIndexSet::default(); num_components];
340340

341-
for (reg_var_idx, scc_idx) in sccs.scc_indices().iter().enumerate() {
342-
let reg_var = ty::RegionVid::from_usize(reg_var_idx);
341+
for (reg_var, scc_idx) in sccs.scc_indices().iter_enumerated() {
343342
let origin = var_to_origin.get(&reg_var).unwrap_or(&RegionCtxt::Unknown);
344343
components[scc_idx.as_usize()].insert((reg_var, *origin));
345344
}

compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::collections::hash_map::Entry;
33
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
44
use rustc_codegen_ssa::traits::*;
55
use rustc_data_structures::fx::FxHashMap;
6-
use rustc_index::Idx;
76
use rustc_index::bit_set::DenseBitSet;
87
use rustc_middle::mir::{Body, SourceScope};
98
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv};
@@ -43,8 +42,7 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>(
4342
let mut instantiated = DenseBitSet::new_empty(mir.source_scopes.len());
4443
let mut discriminators = FxHashMap::default();
4544
// Instantiate all scopes.
46-
for idx in 0..mir.source_scopes.len() {
47-
let scope = SourceScope::new(idx);
45+
for scope in mir.source_scopes.indices() {
4846
make_mir_scope(
4947
cx,
5048
instance,

compiler/rustc_hir/src/definitions.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,9 @@ impl DefPathTable {
4747
debug_assert_eq!(self.stable_crate_id, def_path_hash.stable_crate_id());
4848
let local_hash = def_path_hash.local_hash();
4949

50-
let index = {
51-
let index = DefIndex::from(self.index_to_key.len());
52-
debug!("DefPathTable::insert() - {:?} <-> {:?}", key, index);
53-
self.index_to_key.push(key);
54-
index
55-
};
50+
let index = self.index_to_key.push(key);
51+
debug!("DefPathTable::insert() - {key:?} <-> {index:?}");
52+
5653
self.def_path_hashes.push(local_hash);
5754
debug_assert!(self.def_path_hashes.len() == self.index_to_key.len());
5855

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
606606
// with placeholders, which imply nothing about outlives bounds, and then
607607
// prove below that the hidden types are well formed.
608608
let universe = infcx.create_next_universe();
609-
let mut idx = 0;
609+
let mut idx = ty::BoundVar::ZERO;
610610
let mapping: FxIndexMap<_, _> = collector
611611
.types
612612
.iter()
@@ -623,10 +623,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
623623
tcx,
624624
ty::Placeholder {
625625
universe,
626-
bound: ty::BoundTy {
627-
var: ty::BoundVar::from_usize(idx),
628-
kind: ty::BoundTyKind::Anon,
629-
},
626+
bound: ty::BoundTy { var: idx, kind: ty::BoundTyKind::Anon },
630627
},
631628
),
632629
)

compiler/rustc_infer/src/infer/region_constraints/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
618618
RegionVid::from(value_count)..RegionVid::from(self.storage.unification_table.len());
619619
(
620620
range.clone(),
621-
(range.start.index()..range.end.index())
622-
.map(|index| self.storage.var_infos[ty::RegionVid::from(index)].origin)
623-
.collect(),
621+
(range.start..range.end).map(|index| self.storage.var_infos[index].origin).collect(),
624622
)
625623
}
626624

compiler/rustc_infer/src/infer/snapshot/fudge.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ fn const_vars_since_snapshot<'tcx>(
3030
snapshot_var_len: usize,
3131
) -> (Range<ConstVid>, Vec<ConstVariableOrigin>) {
3232
let range = vars_since_snapshot(table, snapshot_var_len);
33+
let range = range.start.vid..range.end.vid;
3334

3435
(
35-
range.start.vid..range.end.vid,
36-
(range.start.index()..range.end.index())
37-
.map(|index| match table.probe_value(ConstVid::from_u32(index)) {
36+
range.clone(),
37+
range
38+
.map(|index| match table.probe_value(index) {
3839
ConstVariableValue::Known { value: _ } => {
3940
ConstVariableOrigin { param_def_id: None, span: rustc_span::DUMMY_SP }
4041
}

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,12 @@ fn write_mir_intro<'tcx>(
531531

532532
// construct a scope tree and write it out
533533
let mut scope_tree: FxHashMap<SourceScope, Vec<SourceScope>> = Default::default();
534-
for (index, scope_data) in body.source_scopes.iter().enumerate() {
534+
for (index, scope_data) in body.source_scopes.iter_enumerated() {
535535
if let Some(parent) = scope_data.parent_scope {
536-
scope_tree.entry(parent).or_default().push(SourceScope::new(index));
536+
scope_tree.entry(parent).or_default().push(index);
537537
} else {
538538
// Only the argument scope has no parent, because it's the root.
539-
assert_eq!(index, OUTERMOST_SOURCE_SCOPE.index());
539+
assert_eq!(index, OUTERMOST_SOURCE_SCOPE);
540540
}
541541
}
542542

compiler/rustc_middle/src/ty/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<'tcx> TyCtxt<'tcx> {
278278
where
279279
T: TypeFoldable<TyCtxt<'tcx>>,
280280
{
281-
let shift_bv = |bv: ty::BoundVar| ty::BoundVar::from_usize(bv.as_usize() + bound_vars);
281+
let shift_bv = |bv: ty::BoundVar| bv + bound_vars;
282282
self.replace_escaping_bound_vars_uncached(
283283
value,
284284
FnMutDelegate {

0 commit comments

Comments
 (0)