Skip to content

Commit 195e931

Browse files
committed
Auto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring) - #91859 (Iterator::cycle() — document empty iterator special case) - #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`) - #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking) - #91881 (Stabilize `iter::zip`) - #91882 (Remove `in_band_lifetimes` from `rustc_typeck`) - #91940 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents d594910 + 22fc403 commit 195e931

File tree

126 files changed

+543
-492
lines changed

Some content is hidden

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

126 files changed

+543
-492
lines changed

Diff for: Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ dependencies = [
276276

277277
[[package]]
278278
name = "cargo"
279-
version = "0.59.0"
279+
version = "0.60.0"
280280
dependencies = [
281281
"anyhow",
282282
"atty",
@@ -419,7 +419,7 @@ dependencies = [
419419

420420
[[package]]
421421
name = "cargo-util"
422-
version = "0.1.1"
422+
version = "0.1.2"
423423
dependencies = [
424424
"anyhow",
425425
"core-foundation",
@@ -768,7 +768,7 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
768768

769769
[[package]]
770770
name = "crates-io"
771-
version = "0.33.0"
771+
version = "0.33.1"
772772
dependencies = [
773773
"anyhow",
774774
"curl",

Diff for: compiler/rustc_apfloat/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3434
#![no_std]
3535
#![forbid(unsafe_code)]
36-
#![feature(iter_zip)]
3736
#![feature(nll)]
3837

3938
#[macro_use]

Diff for: compiler/rustc_ast/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(box_patterns)]
1212
#![feature(crate_visibility_modifier)]
1313
#![feature(if_let_guard)]
14-
#![feature(iter_zip)]
1514
#![feature(label_break_value)]
1615
#![feature(nll)]
1716
#![feature(min_specialization)]

Diff for: compiler/rustc_ast_lowering/src/expr.rs

+55-15
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
130130
hir::AsyncGeneratorKind::Block,
131131
|this| this.with_new_scopes(|this| this.lower_block_expr(block)),
132132
),
133-
ExprKind::Await(ref expr) => self.lower_expr_await(e.span, expr),
133+
ExprKind::Await(ref expr) => {
134+
let span = if expr.span.hi() < e.span.hi() {
135+
expr.span.shrink_to_hi().with_hi(e.span.hi())
136+
} else {
137+
// this is a recovered `await expr`
138+
e.span
139+
};
140+
self.lower_expr_await(span, expr)
141+
}
134142
ExprKind::Closure(
135143
capture_clause,
136144
asyncness,
@@ -479,8 +487,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
479487
expr: &'hir hir::Expr<'hir>,
480488
overall_span: Span,
481489
) -> &'hir hir::Expr<'hir> {
482-
let constructor =
483-
self.arena.alloc(self.expr_lang_item_path(method_span, lang_item, ThinVec::new()));
490+
let constructor = self.arena.alloc(self.expr_lang_item_path(
491+
method_span,
492+
lang_item,
493+
ThinVec::new(),
494+
None,
495+
));
484496
self.expr_call(overall_span, constructor, std::slice::from_ref(expr))
485497
}
486498

@@ -584,8 +596,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
584596
// `future::from_generator`:
585597
let unstable_span =
586598
self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());
587-
let gen_future =
588-
self.expr_lang_item_path(unstable_span, hir::LangItem::FromGenerator, ThinVec::new());
599+
let gen_future = self.expr_lang_item_path(
600+
unstable_span,
601+
hir::LangItem::FromGenerator,
602+
ThinVec::new(),
603+
None,
604+
);
589605

590606
// `future::from_generator(generator)`:
591607
hir::ExprKind::Call(self.arena.alloc(gen_future), arena_vec![self; generator])
@@ -607,6 +623,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
607623
/// }
608624
/// ```
609625
fn lower_expr_await(&mut self, await_span: Span, expr: &Expr) -> hir::ExprKind<'hir> {
626+
let dot_await_span = expr.span.shrink_to_hi().to(await_span);
610627
match self.generator_kind {
611628
Some(hir::GeneratorKind::Async(_)) => {}
612629
Some(hir::GeneratorKind::Gen) | None => {
@@ -623,13 +640,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
623640
err.emit();
624641
}
625642
}
626-
let span = self.mark_span_with_reason(DesugaringKind::Await, await_span, None);
643+
let span = self.mark_span_with_reason(DesugaringKind::Await, dot_await_span, None);
627644
let gen_future_span = self.mark_span_with_reason(
628645
DesugaringKind::Await,
629646
await_span,
630647
self.allow_gen_future.clone(),
631648
);
632649
let expr = self.lower_expr_mut(expr);
650+
let expr_hir_id = expr.hir_id;
633651

634652
let pinned_ident = Ident::with_dummy_span(sym::pinned);
635653
let (pinned_pat, pinned_pat_hid) =
@@ -656,16 +674,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
656674
span,
657675
hir::LangItem::PinNewUnchecked,
658676
arena_vec![self; ref_mut_pinned],
677+
Some(expr_hir_id),
659678
);
660679
let get_context = self.expr_call_lang_item_fn_mut(
661680
gen_future_span,
662681
hir::LangItem::GetContext,
663682
arena_vec![self; task_context],
683+
Some(expr_hir_id),
664684
);
665685
let call = self.expr_call_lang_item_fn(
666686
span,
667687
hir::LangItem::FuturePoll,
668688
arena_vec![self; new_unchecked, get_context],
689+
Some(expr_hir_id),
669690
);
670691
self.arena.alloc(self.expr_unsafe(call))
671692
};
@@ -678,18 +699,28 @@ impl<'hir> LoweringContext<'_, 'hir> {
678699
let (x_pat, x_pat_hid) = self.pat_ident(span, x_ident);
679700
let x_expr = self.expr_ident(span, x_ident, x_pat_hid);
680701
let ready_field = self.single_pat_field(span, x_pat);
681-
let ready_pat = self.pat_lang_item_variant(span, hir::LangItem::PollReady, ready_field);
702+
let ready_pat = self.pat_lang_item_variant(
703+
span,
704+
hir::LangItem::PollReady,
705+
ready_field,
706+
Some(expr_hir_id),
707+
);
682708
let break_x = self.with_loop_scope(loop_node_id, move |this| {
683709
let expr_break =
684710
hir::ExprKind::Break(this.lower_loop_destination(None), Some(x_expr));
685-
this.arena.alloc(this.expr(await_span, expr_break, ThinVec::new()))
711+
this.arena.alloc(this.expr(span, expr_break, ThinVec::new()))
686712
});
687713
self.arm(ready_pat, break_x)
688714
};
689715

690716
// `::std::task::Poll::Pending => {}`
691717
let pending_arm = {
692-
let pending_pat = self.pat_lang_item_variant(span, hir::LangItem::PollPending, &[]);
718+
let pending_pat = self.pat_lang_item_variant(
719+
span,
720+
hir::LangItem::PollPending,
721+
&[],
722+
Some(expr_hir_id),
723+
);
693724
let empty_block = self.expr_block_empty(span);
694725
self.arm(pending_pat, empty_block)
695726
};
@@ -709,7 +740,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
709740
let unit = self.expr_unit(span);
710741
let yield_expr = self.expr(
711742
span,
712-
hir::ExprKind::Yield(unit, hir::YieldSource::Await { expr: Some(expr.hir_id) }),
743+
hir::ExprKind::Yield(unit, hir::YieldSource::Await { expr: Some(expr_hir_id) }),
713744
ThinVec::new(),
714745
);
715746
let yield_expr = self.arena.alloc(yield_expr);
@@ -756,6 +787,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
756787
into_future_span,
757788
hir::LangItem::IntoFutureIntoFuture,
758789
arena_vec![self; expr],
790+
Some(expr_hir_id),
759791
);
760792

761793
// match <into_future_expr> {
@@ -1160,7 +1192,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
11601192
fn lower_expr_range_closed(&mut self, span: Span, e1: &Expr, e2: &Expr) -> hir::ExprKind<'hir> {
11611193
let e1 = self.lower_expr_mut(e1);
11621194
let e2 = self.lower_expr_mut(e2);
1163-
let fn_path = hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, self.lower_span(span));
1195+
let fn_path =
1196+
hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, self.lower_span(span), None);
11641197
let fn_expr =
11651198
self.arena.alloc(self.expr(span, hir::ExprKind::Path(fn_path), ThinVec::new()));
11661199
hir::ExprKind::Call(fn_expr, arena_vec![self; e1, e2])
@@ -1194,7 +1227,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11941227
);
11951228

11961229
hir::ExprKind::Struct(
1197-
self.arena.alloc(hir::QPath::LangItem(lang_item, self.lower_span(span))),
1230+
self.arena.alloc(hir::QPath::LangItem(lang_item, self.lower_span(span), None)),
11981231
fields,
11991232
None,
12001233
)
@@ -1389,6 +1422,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13891422
head_span,
13901423
hir::LangItem::IteratorNext,
13911424
arena_vec![self; ref_mut_iter],
1425+
None,
13921426
);
13931427
let arms = arena_vec![self; none_arm, some_arm];
13941428

@@ -1417,6 +1451,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14171451
head_span,
14181452
hir::LangItem::IntoIterIntoIter,
14191453
arena_vec![self; head],
1454+
None,
14201455
)
14211456
};
14221457

@@ -1472,6 +1507,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14721507
unstable_span,
14731508
hir::LangItem::TryTraitBranch,
14741509
arena_vec![self; sub_expr],
1510+
None,
14751511
)
14761512
};
14771513

@@ -1628,8 +1664,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
16281664
span: Span,
16291665
lang_item: hir::LangItem,
16301666
args: &'hir [hir::Expr<'hir>],
1667+
hir_id: Option<hir::HirId>,
16311668
) -> hir::Expr<'hir> {
1632-
let path = self.arena.alloc(self.expr_lang_item_path(span, lang_item, ThinVec::new()));
1669+
let path =
1670+
self.arena.alloc(self.expr_lang_item_path(span, lang_item, ThinVec::new(), hir_id));
16331671
self.expr_call_mut(span, path, args)
16341672
}
16351673

@@ -1638,19 +1676,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
16381676
span: Span,
16391677
lang_item: hir::LangItem,
16401678
args: &'hir [hir::Expr<'hir>],
1679+
hir_id: Option<hir::HirId>,
16411680
) -> &'hir hir::Expr<'hir> {
1642-
self.arena.alloc(self.expr_call_lang_item_fn_mut(span, lang_item, args))
1681+
self.arena.alloc(self.expr_call_lang_item_fn_mut(span, lang_item, args, hir_id))
16431682
}
16441683

16451684
fn expr_lang_item_path(
16461685
&mut self,
16471686
span: Span,
16481687
lang_item: hir::LangItem,
16491688
attrs: AttrVec,
1689+
hir_id: Option<hir::HirId>,
16501690
) -> hir::Expr<'hir> {
16511691
self.expr(
16521692
span,
1653-
hir::ExprKind::Path(hir::QPath::LangItem(lang_item, self.lower_span(span))),
1693+
hir::ExprKind::Path(hir::QPath::LangItem(lang_item, self.lower_span(span), hir_id)),
16541694
attrs,
16551695
)
16561696
}

Diff for: compiler/rustc_ast_lowering/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
3333
#![feature(crate_visibility_modifier)]
3434
#![feature(box_patterns)]
35-
#![feature(iter_zip)]
3635
#![feature(never_type)]
3736
#![recursion_limit = "256"]
3837

@@ -2127,21 +2126,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21272126

21282127
fn pat_cf_continue(&mut self, span: Span, pat: &'hir hir::Pat<'hir>) -> &'hir hir::Pat<'hir> {
21292128
let field = self.single_pat_field(span, pat);
2130-
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowContinue, field)
2129+
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowContinue, field, None)
21312130
}
21322131

21332132
fn pat_cf_break(&mut self, span: Span, pat: &'hir hir::Pat<'hir>) -> &'hir hir::Pat<'hir> {
21342133
let field = self.single_pat_field(span, pat);
2135-
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowBreak, field)
2134+
self.pat_lang_item_variant(span, hir::LangItem::ControlFlowBreak, field, None)
21362135
}
21372136

21382137
fn pat_some(&mut self, span: Span, pat: &'hir hir::Pat<'hir>) -> &'hir hir::Pat<'hir> {
21392138
let field = self.single_pat_field(span, pat);
2140-
self.pat_lang_item_variant(span, hir::LangItem::OptionSome, field)
2139+
self.pat_lang_item_variant(span, hir::LangItem::OptionSome, field, None)
21412140
}
21422141

21432142
fn pat_none(&mut self, span: Span) -> &'hir hir::Pat<'hir> {
2144-
self.pat_lang_item_variant(span, hir::LangItem::OptionNone, &[])
2143+
self.pat_lang_item_variant(span, hir::LangItem::OptionNone, &[], None)
21452144
}
21462145

21472146
fn single_pat_field(
@@ -2164,8 +2163,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21642163
span: Span,
21652164
lang_item: hir::LangItem,
21662165
fields: &'hir [hir::PatField<'hir>],
2166+
hir_id: Option<hir::HirId>,
21672167
) -> &'hir hir::Pat<'hir> {
2168-
let qpath = hir::QPath::LangItem(lang_item, self.lower_span(span));
2168+
let qpath = hir::QPath::LangItem(lang_item, self.lower_span(span), hir_id);
21692169
self.pat(span, hir::PatKind::Struct(qpath, fields, false))
21702170
}
21712171

Diff for: compiler/rustc_borrowck/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![feature(box_patterns)]
55
#![feature(crate_visibility_modifier)]
66
#![feature(in_band_lifetimes)]
7-
#![feature(iter_zip)]
87
#![feature(let_else)]
98
#![feature(min_specialization)]
109
#![feature(stmt_expr_attributes)]

Diff for: compiler/rustc_builtin_macros/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![feature(bool_to_option)]
77
#![feature(crate_visibility_modifier)]
88
#![feature(decl_macro)]
9-
#![feature(iter_zip)]
109
#![feature(nll)]
1110
#![feature(proc_macro_internals)]
1211
#![feature(proc_macro_quote)]

Diff for: compiler/rustc_codegen_cranelift/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
205205
&self,
206206
ongoing_codegen: Box<dyn Any>,
207207
_sess: &Session,
208+
_outputs: &OutputFilenames,
208209
) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
209210
Ok(*ongoing_codegen
210211
.downcast::<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>)>()

Diff for: compiler/rustc_codegen_gcc/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl CodegenBackend for GccCodegenBackend {
9696
Box::new(res)
9797
}
9898

99-
fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
99+
fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session, _outputs: &OutputFilenames) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
100100
let (codegen_results, work_products) = ongoing_codegen
101101
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
102102
.expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")

Diff for: compiler/rustc_codegen_llvm/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#![feature(crate_visibility_modifier)]
1010
#![feature(extern_types)]
1111
#![feature(in_band_lifetimes)]
12-
#![feature(iter_zip)]
1312
#![feature(nll)]
1413
#![recursion_limit = "256"]
1514

@@ -339,6 +338,7 @@ impl CodegenBackend for LlvmCodegenBackend {
339338
&self,
340339
ongoing_codegen: Box<dyn Any>,
341340
sess: &Session,
341+
outputs: &OutputFilenames,
342342
) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
343343
let (codegen_results, work_products) = ongoing_codegen
344344
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>()
@@ -347,7 +347,8 @@ impl CodegenBackend for LlvmCodegenBackend {
347347

348348
sess.time("llvm_dump_timing_file", || {
349349
if sess.opts.debugging_opts.llvm_time_trace {
350-
llvm_util::time_trace_profiler_finish("llvm_timings.json");
350+
let file_name = outputs.with_extension("llvm_timings.json");
351+
llvm_util::time_trace_profiler_finish(&file_name);
351352
}
352353
});
353354

Diff for: compiler/rustc_codegen_llvm/src/llvm_util.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use libc::c_int;
44
use libloading::Library;
55
use rustc_codegen_ssa::target_features::supported_target_features;
66
use rustc_data_structures::fx::FxHashSet;
7+
use rustc_fs_util::path_to_c_string;
78
use rustc_middle::bug;
89
use rustc_session::config::PrintRequest;
910
use rustc_session::Session;
@@ -13,6 +14,7 @@ use std::ffi::{CStr, CString};
1314
use tracing::debug;
1415

1516
use std::mem;
17+
use std::path::Path;
1618
use std::ptr;
1719
use std::slice;
1820
use std::str;
@@ -134,9 +136,9 @@ unsafe fn configure_llvm(sess: &Session) {
134136
llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int, llvm_args.as_ptr());
135137
}
136138

137-
pub fn time_trace_profiler_finish(file_name: &str) {
139+
pub fn time_trace_profiler_finish(file_name: &Path) {
138140
unsafe {
139-
let file_name = CString::new(file_name).unwrap();
141+
let file_name = path_to_c_string(file_name);
140142
llvm::LLVMTimeTraceProfilerFinish(file_name.as_ptr());
141143
}
142144
}

0 commit comments

Comments
 (0)