Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ebcf860

Browse files
committed
Auto merge of #136135 - GuillaumeGomez:rollup-1ik636d, r=GuillaumeGomez
Rollup of 10 pull requests Successful merges: - #135773 (Clarify WindowsMut (Lending)Iterator) - #135807 (Implement phantom variance markers) - #135876 (fix doc for std::sync::mpmc) - #135988 (Add a workaround for parallel rustc crashing when there are delayed bugs) - #136037 (Mark all NuttX targets as tier 3 target and support the standard library) - #136064 (Add a suggestion to cast target_feature fn items to fn pointers.) - #136082 (Incorporate `iter_nodes` into `graph::DirectedGraph`) - #136112 (Clean up all dead files inside `tests/ui/`) - #136114 (Use identifiers more in diagnostics code) - #136118 (Change `collect_and_partition_mono_items` tuple return type to a struct) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0cffe5c + 3d02ce7 commit ebcf860

File tree

150 files changed

+632
-3852
lines changed

Some content is hidden

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

150 files changed

+632
-3852
lines changed

‎compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub(crate) fn expand_deriving_coerce_pointee(
157157
{
158158
cx.dcx().emit_err(RequiresMaybeSized {
159159
span: pointee_ty_ident.span,
160-
name: pointee_ty_ident.name.to_ident_string(),
160+
name: pointee_ty_ident,
161161
});
162162
return;
163163
}
@@ -471,5 +471,5 @@ struct TooManyPointees {
471471
struct RequiresMaybeSized {
472472
#[primary_span]
473473
span: Span,
474-
name: String,
474+
name: Ident,
475475
}

‎compiler/rustc_codegen_cranelift/src/driver/aot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ pub(crate) fn run_aot(
676676
.to_owned();
677677

678678
let cgus = if tcx.sess.opts.output_types.should_codegen() {
679-
tcx.collect_and_partition_mono_items(()).1
679+
tcx.collect_and_partition_mono_items(()).codegen_units
680680
} else {
681681
// If only `--emit metadata` is used, we shouldn't perform any codegen.
682682
// Also `tcx.collect_and_partition_mono_items` may panic in that case.

‎compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
99
use rustc_hir::def_id::{DefId, LocalDefId};
1010
use rustc_index::IndexVec;
1111
use rustc_middle::mir;
12+
use rustc_middle::mir::mono::MonoItemPartitions;
1213
use rustc_middle::ty::{self, TyCtxt};
1314
use rustc_session::RemapFileNameExt;
1415
use rustc_session::config::RemapPathScopeComponents;
@@ -297,12 +298,13 @@ struct UsageSets<'tcx> {
297298
/// Prepare sets of definitions that are relevant to deciding whether something
298299
/// is an "unused function" for coverage purposes.
299300
fn prepare_usage_sets<'tcx>(tcx: TyCtxt<'tcx>) -> UsageSets<'tcx> {
300-
let (all_mono_items, cgus) = tcx.collect_and_partition_mono_items(());
301+
let MonoItemPartitions { all_mono_items, codegen_units } =
302+
tcx.collect_and_partition_mono_items(());
301303

302304
// Obtain a MIR body for each function participating in codegen, via an
303305
// arbitrary instance.
304306
let mut def_ids_seen = FxHashSet::default();
305-
let def_and_mir_for_all_mono_fns = cgus
307+
let def_and_mir_for_all_mono_fns = codegen_units
306308
.iter()
307309
.flat_map(|cgu| cgu.items().keys())
308310
.filter_map(|item| match item {

‎compiler/rustc_codegen_ssa/src/assert_module_sources.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>, set_reuse: &dyn Fn(&mut CguReuseTr
4646
return;
4747
}
4848

49-
let available_cgus =
50-
tcx.collect_and_partition_mono_items(()).1.iter().map(|cgu| cgu.name()).collect();
49+
let available_cgus = tcx
50+
.collect_and_partition_mono_items(())
51+
.codegen_units
52+
.iter()
53+
.map(|cgu| cgu.name())
54+
.collect();
5155

5256
let mut ams = AssertModuleSource {
5357
tcx,

‎compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ fn exported_symbols_provider_local(
293293
// external linkage is enough for monomorphization to be linked to.
294294
let need_visibility = tcx.sess.target.dynamic_linking && !tcx.sess.target.only_cdylib;
295295

296-
let (_,cgus) = tcx.collect_and_partition_mono_items(());
296+
let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;
297297

298298
// The symbols created in this loop are sorted below it
299299
#[allow(rustc::potential_query_instability)]

‎compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
619619

620620
// Run the monomorphization collector and partition the collected items into
621621
// codegen units.
622-
let codegen_units = tcx.collect_and_partition_mono_items(()).1;
622+
let codegen_units = tcx.collect_and_partition_mono_items(()).codegen_units;
623623

624624
// Force all codegen_unit queries so they are already either red or green
625625
// when compile_codegen_unit accesses them. We are not able to re-execute
@@ -1051,7 +1051,7 @@ pub(crate) fn provide(providers: &mut Providers) {
10511051
config::OptLevel::SizeMin => config::OptLevel::Default,
10521052
};
10531053

1054-
let (defids, _)= tcx.collect_and_partition_mono_items(cratenum);
1054+
let defids= tcx.collect_and_partition_mono_items(cratenum).all_mono_items;
10551055

10561056
let any_for_speed = defids.items().any(|id| {
10571057
let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id);

‎compiler/rustc_data_structures/src/graph/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@ mod tests;
1414
pub trait DirectedGraph {
1515
type Node: Idx;
1616

17+
/// Returns the total number of nodes in this graph.
18+
///
19+
/// Several graph algorithm implementations assume that every node ID is
20+
/// strictly less than the number of nodes, i.e. nodes are densely numbered.
21+
/// That assumption allows them to use `num_nodes` to allocate per-node
22+
/// data structures, indexed by node.
1723
fn num_nodes(&self) -> usize;
24+
25+
/// Iterates over all nodes of a graph in ascending numeric order.
26+
///
27+
/// Assumes that nodes are densely numbered, i.e. every index in
28+
/// `0..num_nodes` is a valid node.
29+
fn iter_nodes(
30+
&self,
31+
) -> impl Iterator<Item = Self::Node> + DoubleEndedIterator + ExactSizeIterator {
32+
(0..self.num_nodes()).map(<Self::Node as Idx>::new)
33+
}
1834
}
1935

2036
pub trait NumEdges: DirectedGraph {

‎compiler/rustc_data_structures/src/graph/scc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ where
333333
to_annotation,
334334
};
335335

336-
let scc_indices = (0..num_nodes)
337-
.map(G::Node::new)
336+
let scc_indices = graph
337+
.iter_nodes()
338338
.map(|node| match this.start_walk_from(node) {
339339
WalkReturn::Complete { scc_index, .. } => scc_index,
340340
WalkReturn::Cycle { min_depth, .. } => {

‎compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ fn try_report_async_mismatch<'tcx>(
23622362
// the right span is a bit difficult.
23632363
return Err(tcx.sess.dcx().emit_err(MethodShouldReturnFuture {
23642364
span: tcx.def_span(impl_m.def_id),
2365-
method_name: trait_m.name,
2365+
method_name: tcx.item_ident(impl_m.def_id),
23662366
trait_item_span: tcx.hir().span_if_local(trait_m.def_id),
23672367
}));
23682368
}

‎compiler/rustc_hir_analysis/src/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: LocalDefId) {
197197

198198
fn report_forbidden_specialization(tcx: TyCtxt<'_>, impl_item: DefId, parent_impl: DefId) {
199199
let span = tcx.def_span(impl_item);
200-
let ident = tcx.item_name(impl_item);
200+
let ident = tcx.item_ident(impl_item);
201201

202202
let err = match tcx.span_of_impl(parent_impl) {
203203
Ok(sp) => errors::ImplNotMarkedDefault::Ok { span, ident, ok_label: sp },
@@ -297,7 +297,7 @@ fn default_body_is_unstable(
297297
reason: Option<Symbol>,
298298
issue: Option<NonZero<u32>>,
299299
) {
300-
let missing_item_name = tcx.associated_item(item_did).name;
300+
let missing_item_name = tcx.item_ident(item_did);
301301
let (mut some_note, mut none_note, mut reason_str) = (false, false, String::new());
302302
match reason {
303303
Some(r) => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /