Skip to content

Commit b82463f

Browse files
authored
Merge pull request #4169 from rust-lang/rustup-2025-02-01
Automatic Rustup
2 parents 829bfc3 + c925c82 commit b82463f

File tree

383 files changed

+3638
-2214
lines changed

Some content is hidden

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

383 files changed

+3638
-2214
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4234,6 +4234,7 @@ name = "rustc_monomorphize"
42344234
version = "0.0.0"
42354235
dependencies = [
42364236
"rustc_abi",
4237+
"rustc_ast",
42374238
"rustc_attr_parsing",
42384239
"rustc_data_structures",
42394240
"rustc_errors",
@@ -4243,6 +4244,7 @@ dependencies = [
42434244
"rustc_middle",
42444245
"rustc_session",
42454246
"rustc_span",
4247+
"rustc_symbol_mangling",
42464248
"rustc_target",
42474249
"serde",
42484250
"serde_json",

compiler/rustc_ast/src/expand/autodiff_attrs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub struct AutoDiffItem {
7979
pub target: String,
8080
pub attrs: AutoDiffAttrs,
8181
}
82+
8283
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
8384
pub struct AutoDiffAttrs {
8485
/// Conceptually either forward or reverse mode AD, as described in various autodiff papers and
@@ -231,7 +232,7 @@ impl AutoDiffAttrs {
231232
self.ret_activity == DiffActivity::ActiveOnly
232233
}
233234

234-
pub fn error() -> Self {
235+
pub const fn error() -> Self {
235236
AutoDiffAttrs {
236237
mode: DiffMode::Error,
237238
ret_activity: DiffActivity::None,

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3777,7 +3777,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
37773777
let tcx = self.infcx.tcx;
37783778
if let Some(Terminator { kind: TerminatorKind::Call { call_source, fn_span, .. }, .. }) =
37793779
&self.body[loan.reserve_location.block].terminator
3780-
&& let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
3780+
&& let Some((method_did, method_args)) = mir::find_self_call(
37813781
tcx,
37823782
self.body,
37833783
loan.assigned_place.local,

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::mir::tcx::PlaceTy;
1717
use rustc_middle::mir::{
1818
AggregateKind, CallSource, ConstOperand, ConstraintCategory, FakeReadCause, Local, LocalInfo,
1919
LocalKind, Location, Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement,
20-
StatementKind, Terminator, TerminatorKind,
20+
StatementKind, Terminator, TerminatorKind, find_self_call,
2121
};
2222
use rustc_middle::ty::print::Print;
2323
use rustc_middle::ty::{self, Ty, TyCtxt};
@@ -1016,12 +1016,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10161016
kind: TerminatorKind::Call { fn_span, call_source, .. }, ..
10171017
}) = &self.body[location.block].terminator
10181018
{
1019-
let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
1020-
self.infcx.tcx,
1021-
self.body,
1022-
target_temp,
1023-
location.block,
1024-
) else {
1019+
let Some((method_did, method_args)) =
1020+
find_self_call(self.infcx.tcx, self.body, target_temp, location.block)
1021+
else {
10251022
return normal_ret;
10261023
};
10271024

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,16 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
417417
Some(source_info.span),
418418
);
419419
}
420+
AssertKind::NullPointerDereference => {
421+
let location = fx.get_caller_location(source_info).load_scalar(fx);
422+
423+
codegen_panic_inner(
424+
fx,
425+
rustc_hir::LangItem::PanicNullPointerDereference,
426+
&[location],
427+
Some(source_info.span),
428+
)
429+
}
420430
_ => {
421431
let location = fx.get_caller_location(source_info).load_scalar(fx);
422432

compiler/rustc_codegen_cranelift/src/constant.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cranelift_module::*;
66
use rustc_data_structures::fx::FxHashSet;
77
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
88
use rustc_middle::mir::interpret::{AllocId, GlobalAlloc, Scalar, read_target_uint};
9-
use rustc_middle::ty::{Binder, ExistentialTraitRef, ScalarInt};
9+
use rustc_middle::ty::{ExistentialTraitRef, ScalarInt};
1010

1111
use crate::prelude::*;
1212

@@ -167,7 +167,9 @@ pub(crate) fn codegen_const_value<'tcx>(
167167
&mut fx.constants_cx,
168168
fx.module,
169169
ty,
170-
dyn_ty.principal(),
170+
dyn_ty.principal().map(|principal| {
171+
fx.tcx.instantiate_bound_regions_with_erased(principal)
172+
}),
171173
);
172174
let local_data_id =
173175
fx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
@@ -243,7 +245,7 @@ pub(crate) fn data_id_for_vtable<'tcx>(
243245
cx: &mut ConstantCx,
244246
module: &mut dyn Module,
245247
ty: Ty<'tcx>,
246-
trait_ref: Option<Binder<'tcx, ExistentialTraitRef<'tcx>>>,
248+
trait_ref: Option<ExistentialTraitRef<'tcx>>,
247249
) -> DataId {
248250
let alloc_id = tcx.vtable_allocation((ty, trait_ref));
249251
data_id_for_alloc_id(cx, module, alloc_id, Mutability::Not)
@@ -460,9 +462,15 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
460462
GlobalAlloc::Memory(target_alloc) => {
461463
data_id_for_alloc_id(cx, module, alloc_id, target_alloc.inner().mutability)
462464
}
463-
GlobalAlloc::VTable(ty, dyn_ty) => {
464-
data_id_for_vtable(tcx, cx, module, ty, dyn_ty.principal())
465-
}
465+
GlobalAlloc::VTable(ty, dyn_ty) => data_id_for_vtable(
466+
tcx,
467+
cx,
468+
module,
469+
ty,
470+
dyn_ty
471+
.principal()
472+
.map(|principal| tcx.instantiate_bound_regions_with_erased(principal)),
473+
),
466474
GlobalAlloc::Static(def_id) => {
467475
if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::THREAD_LOCAL)
468476
{

compiler/rustc_codegen_cranelift/src/unsize.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ pub(crate) fn unsized_info<'tcx>(
6161
old_info
6262
}
6363
}
64-
(_, ty::Dynamic(data, ..)) => crate::vtable::get_vtable(fx, source, data.principal()),
64+
(_, ty::Dynamic(data, ..)) => crate::vtable::get_vtable(
65+
fx,
66+
source,
67+
data.principal()
68+
.map(|principal| fx.tcx.instantiate_bound_regions_with_erased(principal)),
69+
),
6570
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
6671
}
6772
}

compiler/rustc_codegen_cranelift/src/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
9090
pub(crate) fn get_vtable<'tcx>(
9191
fx: &mut FunctionCx<'_, '_, 'tcx>,
9292
ty: Ty<'tcx>,
93-
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
93+
trait_ref: Option<ty::ExistentialTraitRef<'tcx>>,
9494
) -> Value {
9595
let data_id = data_id_for_vtable(fx.tcx, &mut fx.constants_cx, fx.module, ty, trait_ref);
9696
let local_data_id = fx.module.declare_data_in_func(data_id, fx.bcx.func);

compiler/rustc_codegen_gcc/src/common.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,12 @@ impl<'gcc, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
234234
GlobalAlloc::VTable(ty, dyn_ty) => {
235235
let alloc = self
236236
.tcx
237-
.global_alloc(self.tcx.vtable_allocation((ty, dyn_ty.principal())))
237+
.global_alloc(self.tcx.vtable_allocation((
238+
ty,
239+
dyn_ty.principal().map(|principal| {
240+
self.tcx.instantiate_bound_regions_with_erased(principal)
241+
}),
242+
)))
238243
.unwrap_memory();
239244
let init = const_alloc_to_gcc(self, alloc);
240245
self.static_addr_of(init, alloc.inner().align, None)

compiler/rustc_codegen_gcc/src/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_middle::ty::layout::{
1414
FnAbiError, FnAbiOf, FnAbiOfHelpers, FnAbiRequest, HasTyCtxt, HasTypingEnv, LayoutError,
1515
LayoutOfHelpers,
1616
};
17-
use rustc_middle::ty::{self, Instance, PolyExistentialTraitRef, Ty, TyCtxt};
17+
use rustc_middle::ty::{self, ExistentialTraitRef, Instance, Ty, TyCtxt};
1818
use rustc_session::Session;
1919
use rustc_span::source_map::respan;
2020
use rustc_span::{DUMMY_SP, Span};
@@ -90,7 +90,7 @@ pub struct CodegenCx<'gcc, 'tcx> {
9090
pub function_instances: RefCell<FxHashMap<Instance<'tcx>, Function<'gcc>>>,
9191
/// Cache generated vtables
9292
pub vtables:
93-
RefCell<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), RValue<'gcc>>>,
93+
RefCell<FxHashMap<(Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>), RValue<'gcc>>>,
9494

9595
// TODO(antoyo): improve the SSA API to not require those.
9696
/// Mapping from function pointer type to indexes of on stack parameters.
@@ -401,7 +401,7 @@ impl<'gcc, 'tcx> BackendTypes for CodegenCx<'gcc, 'tcx> {
401401
impl<'gcc, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
402402
fn vtables(
403403
&self,
404-
) -> &RefCell<FxHashMap<(Ty<'tcx>, Option<PolyExistentialTraitRef<'tcx>>), RValue<'gcc>>> {
404+
) -> &RefCell<FxHashMap<(Ty<'tcx>, Option<ExistentialTraitRef<'tcx>>), RValue<'gcc>>> {
405405
&self.vtables
406406
}
407407

0 commit comments

Comments
 (0)