Skip to content

Commit 4873466

Browse files
authored
Merge pull request rust-lang#4194 from rust-lang/rustup-2025-02-15
Automatic Rustup
2 parents 17f218d + 03076f1 commit 4873466

File tree

567 files changed

+5834
-3695
lines changed

Some content is hidden

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

567 files changed

+5834
-3695
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ no_llvm_build
5454
/library/target
5555
/src/bootstrap/target
5656
/src/tools/x/target
57+
# Created by `x vendor`
58+
/vendor
5759
# Created by default with `src/ci/docker/run.sh`
5860
/obj/
5961
# Created by nix dev shell / .envrc

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ impl ExternAbi {
195195
// * C and Cdecl obviously support varargs.
196196
// * C can be based on Aapcs, SysV64 or Win64, so they must support varargs.
197197
// * EfiApi is based on Win64 or C, so it also supports it.
198-
// * System falls back to C for functions with varargs.
199198
//
200199
// * Stdcall does not, because it would be impossible for the callee to clean
201200
// up the arguments. (callee doesn't know how many arguments are there)
@@ -204,7 +203,6 @@ impl ExternAbi {
204203
match self {
205204
Self::C { .. }
206205
| Self::Cdecl { .. }
207-
| Self::System { .. }
208206
| Self::Aapcs { .. }
209207
| Self::Win64 { .. }
210208
| Self::SysV64 { .. }

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ pub(crate) enum RegionErrorKind<'tcx> {
147147
pub(crate) struct ErrorConstraintInfo<'tcx> {
148148
// fr: outlived_fr
149149
pub(super) fr: RegionVid,
150-
pub(super) fr_is_local: bool,
151150
pub(super) outlived_fr: RegionVid,
152-
pub(super) outlived_fr_is_local: bool,
153151

154152
// Category and span for best blame constraint
155153
pub(super) category: ConstraintCategory<'tcx>,
@@ -316,13 +314,16 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
316314
let type_test_span = type_test.span;
317315

318316
if let Some(lower_bound_region) = lower_bound_region {
319-
let generic_ty = type_test.generic_kind.to_ty(self.infcx.tcx);
317+
let generic_ty = self.regioncx.name_regions(
318+
self.infcx.tcx,
319+
type_test.generic_kind.to_ty(self.infcx.tcx),
320+
);
320321
let origin = RelateParamBound(type_test_span, generic_ty, None);
321322
self.buffer_error(self.infcx.err_ctxt().construct_generic_bound_failure(
322323
self.body.source.def_id().expect_local(),
323324
type_test_span,
324325
Some(origin),
325-
type_test.generic_kind,
326+
self.regioncx.name_regions(self.infcx.tcx, type_test.generic_kind),
326327
lower_bound_region,
327328
));
328329
} else {
@@ -468,14 +469,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
468469
fr_is_local, outlived_fr_is_local, category
469470
);
470471

471-
let errci = ErrorConstraintInfo {
472-
fr,
473-
outlived_fr,
474-
fr_is_local,
475-
outlived_fr_is_local,
476-
category,
477-
span: cause.span,
478-
};
472+
let errci = ErrorConstraintInfo { fr, outlived_fr, category, span: cause.span };
479473

480474
let mut diag = match (category, fr_is_local, outlived_fr_is_local) {
481475
(ConstraintCategory::Return(kind), true, false) if self.is_closure_fn_mut(fr) => {
@@ -677,11 +671,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
677671
&& self.regioncx.universal_regions().defining_ty.is_fn_def())
678672
|| self.regioncx.universal_regions().defining_ty.is_const()
679673
{
680-
return self.report_general_error(&ErrorConstraintInfo {
681-
fr_is_local: true,
682-
outlived_fr_is_local: false,
683-
..*errci
684-
});
674+
return self.report_general_error(errci);
685675
}
686676

687677
let mut diag =
@@ -759,15 +749,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
759749
/// ```
760750
#[allow(rustc::diagnostic_outside_of_impl)] // FIXME
761751
fn report_general_error(&self, errci: &ErrorConstraintInfo<'tcx>) -> Diag<'infcx> {
762-
let ErrorConstraintInfo {
763-
fr,
764-
fr_is_local,
765-
outlived_fr,
766-
outlived_fr_is_local,
767-
span,
768-
category,
769-
..
770-
} = errci;
752+
let ErrorConstraintInfo { fr, outlived_fr, span, category, .. } = errci;
771753

772754
let mir_def_name = self.infcx.tcx.def_descr(self.mir_def_id().to_def_id());
773755

@@ -786,19 +768,22 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
786768
let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap();
787769
outlived_fr_name.highlight_region_name(&mut diag);
788770

789-
let err_category = match (category, outlived_fr_is_local, fr_is_local) {
790-
(ConstraintCategory::Return(_), true, _) => LifetimeReturnCategoryErr::WrongReturn {
771+
let err_category = if matches!(category, ConstraintCategory::Return(_))
772+
&& self.regioncx.universal_regions().is_local_free_region(*outlived_fr)
773+
{
774+
LifetimeReturnCategoryErr::WrongReturn {
791775
span: *span,
792776
mir_def_name,
793777
outlived_fr_name,
794778
fr_name: &fr_name,
795-
},
796-
_ => LifetimeReturnCategoryErr::ShortReturn {
779+
}
780+
} else {
781+
LifetimeReturnCategoryErr::ShortReturn {
797782
span: *span,
798783
category_desc: category.description(),
799784
free_region_name: &fr_name,
800785
outlived_fr_name,
801-
},
786+
}
802787
};
803788

804789
diag.subdiagnostic(err_category);

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call
6565
sess.dcx().fatal("C-cmse-nonsecure-entry call conv is not yet implemented");
6666
}
6767

68-
Conv::Msp430Intr
69-
| Conv::PtxKernel
70-
| Conv::GpuKernel
71-
| Conv::AvrInterrupt
72-
| Conv::AvrNonBlockingInterrupt => {
68+
Conv::Msp430Intr | Conv::GpuKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
7369
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
7470
}
7571
}

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fn build_isa(sess: &Session) -> Arc<dyn TargetIsa + 'static> {
289289
flags_builder.set("opt_level", "none").unwrap();
290290
}
291291
OptLevel::Less
292-
| OptLevel::Default
292+
| OptLevel::More
293293
| OptLevel::Size
294294
| OptLevel::SizeMin
295295
| OptLevel::Aggressive => {

compiler/rustc_codegen_gcc/src/back/lto.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,6 @@ pub struct ThinBuffer {
710710
context: Arc<SyncContext>,
711711
}
712712

713-
// TODO: check if this makes sense to make ThinBuffer Send and Sync.
714-
unsafe impl Send for ThinBuffer {}
715-
unsafe impl Sync for ThinBuffer {}
716-
717713
impl ThinBuffer {
718714
pub(crate) fn new(context: &Arc<SyncContext>) -> Self {
719715
Self { context: Arc::clone(context) }

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
665665
a + b
666666
}
667667

668+
// TODO(antoyo): should we also override the `unchecked_` versions?
668669
fn sub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
669670
self.gcc_sub(a, b)
670671
}
@@ -832,31 +833,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
832833
set_rvalue_location(self, self.gcc_not(a))
833834
}
834835

835-
fn unchecked_sadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
836-
set_rvalue_location(self, self.gcc_add(a, b))
837-
}
838-
839-
fn unchecked_uadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
840-
set_rvalue_location(self, self.gcc_add(a, b))
841-
}
842-
843-
fn unchecked_ssub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
844-
set_rvalue_location(self, self.gcc_sub(a, b))
845-
}
846-
847-
fn unchecked_usub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
848-
// TODO(antoyo): should generate poison value?
849-
set_rvalue_location(self, self.gcc_sub(a, b))
850-
}
851-
852-
fn unchecked_smul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
853-
set_rvalue_location(self, self.gcc_mul(a, b))
854-
}
855-
856-
fn unchecked_umul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
857-
set_rvalue_location(self, self.gcc_mul(a, b))
858-
}
859-
860836
fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
861837
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
862838
set_rvalue_location(self, lhs + rhs)

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
476476
Some(level) => match level {
477477
OptLevel::No => OptimizationLevel::None,
478478
OptLevel::Less => OptimizationLevel::Limited,
479-
OptLevel::Default => OptimizationLevel::Standard,
479+
OptLevel::More => OptimizationLevel::Standard,
480480
OptLevel::Aggressive => OptimizationLevel::Aggressive,
481481
OptLevel::Size | OptLevel::SizeMin => OptimizationLevel::Limited,
482482
},

compiler/rustc_codegen_llvm/messages.ftl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ codegen_llvm_lto_proc_macro = lto cannot be used for `proc-macro` crate type wit
3838
codegen_llvm_mismatch_data_layout =
3939
data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`
4040
41-
codegen_llvm_multiple_source_dicompileunit = multiple source DICompileUnits found
42-
codegen_llvm_multiple_source_dicompileunit_with_llvm_err = multiple source DICompileUnits found: {$llvm_err}
43-
4441
codegen_llvm_parse_bitcode = failed to parse bitcode for LTO module
4542
codegen_llvm_parse_bitcode_with_llvm_err = failed to parse bitcode for LTO module: {$llvm_err}
4643

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ impl llvm::CallConv {
687687
Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt,
688688
Conv::ArmAapcs => llvm::ArmAapcsCallConv,
689689
Conv::Msp430Intr => llvm::Msp430Intr,
690-
Conv::PtxKernel => llvm::PtxKernel,
691690
Conv::X86Fastcall => llvm::X86FastcallCallConv,
692691
Conv::X86Intr => llvm::X86_Intr,
693692
Conv::X86Stdcall => llvm::X86StdcallCallConv,

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
286286
InlineAsmArch::M68k => {
287287
constraints.push("~{ccr}".to_string());
288288
}
289-
InlineAsmArch::CSKY => {}
289+
InlineAsmArch::CSKY => {
290+
constraints.push("~{psr}".to_string());
291+
}
290292
}
291293
}
292294
if !options.contains(InlineAsmOptions::NOMEM) {

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn to_llvm_opt_settings(cfg: config::OptLevel) -> (llvm::CodeGenOptLevel, llvm::
141141
match cfg {
142142
No => (llvm::CodeGenOptLevel::None, llvm::CodeGenOptSizeNone),
143143
Less => (llvm::CodeGenOptLevel::Less, llvm::CodeGenOptSizeNone),
144-
Default => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone),
144+
More => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone),
145145
Aggressive => (llvm::CodeGenOptLevel::Aggressive, llvm::CodeGenOptSizeNone),
146146
Size => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeDefault),
147147
SizeMin => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeAggressive),
@@ -153,7 +153,7 @@ fn to_pass_builder_opt_level(cfg: config::OptLevel) -> llvm::PassBuilderOptLevel
153153
match cfg {
154154
No => llvm::PassBuilderOptLevel::O0,
155155
Less => llvm::PassBuilderOptLevel::O1,
156-
Default => llvm::PassBuilderOptLevel::O2,
156+
More => llvm::PassBuilderOptLevel::O2,
157157
Aggressive => llvm::PassBuilderOptLevel::O3,
158158
Size => llvm::PassBuilderOptLevel::Os,
159159
SizeMin => llvm::PassBuilderOptLevel::Oz,

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,37 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
465465
unchecked_umul(x, y) => LLVMBuildNUWMul,
466466
}
467467

468+
fn unchecked_suadd(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value {
469+
unsafe {
470+
let add = llvm::LLVMBuildAdd(self.llbuilder, a, b, UNNAMED);
471+
if llvm::LLVMIsAInstruction(add).is_some() {
472+
llvm::LLVMSetNUW(add, True);
473+
llvm::LLVMSetNSW(add, True);
474+
}
475+
add
476+
}
477+
}
478+
fn unchecked_susub(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value {
479+
unsafe {
480+
let sub = llvm::LLVMBuildSub(self.llbuilder, a, b, UNNAMED);
481+
if llvm::LLVMIsAInstruction(sub).is_some() {
482+
llvm::LLVMSetNUW(sub, True);
483+
llvm::LLVMSetNSW(sub, True);
484+
}
485+
sub
486+
}
487+
}
488+
fn unchecked_sumul(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value {
489+
unsafe {
490+
let mul = llvm::LLVMBuildMul(self.llbuilder, a, b, UNNAMED);
491+
if llvm::LLVMIsAInstruction(mul).is_some() {
492+
llvm::LLVMSetNUW(mul, True);
493+
llvm::LLVMSetNSW(mul, True);
494+
}
495+
mul
496+
}
497+
}
498+
468499
fn or_disjoint(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value {
469500
unsafe {
470501
let or = llvm::LLVMBuildOr(self.llbuilder, a, b, UNNAMED);
@@ -587,7 +618,8 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
587618
unsafe {
588619
let alloca = llvm::LLVMBuildAlloca(bx.llbuilder, ty, UNNAMED);
589620
llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint);
590-
alloca
621+
// Cast to default addrspace if necessary
622+
llvm::LLVMBuildPointerCast(bx.llbuilder, alloca, self.cx().type_ptr(), UNNAMED)
591623
}
592624
}
593625

@@ -596,7 +628,8 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
596628
let alloca =
597629
llvm::LLVMBuildArrayAlloca(self.llbuilder, self.cx().type_i8(), size, UNNAMED);
598630
llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint);
599-
alloca
631+
// Cast to default addrspace if necessary
632+
llvm::LLVMBuildPointerCast(self.llbuilder, alloca, self.cx().type_ptr(), UNNAMED)
600633
}
601634
}
602635

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>(
437437
.source_info
438438
.unwrap_or_else(|| (unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER));
439439

440+
let discr = discr_value.opt_single_val().map(|value| {
441+
let tag_base_type = tag_base_type(cx.tcx, enum_type_and_layout);
442+
let size = cx.size_of(tag_base_type);
443+
cx.const_uint_big(cx.type_ix(size.bits()), value)
444+
});
445+
440446
unsafe {
441447
llvm::LLVMRustDIBuilderCreateVariantMemberType(
442448
DIB(cx),
@@ -448,7 +454,7 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>(
448454
enum_type_and_layout.size.bits(),
449455
enum_type_and_layout.align.abi.bits() as u32,
450456
Size::ZERO.bits(),
451-
discr_value.opt_single_val().map(|value| cx.const_u128(value)),
457+
discr,
452458
DIFlags::FlagZero,
453459
variant_member_info.variant_struct_type_di_node,
454460
)

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ pub enum LlvmError<'a> {
131131
LoadBitcode { name: CString },
132132
#[diag(codegen_llvm_write_thinlto_key)]
133133
WriteThinLtoKey { err: std::io::Error },
134-
#[diag(codegen_llvm_multiple_source_dicompileunit)]
135-
MultipleSourceDiCompileUnit,
136134
#[diag(codegen_llvm_prepare_thin_lto_module)]
137135
PrepareThinLtoModule,
138136
#[diag(codegen_llvm_parse_bitcode)]
@@ -155,9 +153,6 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
155153
PrepareThinLtoContext => fluent::codegen_llvm_prepare_thin_lto_context_with_llvm_err,
156154
LoadBitcode { .. } => fluent::codegen_llvm_load_bitcode_with_llvm_err,
157155
WriteThinLtoKey { .. } => fluent::codegen_llvm_write_thinlto_key_with_llvm_err,
158-
MultipleSourceDiCompileUnit => {
159-
fluent::codegen_llvm_multiple_source_dicompileunit_with_llvm_err
160-
}
161156
PrepareThinLtoModule => fluent::codegen_llvm_prepare_thin_lto_module_with_llvm_err,
162157
ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
163158
PrepareAutoDiff { .. } => fluent::codegen_llvm_prepare_autodiff_with_llvm_err,

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ impl WriteBackendMethods for LlvmCodegenBackend {
245245
}
246246
}
247247

248-
unsafe impl Send for LlvmCodegenBackend {} // Llvm is on a per-thread basis
249-
unsafe impl Sync for LlvmCodegenBackend {}
250-
251248
impl LlvmCodegenBackend {
252249
pub fn new() -> Box<dyn CodegenBackend> {
253250
Box::new(LlvmCodegenBackend(()))

compiler/rustc_codegen_llvm/src/llvm/archive_ro.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl ArchiveRO {
2626
///
2727
/// If this archive is used with a mutable method, then an error will be
2828
/// raised.
29-
pub fn open(dst: &Path) -> Result<ArchiveRO, String> {
29+
pub(crate) fn open(dst: &Path) -> Result<ArchiveRO, String> {
3030
unsafe {
3131
let s = path_to_c_string(dst);
3232
let ar = super::LLVMRustOpenArchive(s.as_ptr()).ok_or_else(|| {
@@ -36,7 +36,7 @@ impl ArchiveRO {
3636
}
3737
}
3838

39-
pub fn iter(&self) -> Iter<'_> {
39+
pub(crate) fn iter(&self) -> Iter<'_> {
4040
unsafe { Iter { raw: super::LLVMRustArchiveIteratorNew(self.raw) } }
4141
}
4242
}
@@ -71,7 +71,7 @@ impl<'a> Drop for Iter<'a> {
7171
}
7272

7373
impl<'a> Child<'a> {
74-
pub fn name(&self) -> Option<&'a str> {
74+
pub(crate) fn name(&self) -> Option<&'a str> {
7575
unsafe {
7676
let mut name_len = 0;
7777
let name_ptr = super::LLVMRustArchiveChildName(self.raw, &mut name_len);

0 commit comments

Comments
 (0)