Skip to content

Commit 11f32b7

Browse files
committed
Auto merge of rust-lang#120524 - Nadrieril:rollup-67952ib, r=Nadrieril
Rollup of 9 pull requests Successful merges: - rust-lang#120207 (check `RUST_BOOTSTRAP_CONFIG` in `profile_user_dist` test) - rust-lang#120321 (pattern_analysis: cleanup the contexts) - rust-lang#120355 (document `FromIterator for Vec` allocation behaviors) - rust-lang#120430 (std: thread_local::register_dtor fix proposal for FreeBSD.) - rust-lang#120469 (Provide more context on derived obligation error primary label) - rust-lang#120472 (Make duplicate lang items fatal) - rust-lang#120490 (Don't hash lints differently to non-lints.) - rust-lang#120495 (Remove the `abi_amdgpu_kernel` feature) - rust-lang#120501 (rustdoc: Correctly handle attribute merge if this is a glob reexport) r? `@ghost` `@rustbot` modify labels: rollup
2 parents cdaa12e + 4eaf4c2 commit 11f32b7

File tree

245 files changed

+772
-903
lines changed

Some content is hidden

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

245 files changed

+772
-903
lines changed

compiler/rustc_codegen_cranelift/src/abi/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call
5656
sess.dcx().fatal("C-cmse-nonsecure-call call conv is not yet implemented");
5757
}
5858

59-
Conv::Msp430Intr
60-
| Conv::PtxKernel
61-
| Conv::AmdGpuKernel
62-
| Conv::AvrInterrupt
63-
| Conv::AvrNonBlockingInterrupt => {
59+
Conv::Msp430Intr | Conv::PtxKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
6460
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
6561
}
6662
}

compiler/rustc_codegen_llvm/src/abi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ impl From<Conv> for llvm::CallConv {
590590
Conv::Cold => llvm::ColdCallConv,
591591
Conv::PreserveMost => llvm::PreserveMost,
592592
Conv::PreserveAll => llvm::PreserveAll,
593-
Conv::AmdGpuKernel => llvm::AmdGpuKernel,
594593
Conv::AvrInterrupt => llvm::AvrInterrupt,
595594
Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt,
596595
Conv::ArmAapcs => llvm::ArmAapcsCallConv,

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ pub enum CallConv {
106106
X86_Intr = 83,
107107
AvrNonBlockingInterrupt = 84,
108108
AvrInterrupt = 85,
109-
AmdGpuKernel = 91,
110109
}
111110

112111
/// LLVMRustLinkage

compiler/rustc_errors/src/diagnostic.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ pub struct Diagnostic {
109109
/// `span` if there is one. Otherwise, it is `DUMMY_SP`.
110110
pub sort_span: Span,
111111

112-
/// If diagnostic is from Lint, custom hash function ignores children.
113-
/// Otherwise hash is based on the all the fields.
114112
pub is_lint: Option<IsLint>,
115113

116114
/// With `-Ztrack_diagnostics` enabled,
@@ -980,22 +978,24 @@ impl Diagnostic {
980978
) -> (
981979
&Level,
982980
&[(DiagnosticMessage, Style)],
983-
Vec<(&Cow<'static, str>, &DiagnosticArgValue)>,
984981
&Option<ErrCode>,
985-
&Option<IsLint>,
986982
&MultiSpan,
983+
&[SubDiagnostic],
987984
&Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
988-
Option<&[SubDiagnostic]>,
985+
Vec<(&DiagnosticArgName, &DiagnosticArgValue)>,
986+
&Option<IsLint>,
989987
) {
990988
(
991989
&self.level,
992990
&self.messages,
993-
self.args().collect(),
994991
&self.code,
995-
&self.is_lint,
996992
&self.span,
993+
&self.children,
997994
&self.suggestions,
998-
(if self.is_lint.is_some() { None } else { Some(&self.children) }),
995+
self.args().collect(),
996+
// omit self.sort_span
997+
&self.is_lint,
998+
// omit self.emitted_at
999999
)
10001000
}
10011001
}

compiler/rustc_feature/src/removed.rs

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ declare_features! (
3232
// feature-group-start: removed features
3333
// -------------------------------------------------------------------------
3434

35+
/// Allows using the `amdgpu-kernel` ABI.
36+
(removed, abi_amdgpu_kernel, "CURRENT_RUSTC_VERSION", Some(51575), None),
3537
(removed, advanced_slice_patterns, "1.0.0", Some(62254),
3638
Some("merged into `#![feature(slice_patterns)]`")),
3739
(removed, allocator, "1.0.0", None, None),

compiler/rustc_feature/src/unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ declare_features! (
321321
// feature-group-start: actual feature gates
322322
// -------------------------------------------------------------------------
323323

324-
/// Allows using the `amdgpu-kernel` ABI.
325-
(unstable, abi_amdgpu_kernel, "1.29.0", Some(51575)),
326324
/// Allows `extern "avr-interrupt" fn()` and `extern "avr-non-blocking-interrupt" fn()`.
327325
(unstable, abi_avr_interrupt, "1.45.0", Some(69664)),
328326
/// Allows `extern "C-cmse-nonsecure-call" fn()`.

compiler/rustc_middle/src/ty/layout.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,6 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) ->
12471247
PtxKernel
12481248
| Msp430Interrupt
12491249
| X86Interrupt
1250-
| AmdGpuKernel
12511250
| EfiApi
12521251
| AvrInterrupt
12531252
| AvrNonBlockingInterrupt

compiler/rustc_mir_transform/src/ffi_unwind_calls.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ fn abi_can_unwind(abi: Abi) -> bool {
2626
PtxKernel
2727
| Msp430Interrupt
2828
| X86Interrupt
29-
| AmdGpuKernel
3029
| EfiApi
3130
| AvrInterrupt
3231
| AvrNonBlockingInterrupt

compiler/rustc_passes/src/lang_items.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> {
149149
}
150150
};
151151

152-
self.tcx.dcx().emit_err(DuplicateLangItem {
152+
// When there's a duplicate lang item, something went very wrong and there's no value in recovering or doing anything.
153+
// Give the user the one message to let them debug the mess they created and then wish them farewell.
154+
self.tcx.dcx().emit_fatal(DuplicateLangItem {
153155
local_span: item_span,
154156
lang_item_name,
155157
crate_name,

compiler/rustc_pattern_analysis/src/constructor.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ use self::MaybeInfiniteInt::*;
163163
use self::SliceKind::*;
164164

165165
use crate::index;
166-
use crate::usefulness::PlaceCtxt;
167166
use crate::TypeCx;
168167

169168
/// Whether we have seen a constructor in the column or not.
@@ -818,21 +817,20 @@ impl<Cx: TypeCx> Constructor<Cx> {
818817

819818
/// The number of fields for this constructor. This must be kept in sync with
820819
/// `Fields::wildcards`.
821-
pub(crate) fn arity(&self, pcx: &PlaceCtxt<'_, Cx>) -> usize {
822-
pcx.ctor_arity(self)
820+
pub(crate) fn arity(&self, cx: &Cx, ty: &Cx::Ty) -> usize {
821+
cx.ctor_arity(self, ty)
823822
}
824823

825824
/// Returns whether `self` is covered by `other`, i.e. whether `self` is a subset of `other`.
826825
/// For the simple cases, this is simply checking for equality. For the "grouped" constructors,
827826
/// this checks for inclusion.
828827
// We inline because this has a single call site in `Matrix::specialize_constructor`.
829828
#[inline]
830-
pub(crate) fn is_covered_by(&self, pcx: &PlaceCtxt<'_, Cx>, other: &Self) -> bool {
829+
pub(crate) fn is_covered_by(&self, cx: &Cx, other: &Self) -> bool {
831830
match (self, other) {
832-
(Wildcard, _) => pcx
833-
.mcx
834-
.tycx
835-
.bug(format_args!("Constructor splitting should not have returned `Wildcard`")),
831+
(Wildcard, _) => {
832+
cx.bug(format_args!("Constructor splitting should not have returned `Wildcard`"))
833+
}
836834
// Wildcards cover anything
837835
(_, Wildcard) => true,
838836
// Only a wildcard pattern can match these special constructors.
@@ -873,7 +871,7 @@ impl<Cx: TypeCx> Constructor<Cx> {
873871
(Opaque(self_id), Opaque(other_id)) => self_id == other_id,
874872
(Opaque(..), _) | (_, Opaque(..)) => false,
875873

876-
_ => pcx.mcx.tycx.bug(format_args!(
874+
_ => cx.bug(format_args!(
877875
"trying to compare incompatible constructors {self:?} and {other:?}"
878876
)),
879877
}
@@ -950,10 +948,10 @@ pub enum ConstructorSet<Cx: TypeCx> {
950948
/// of the `ConstructorSet` for the type, yet if we forgot to include them in `present` we would be
951949
/// ignoring any row with `Opaque`s in the algorithm. Hence the importance of point 4.
952950
#[derive(Debug)]
953-
pub(crate) struct SplitConstructorSet<Cx: TypeCx> {
954-
pub(crate) present: SmallVec<[Constructor<Cx>; 1]>,
955-
pub(crate) missing: Vec<Constructor<Cx>>,
956-
pub(crate) missing_empty: Vec<Constructor<Cx>>,
951+
pub struct SplitConstructorSet<Cx: TypeCx> {
952+
pub present: SmallVec<[Constructor<Cx>; 1]>,
953+
pub missing: Vec<Constructor<Cx>>,
954+
pub missing_empty: Vec<Constructor<Cx>>,
957955
}
958956

959957
impl<Cx: TypeCx> ConstructorSet<Cx> {
@@ -962,7 +960,7 @@ impl<Cx: TypeCx> ConstructorSet<Cx> {
962960
/// or slices. This can get subtle; see [`SplitConstructorSet`] for details of this operation
963961
/// and its invariants.
964962
#[instrument(level = "debug", skip(self, ctors), ret)]
965-
pub(crate) fn split<'a>(
963+
pub fn split<'a>(
966964
&self,
967965
ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone,
968966
) -> SplitConstructorSet<Cx>

compiler/rustc_pattern_analysis/src/lib.rs

+5-19
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub mod errors;
66
#[cfg(feature = "rustc")]
77
pub(crate) mod lints;
88
pub mod pat;
9+
pub mod pat_column;
910
#[cfg(feature = "rustc")]
1011
pub mod rustc;
1112
pub mod usefulness;
@@ -67,8 +68,9 @@ use rustc_span::ErrorGuaranteed;
6768

6869
use crate::constructor::{Constructor, ConstructorSet, IntRange};
6970
#[cfg(feature = "rustc")]
70-
use crate::lints::{lint_nonexhaustive_missing_variants, PatternColumn};
71+
use crate::lints::lint_nonexhaustive_missing_variants;
7172
use crate::pat::DeconstructedPat;
73+
use crate::pat_column::PatternColumn;
7274
#[cfg(feature = "rustc")]
7375
use crate::rustc::RustcMatchCheckCtxt;
7476
#[cfg(feature = "rustc")]
@@ -135,20 +137,6 @@ pub trait TypeCx: Sized + fmt::Debug {
135137
}
136138
}
137139

138-
/// Context that provides information global to a match.
139-
pub struct MatchCtxt<'a, Cx: TypeCx> {
140-
/// The context for type information.
141-
pub tycx: &'a Cx,
142-
}
143-
144-
impl<'a, Cx: TypeCx> Clone for MatchCtxt<'a, Cx> {
145-
fn clone(&self) -> Self {
146-
Self { tycx: self.tycx }
147-
}
148-
}
149-
150-
impl<'a, Cx: TypeCx> Copy for MatchCtxt<'a, Cx> {}
151-
152140
/// The arm of a match expression.
153141
#[derive(Debug)]
154142
pub struct MatchArm<'p, Cx: TypeCx> {
@@ -175,15 +163,13 @@ pub fn analyze_match<'p, 'tcx>(
175163
) -> Result<rustc::UsefulnessReport<'p, 'tcx>, ErrorGuaranteed> {
176164
let scrut_ty = tycx.reveal_opaque_ty(scrut_ty);
177165
let scrut_validity = ValidityConstraint::from_bool(tycx.known_valid_scrutinee);
178-
let cx = MatchCtxt { tycx };
179-
180-
let report = compute_match_usefulness(cx, arms, scrut_ty, scrut_validity)?;
166+
let report = compute_match_usefulness(tycx, arms, scrut_ty, scrut_validity)?;
181167

182168
// Run the non_exhaustive_omitted_patterns lint. Only run on refutable patterns to avoid hitting
183169
// `if let`s. Only run if the match is exhaustive otherwise the error is redundant.
184170
if tycx.refutable && report.non_exhaustiveness_witnesses.is_empty() {
185171
let pat_column = PatternColumn::new(arms);
186-
lint_nonexhaustive_missing_variants(cx, arms, &pat_column, scrut_ty)?;
172+
lint_nonexhaustive_missing_variants(tycx, arms, &pat_column, scrut_ty)?;
187173
}
188174

189175
Ok(report)

0 commit comments

Comments
 (0)