Skip to content

Commit d6affcf

Browse files
committed
Auto merge of rust-lang#119754 - matthiaskrgr:rollup-7cht4m5, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#118903 (Improved support of collapse_debuginfo attribute for macros.) - rust-lang#119033 (coverage: `llvm-cov` expects column numbers to be bytes, not code points) - rust-lang#119598 (Fix a typo in core::ops::Deref's doc) - rust-lang#119660 (remove an unnecessary stderr-per-bitwidth) - rust-lang#119663 (tests: Normalize `\r\n` to `\n` in some run-make tests) - rust-lang#119681 (coverage: Anonymize line numbers in branch views) - rust-lang#119704 (Fix two variable binding issues in lint let_underscore) - rust-lang#119725 (Add helper for when we want to know if an item has a host param) - rust-lang#119738 (Add `riscv32imafc-esp-espidf` tier 3 target for the ESP32-P4.) - rust-lang#119740 (Remove crossbeam-channel) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ca663b0 + 1c9e862 commit d6affcf

File tree

42 files changed

+981
-228
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

+981
-228
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3797,7 +3797,6 @@ dependencies = [
37973797
name = "rustc_expand"
37983798
version = "0.0.0"
37993799
dependencies = [
3800-
"crossbeam-channel",
38013800
"rustc_ast",
38023801
"rustc_ast_passes",
38033802
"rustc_ast_pretty",

compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,7 @@ impl DebugContext {
6868
// In order to have a good line stepping behavior in debugger, we overwrite debug
6969
// locations of macro expansions with that of the outermost expansion site (when the macro is
7070
// annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
71-
let span = if tcx.should_collapse_debuginfo(span) {
72-
span
73-
} else {
74-
// Walk up the macro expansion chain until we reach a non-expanded span.
75-
// We also stop at the function body level because no line stepping can occur
76-
// at the level above that.
77-
rustc_span::hygiene::walk_chain(span, function_span.ctxt())
78-
};
79-
71+
let span = tcx.collapsed_debuginfo(span, function_span);
8072
match tcx.sess.source_map().lookup_line(span.lo()) {
8173
Ok(SourceFileAndLine { sf: file, line }) => {
8274
let line_pos = file.lines()[line];

compiler/rustc_codegen_ssa/src/mir/debuginfo.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
228228
/// In order to have a good line stepping behavior in debugger, we overwrite debug
229229
/// locations of macro expansions with that of the outermost expansion site (when the macro is
230230
/// annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
231-
fn adjust_span_for_debugging(&self, mut span: Span) -> Span {
231+
fn adjust_span_for_debugging(&self, span: Span) -> Span {
232232
// Bail out if debug info emission is not enabled.
233233
if self.debug_context.is_none() {
234234
return span;
235235
}
236-
237-
if self.cx.tcx().should_collapse_debuginfo(span) {
238-
// Walk up the macro expansion chain until we reach a non-expanded span.
239-
// We also stop at the function body level because no line stepping can occur
240-
// at the level above that.
241-
// Use span of the outermost expansion site, while keeping the original lexical scope.
242-
span = rustc_span::hygiene::walk_chain(span, self.mir.span.ctxt());
243-
}
244-
245-
span
236+
// Walk up the macro expansion chain until we reach a non-expanded span.
237+
// We also stop at the function body level because no line stepping can occur
238+
// at the level above that.
239+
// Use span of the outermost expansion site, while keeping the original lexical scope.
240+
self.cx.tcx().collapsed_debuginfo(span, self.mir.span)
246241
}
247242

248243
fn spill_operand_to_stack(

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ impl Qualif for NeedsNonConstDrop {
157157
// FIXME(effects): If `destruct` is not a `const_trait`,
158158
// or effects are disabled in this crate, then give up.
159159
let destruct_def_id = cx.tcx.require_lang_item(LangItem::Destruct, Some(cx.body.span));
160-
if cx.tcx.generics_of(destruct_def_id).host_effect_index.is_none()
161-
|| !cx.tcx.features().effects
162-
{
160+
if !cx.tcx.has_host_param(destruct_def_id) || !cx.tcx.features().effects {
163161
return NeedsDrop::in_any_value_of_ty(cx, ty);
164162
}
165163

compiler/rustc_expand/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ doctest = false
99

1010
[dependencies]
1111
# tidy-alphabetical-start
12-
crossbeam-channel = "0.5.0"
1312
rustc_ast = { path = "../rustc_ast" }
1413
rustc_ast_passes = { path = "../rustc_ast_passes" }
1514
rustc_ast_pretty = { path = "../rustc_ast_pretty" }

compiler/rustc_expand/src/proc_macro.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ use rustc_session::config::ProcMacroExecutionStrategy;
1313
use rustc_span::profiling::SpannedEventArgRecorder;
1414
use rustc_span::{Span, DUMMY_SP};
1515

16-
struct CrossbeamMessagePipe<T> {
17-
tx: crossbeam_channel::Sender<T>,
18-
rx: crossbeam_channel::Receiver<T>,
16+
struct MessagePipe<T> {
17+
tx: std::sync::mpsc::SyncSender<T>,
18+
rx: std::sync::mpsc::Receiver<T>,
1919
}
2020

21-
impl<T> pm::bridge::server::MessagePipe<T> for CrossbeamMessagePipe<T> {
21+
impl<T> pm::bridge::server::MessagePipe<T> for MessagePipe<T> {
2222
fn new() -> (Self, Self) {
23-
let (tx1, rx1) = crossbeam_channel::bounded(1);
24-
let (tx2, rx2) = crossbeam_channel::bounded(1);
25-
(CrossbeamMessagePipe { tx: tx1, rx: rx2 }, CrossbeamMessagePipe { tx: tx2, rx: rx1 })
23+
let (tx1, rx1) = std::sync::mpsc::sync_channel(1);
24+
let (tx2, rx2) = std::sync::mpsc::sync_channel(1);
25+
(MessagePipe { tx: tx1, rx: rx2 }, MessagePipe { tx: tx2, rx: rx1 })
2626
}
2727

2828
fn send(&mut self, value: T) {
@@ -35,7 +35,7 @@ impl<T> pm::bridge::server::MessagePipe<T> for CrossbeamMessagePipe<T> {
3535
}
3636

3737
fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy {
38-
pm::bridge::server::MaybeCrossThread::<CrossbeamMessagePipe<_>>::new(
38+
pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new(
3939
ecx.sess.opts.unstable_opts.proc_macro_execution_strategy
4040
== ProcMacroExecutionStrategy::CrossThread,
4141
)

compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ pub enum LocalSource {
19971997
AsyncFn,
19981998
/// A desugared `<expr>.await`.
19991999
AwaitDesugar,
2000-
/// A desugared `expr = expr`, where the LHS is a tuple, struct or array.
2000+
/// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression.
20012001
/// The span is that of the `=` sign.
20022002
AssignDesugar(Span),
20032003
}

compiler/rustc_hir_typeck/src/callee.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
490490
self.tcx.require_lang_item(hir::LangItem::FnOnce, Some(span));
491491
let fn_once_output_def_id =
492492
self.tcx.require_lang_item(hir::LangItem::FnOnceOutput, Some(span));
493-
if self.tcx.generics_of(fn_once_def_id).host_effect_index.is_none() {
494-
if idx == 0 && !self.tcx.is_const_fn_raw(def_id) {
495-
self.dcx().emit_err(errors::ConstSelectMustBeConst { span });
496-
}
497-
} else {
493+
if self.tcx.has_host_param(fn_once_def_id) {
498494
let const_param: ty::GenericArg<'tcx> =
499495
([self.tcx.consts.false_, self.tcx.consts.true_])[idx].into();
500496
self.register_predicate(traits::Obligation::new(
@@ -523,6 +519,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
523519
));
524520

525521
self.select_obligations_where_possible(|_| {});
522+
} else if idx == 0 && !self.tcx.is_const_fn_raw(def_id) {
523+
self.dcx().emit_err(errors::ConstSelectMustBeConst { span });
526524
}
527525
} else {
528526
self.dcx().emit_err(errors::ConstSelectMustBeFn { span, ty: arg_ty });

compiler/rustc_lint/src/let_underscore.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
108108
if !matches!(local.pat.kind, hir::PatKind::Wild) {
109109
return;
110110
}
111+
112+
if matches!(local.source, rustc_hir::LocalSource::AsyncFn) {
113+
return;
114+
}
111115
if let Some(init) = local.init {
112116
let init_ty = cx.typeck_results().expr_ty(init);
113117
// If the type has a trivial Drop implementation, then it doesn't
@@ -126,6 +130,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
126130
suggestion: local.pat.span,
127131
multi_suggestion_start: local.span.until(init.span),
128132
multi_suggestion_end: init.span.shrink_to_hi(),
133+
is_assign_desugar: matches!(local.source, rustc_hir::LocalSource::AssignDesugar(_)),
129134
};
130135
if is_sync_lock {
131136
let mut span = MultiSpan::from_spans(vec![local.pat.span, init.span]);

compiler/rustc_lint/src/lints.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,17 +932,19 @@ pub struct NonBindingLetSub {
932932
pub suggestion: Span,
933933
pub multi_suggestion_start: Span,
934934
pub multi_suggestion_end: Span,
935+
pub is_assign_desugar: bool,
935936
}
936937

937938
impl AddToDiagnostic for NonBindingLetSub {
938939
fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F)
939940
where
940941
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
941942
{
943+
let prefix = if self.is_assign_desugar { "let " } else { "" };
942944
diag.span_suggestion_verbose(
943945
self.suggestion,
944946
fluent::lint_non_binding_let_suggestion,
945-
"_unused",
947+
format!("{prefix}_unused"),
946948
Applicability::MachineApplicable,
947949
);
948950
diag.multipart_suggestion(

0 commit comments

Comments
 (0)