Skip to content

Commit 3815fc0

Browse files
committed
Auto merge of rust-lang#3310 - rust-lang:rustup-2024-02-22, r=oli-obk
Automatic Rustup
2 parents 596dd65 + 6f3bc7d commit 3815fc0

File tree

628 files changed

+12885
-8260
lines changed

Some content is hidden

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

628 files changed

+12885
-8260
lines changed

.reuse/dep5

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Copyright: 2019 The Crossbeam Project Developers
5252
The Rust Project Developers (see https://thanks.rust-lang.org)
5353
License: MIT OR Apache-2.0
5454

55-
Files: library/std/src/sys/pal/unix/locks/fuchsia_mutex.rs
55+
Files: library/std/src/sys/locks/mutex/fuchsia.rs
5656
Copyright: 2016 The Fuchsia Authors
5757
The Rust Project Developers (see https://thanks.rust-lang.org)
5858
License: BSD-2-Clause AND (MIT OR Apache-2.0)

Cargo.lock

+11-1
Original file line numberDiff line numberDiff line change
@@ -2627,6 +2627,7 @@ dependencies = [
26272627
"rustc-std-workspace-alloc",
26282628
"rustc-std-workspace-core",
26292629
"ruzstd",
2630+
"wasmparser",
26302631
]
26312632

26322633
[[package]]
@@ -4047,7 +4048,6 @@ dependencies = [
40474048
name = "rustc_interface"
40484049
version = "0.0.0"
40494050
dependencies = [
4050-
"libloading",
40514051
"rustc-rayon",
40524052
"rustc-rayon-core",
40534053
"rustc_ast",
@@ -6128,6 +6128,16 @@ version = "0.2.91"
61286128
source = "registry+https://github.com/rust-lang/crates.io-index"
61296129
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
61306130

6131+
[[package]]
6132+
name = "wasmparser"
6133+
version = "0.118.2"
6134+
source = "registry+https://github.com/rust-lang/crates.io-index"
6135+
checksum = "77f1154f1ab868e2a01d9834a805faca7bf8b50d041b4ca714d005d0dab1c50c"
6136+
dependencies = [
6137+
"indexmap",
6138+
"semver",
6139+
]
6140+
61316141
[[package]]
61326142
name = "web-sys"
61336143
version = "0.3.68"

compiler/rustc_arena/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<T> ArenaChunk<T> {
9595
unsafe {
9696
if mem::size_of::<T>() == 0 {
9797
// A pointer as large as possible for zero-sized elements.
98-
ptr::invalid_mut(!0)
98+
ptr::without_provenance_mut(!0)
9999
} else {
100100
self.start().add(self.storage.len())
101101
}

compiler/rustc_ast_lowering/src/errors.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc_errors::{
2-
codes::*, AddToDiagnostic, Diagnostic, DiagnosticArgFromDisplay, SubdiagnosticMessageOp,
2+
codes::*, AddToDiagnostic, DiagnosticArgFromDisplay, DiagnosticBuilder, EmissionGuarantee,
3+
SubdiagnosticMessageOp,
34
};
45
use rustc_macros::{Diagnostic, Subdiagnostic};
56
use rustc_span::{symbol::Ident, Span, Symbol};
@@ -41,7 +42,11 @@ pub struct InvalidAbi {
4142
pub struct InvalidAbiReason(pub &'static str);
4243

4344
impl AddToDiagnostic for InvalidAbiReason {
44-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
45+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
46+
self,
47+
diag: &mut DiagnosticBuilder<'_, G>,
48+
_: F,
49+
) {
4550
#[allow(rustc::untranslatable_diagnostic)]
4651
diag.note(self.0);
4752
}

compiler/rustc_ast_lowering/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1636,9 +1636,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16361636
if let Some(old_def_id) = self.orig_opt_local_def_id(param) {
16371637
old_def_id
16381638
} else {
1639-
self.dcx()
1640-
.span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime");
1641-
continue;
1639+
self.dcx().span_bug(lifetime.ident.span, "no def-id for fresh lifetime");
16421640
}
16431641
}
16441642

compiler/rustc_ast_passes/src/ast_validation.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,10 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
881881
&item.vis,
882882
errors::VisibilityNotPermittedNote::TraitImpl,
883883
);
884-
// njn: use Dummy here
885-
if let TyKind::Err(_) = self_ty.kind {
886-
this.dcx().emit_err(errors::ObsoleteAuto { span: item.span });
884+
if let TyKind::Dummy = self_ty.kind {
885+
// Abort immediately otherwise the `TyKind::Dummy` will reach HIR lowering,
886+
// which isn't allowed. Not a problem for this obscure, obsolete syntax.
887+
this.dcx().emit_fatal(errors::ObsoleteAuto { span: item.span });
887888
}
888889
if let (&Unsafe::Yes(span), &ImplPolarity::Negative(sp)) = (unsafety, polarity)
889890
{

compiler/rustc_ast_passes/src/errors.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
//! Errors emitted by ast_passes.
22
33
use rustc_ast::ParamKindOrd;
4-
use rustc_errors::{codes::*, AddToDiagnostic, Applicability, Diagnostic, SubdiagnosticMessageOp};
4+
use rustc_errors::{
5+
codes::*, AddToDiagnostic, Applicability, DiagnosticBuilder, EmissionGuarantee,
6+
SubdiagnosticMessageOp,
7+
};
58
use rustc_macros::{Diagnostic, Subdiagnostic};
69
use rustc_span::{symbol::Ident, Span, Symbol};
710

@@ -372,7 +375,11 @@ pub struct EmptyLabelManySpans(pub Vec<Span>);
372375

373376
// The derive for `Vec<Span>` does multiple calls to `span_label`, adding commas between each
374377
impl AddToDiagnostic for EmptyLabelManySpans {
375-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
378+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
379+
self,
380+
diag: &mut DiagnosticBuilder<'_, G>,
381+
_: F,
382+
) {
376383
diag.span_labels(self.0, "");
377384
}
378385
}
@@ -729,7 +736,11 @@ pub struct StableFeature {
729736
}
730737

731738
impl AddToDiagnostic for StableFeature {
732-
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
739+
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
740+
self,
741+
diag: &mut DiagnosticBuilder<'_, G>,
742+
_: F,
743+
) {
733744
diag.arg("name", self.name);
734745
diag.arg("since", self.since);
735746
diag.help(fluent::ast_passes_stable_since);

compiler/rustc_ast_passes/src/feature_gate.rs

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ macro_rules! gate {
2222
}};
2323
($visitor:expr, $feature:ident, $span:expr, $explain:expr, $help:expr) => {{
2424
if !$visitor.features.$feature && !$span.allows_unstable(sym::$feature) {
25+
// FIXME: make this translatable
26+
#[allow(rustc::diagnostic_outside_of_impl)]
27+
#[allow(rustc::untranslatable_diagnostic)]
2528
feature_err(&$visitor.sess, sym::$feature, $span, $explain).with_help($help).emit();
2629
}
2730
}};

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+21-14
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
use either::Either;
77
use rustc_data_structures::captures::Captures;
88
use rustc_data_structures::fx::FxIndexSet;
9-
use rustc_errors::{
10-
codes::*, struct_span_code_err, Applicability, Diagnostic, DiagnosticBuilder, MultiSpan,
11-
};
9+
use rustc_errors::{codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan};
1210
use rustc_hir as hir;
1311
use rustc_hir::def::{DefKind, Res};
1412
use rustc_hir::intravisit::{walk_block, walk_expr, Visitor};
@@ -635,7 +633,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
635633

636634
fn suggest_assign_value(
637635
&self,
638-
err: &mut Diagnostic,
636+
err: &mut DiagnosticBuilder<'_>,
639637
moved_place: PlaceRef<'tcx>,
640638
sugg_span: Span,
641639
) {
@@ -674,7 +672,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
674672

675673
fn suggest_borrow_fn_like(
676674
&self,
677-
err: &mut Diagnostic,
675+
err: &mut DiagnosticBuilder<'_>,
678676
ty: Ty<'tcx>,
679677
move_sites: &[MoveSite],
680678
value_name: &str,
@@ -742,7 +740,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
742740

743741
fn suggest_cloning(
744742
&self,
745-
err: &mut Diagnostic,
743+
err: &mut DiagnosticBuilder<'_>,
746744
ty: Ty<'tcx>,
747745
expr: &hir::Expr<'_>,
748746
span: Span,
@@ -778,7 +776,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
778776
}
779777
}
780778

781-
fn suggest_adding_copy_bounds(&self, err: &mut Diagnostic, ty: Ty<'tcx>, span: Span) {
779+
fn suggest_adding_copy_bounds(
780+
&self,
781+
err: &mut DiagnosticBuilder<'_>,
782+
ty: Ty<'tcx>,
783+
span: Span,
784+
) {
782785
let tcx = self.infcx.tcx;
783786
let generics = tcx.generics_of(self.mir_def_id());
784787

@@ -1225,7 +1228,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12251228
#[instrument(level = "debug", skip(self, err))]
12261229
fn suggest_using_local_if_applicable(
12271230
&self,
1228-
err: &mut Diagnostic,
1231+
err: &mut DiagnosticBuilder<'_>,
12291232
location: Location,
12301233
issued_borrow: &BorrowData<'tcx>,
12311234
explanation: BorrowExplanation<'tcx>,
@@ -1321,7 +1324,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13211324

13221325
fn suggest_slice_method_if_applicable(
13231326
&self,
1324-
err: &mut Diagnostic,
1327+
err: &mut DiagnosticBuilder<'_>,
13251328
place: Place<'tcx>,
13261329
borrowed_place: Place<'tcx>,
13271330
) {
@@ -1430,7 +1433,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14301433
/// ```
14311434
pub(crate) fn explain_iterator_advancement_in_for_loop_if_applicable(
14321435
&self,
1433-
err: &mut Diagnostic,
1436+
err: &mut DiagnosticBuilder<'_>,
14341437
span: Span,
14351438
issued_spans: &UseSpans<'tcx>,
14361439
) {
@@ -1617,7 +1620,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
16171620
/// ```
16181621
fn suggest_using_closure_argument_instead_of_capture(
16191622
&self,
1620-
err: &mut Diagnostic,
1623+
err: &mut DiagnosticBuilder<'_>,
16211624
borrowed_place: Place<'tcx>,
16221625
issued_spans: &UseSpans<'tcx>,
16231626
) {
@@ -1751,7 +1754,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
17511754

17521755
fn suggest_binding_for_closure_capture_self(
17531756
&self,
1754-
err: &mut Diagnostic,
1757+
err: &mut DiagnosticBuilder<'_>,
17551758
issued_spans: &UseSpans<'tcx>,
17561759
) {
17571760
let UseSpans::ClosureUse { capture_kind_span, .. } = issued_spans else { return };
@@ -2997,7 +3000,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
29973000
self.buffer_error(err);
29983001
}
29993002

3000-
fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut Diagnostic) {
3003+
fn explain_deref_coercion(&mut self, loan: &BorrowData<'tcx>, err: &mut DiagnosticBuilder<'_>) {
30013004
let tcx = self.infcx.tcx;
30023005
if let (
30033006
Some(Terminator {
@@ -3532,7 +3535,11 @@ enum AnnotatedBorrowFnSignature<'tcx> {
35323535
impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
35333536
/// Annotate the provided diagnostic with information about borrow from the fn signature that
35343537
/// helps explain.
3535-
pub(crate) fn emit(&self, cx: &mut MirBorrowckCtxt<'_, 'tcx>, diag: &mut Diagnostic) -> String {
3538+
pub(crate) fn emit(
3539+
&self,
3540+
cx: &mut MirBorrowckCtxt<'_, 'tcx>,
3541+
diag: &mut DiagnosticBuilder<'_>,
3542+
) -> String {
35363543
match self {
35373544
&AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => {
35383545
diag.span_label(

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
55

6-
use rustc_errors::{Applicability, Diagnostic};
6+
use rustc_errors::{Applicability, DiagnosticBuilder};
77
use rustc_hir as hir;
88
use rustc_hir::intravisit::Visitor;
99
use rustc_index::IndexSlice;
@@ -65,7 +65,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
6565
tcx: TyCtxt<'tcx>,
6666
body: &Body<'tcx>,
6767
local_names: &IndexSlice<Local, Option<Symbol>>,
68-
err: &mut Diagnostic,
68+
err: &mut DiagnosticBuilder<'_>,
6969
borrow_desc: &str,
7070
borrow_span: Option<Span>,
7171
multiple_borrow_span: Option<(Span, Span)>,
@@ -306,7 +306,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
306306
fn add_object_lifetime_default_note(
307307
&self,
308308
tcx: TyCtxt<'tcx>,
309-
err: &mut Diagnostic,
309+
err: &mut DiagnosticBuilder<'_>,
310310
unsize_ty: Ty<'tcx>,
311311
) {
312312
if let ty::Adt(def, args) = unsize_ty.kind() {
@@ -359,7 +359,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
359359

360360
fn add_lifetime_bound_suggestion_to_diagnostic(
361361
&self,
362-
err: &mut Diagnostic,
362+
err: &mut DiagnosticBuilder<'_>,
363363
category: &ConstraintCategory<'tcx>,
364364
span: Span,
365365
region_name: &RegionName,

compiler/rustc_borrowck/src/diagnostics/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::session_diagnostics::{
55
CaptureVarKind, CaptureVarPathUseCause, OnClosureNote,
66
};
77
use itertools::Itertools;
8-
use rustc_errors::{Applicability, Diagnostic};
8+
use rustc_errors::{Applicability, DiagnosticBuilder};
99
use rustc_hir as hir;
1010
use rustc_hir::def::{CtorKind, Namespace};
1111
use rustc_hir::CoroutineKind;
@@ -80,7 +80,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
8080
&self,
8181
location: Location,
8282
place: PlaceRef<'tcx>,
83-
diag: &mut Diagnostic,
83+
diag: &mut DiagnosticBuilder<'_>,
8484
) -> bool {
8585
debug!("add_moved_or_invoked_closure_note: location={:?} place={:?}", location, place);
8686
let mut target = place.local_or_deref_local();
@@ -588,7 +588,7 @@ impl UseSpans<'_> {
588588
pub(super) fn args_subdiag(
589589
self,
590590
dcx: &rustc_errors::DiagCtxt,
591-
err: &mut Diagnostic,
591+
err: &mut DiagnosticBuilder<'_>,
592592
f: impl FnOnce(Span) -> CaptureArgLabel,
593593
) {
594594
if let UseSpans::ClosureUse { args_span, .. } = self {
@@ -601,7 +601,7 @@ impl UseSpans<'_> {
601601
pub(super) fn var_path_only_subdiag(
602602
self,
603603
dcx: &rustc_errors::DiagCtxt,
604-
err: &mut Diagnostic,
604+
err: &mut DiagnosticBuilder<'_>,
605605
action: crate::InitializationRequiringAction,
606606
) {
607607
use crate::InitializationRequiringAction::*;
@@ -638,7 +638,7 @@ impl UseSpans<'_> {
638638
pub(super) fn var_subdiag(
639639
self,
640640
dcx: &rustc_errors::DiagCtxt,
641-
err: &mut Diagnostic,
641+
err: &mut DiagnosticBuilder<'_>,
642642
kind: Option<rustc_middle::mir::BorrowKind>,
643643
f: impl FnOnce(hir::ClosureKind, Span) -> CaptureVarCause,
644644
) {
@@ -1010,7 +1010,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10101010

10111011
fn explain_captures(
10121012
&mut self,
1013-
err: &mut Diagnostic,
1013+
err: &mut DiagnosticBuilder<'_>,
10141014
span: Span,
10151015
move_span: Span,
10161016
move_spans: UseSpans<'tcx>,

0 commit comments

Comments
 (0)