Skip to content

Commit 04ab7b2

Browse files
committed
Auto merge of #126605 - matthiaskrgr:rollup-plsaytq, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #126255 (fix checking git submodules during a commit hook) - #126355 (Pass target to some run-make tests) - #126567 (Rename `InstanceDef` -> `InstanceKind`) - #126579 (Fix broken documentation link) - #126596 (Add tracking issue number to async_drop APIs) - #126603 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1138036 + d5f9117 commit 04ab7b2

File tree

64 files changed

+472
-461
lines changed

Some content is hidden

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

64 files changed

+472
-461
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::intravisit::Visitor;
88
use rustc_hir::{self as hir, BindingMode, ByRef, Node};
99
use rustc_middle::bug;
1010
use rustc_middle::mir::{Mutability, Place, PlaceRef, ProjectionElem};
11-
use rustc_middle::ty::{self, InstanceDef, Ty, TyCtxt, Upcast};
11+
use rustc_middle::ty::{self, InstanceKind, Ty, TyCtxt, Upcast};
1212
use rustc_middle::{
1313
hir::place::PlaceBase,
1414
mir::{self, BindingForm, Local, LocalDecl, LocalInfo, LocalKind, Location},
@@ -1045,7 +1045,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10451045
fn suggest_using_iter_mut(&self, err: &mut Diag<'_>) {
10461046
let source = self.body.source;
10471047
let hir = self.infcx.tcx.hir();
1048-
if let InstanceDef::Item(def_id) = source.instance
1048+
if let InstanceKind::Item(def_id) = source.instance
10491049
&& let Some(Node::Expr(hir::Expr { hir_id, kind, .. })) = hir.get_if_local(def_id)
10501050
&& let ExprKind::Closure(hir::Closure { kind: hir::ClosureKind::Closure, .. }) = kind
10511051
&& let Node::Expr(expr) = self.infcx.tcx.parent_hir_node(*hir_id)

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
399399
}
400400

401401
match instance.def {
402-
InstanceDef::Intrinsic(_) => {
402+
InstanceKind::Intrinsic(_) => {
403403
match crate::intrinsics::codegen_intrinsic_call(
404404
fx,
405405
instance,
@@ -412,7 +412,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
412412
Err(instance) => Some(instance),
413413
}
414414
}
415-
InstanceDef::DropGlue(_, None) | ty::InstanceDef::AsyncDropGlueCtorShim(_, None) => {
415+
InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) => {
416416
// empty drop glue - a nop.
417417
let dest = target.expect("Non terminating drop_in_place_real???");
418418
let ret_block = fx.get_block(dest);
@@ -494,7 +494,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
494494

495495
let (func_ref, first_arg_override) = match instance {
496496
// Trait object call
497-
Some(Instance { def: InstanceDef::Virtual(_, idx), .. }) => {
497+
Some(Instance { def: InstanceKind::Virtual(_, idx), .. }) => {
498498
if fx.clif_comments.enabled() {
499499
let nop_inst = fx.bcx.ins().nop();
500500
fx.add_comment(
@@ -598,7 +598,7 @@ pub(crate) fn codegen_drop<'tcx>(
598598
let ty = drop_place.layout().ty;
599599
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty).polymorphize(fx.tcx);
600600

601-
if let ty::InstanceDef::DropGlue(_, None) | ty::InstanceDef::AsyncDropGlueCtorShim(_, None) =
601+
if let ty::InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) =
602602
drop_instance.def
603603
{
604604
// we don't actually need to drop anything
@@ -630,7 +630,7 @@ pub(crate) fn codegen_drop<'tcx>(
630630
// FIXME(eddyb) perhaps move some of this logic into
631631
// `Instance::resolve_drop_in_place`?
632632
let virtual_drop = Instance {
633-
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
633+
def: ty::InstanceKind::Virtual(drop_instance.def_id(), 0),
634634
args: drop_instance.args,
635635
};
636636
let fn_abi =
@@ -673,7 +673,7 @@ pub(crate) fn codegen_drop<'tcx>(
673673
fx.bcx.switch_to_block(continued);
674674

675675
let virtual_drop = Instance {
676-
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
676+
def: ty::InstanceKind::Virtual(drop_instance.def_id(), 0),
677677
args: drop_instance.args,
678678
};
679679
let fn_abi =
@@ -684,7 +684,7 @@ pub(crate) fn codegen_drop<'tcx>(
684684
fx.bcx.ins().call_indirect(sig, drop_fn, &[data]);
685685
}
686686
_ => {
687-
assert!(!matches!(drop_instance.def, InstanceDef::Virtual(_, _)));
687+
assert!(!matches!(drop_instance.def, InstanceKind::Virtual(_, _)));
688688

689689
let fn_abi =
690690
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(drop_instance, ty::List::empty());

compiler/rustc_codegen_cranelift/src/constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub(crate) fn codegen_tls_ref<'tcx>(
5050
) -> CValue<'tcx> {
5151
let tls_ptr = if !def_id.is_local() && fx.tcx.needs_thread_local_shim(def_id) {
5252
let instance = ty::Instance {
53-
def: ty::InstanceDef::ThreadLocalShim(def_id),
53+
def: ty::InstanceKind::ThreadLocalShim(def_id),
5454
args: ty::GenericArgs::empty(),
5555
};
5656
let func_ref = fx.get_function_ref(instance);

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
12611261
}
12621262

12631263
// Unimplemented intrinsics must have a fallback body. The fallback body is obtained
1264-
// by converting the `InstanceDef::Intrinsic` to an `InstanceDef::Item`.
1264+
// by converting the `InstanceKind::Intrinsic` to an `InstanceKind::Item`.
12651265
_ => {
12661266
let intrinsic = fx.tcx.intrinsic(instance.def_id()).unwrap();
12671267
if intrinsic.must_be_overridden {

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mod prelude {
9898
pub(crate) use rustc_middle::mir::{self, *};
9999
pub(crate) use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
100100
pub(crate) use rustc_middle::ty::{
101-
self, FloatTy, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, UintTy,
101+
self, FloatTy, Instance, InstanceKind, IntTy, ParamEnv, Ty, TyCtxt, UintTy,
102102
};
103103
pub(crate) use rustc_span::Span;
104104
pub(crate) use rustc_target::abi::{Abi, FieldIdx, Scalar, Size, VariantIdx, FIRST_VARIANT};

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ fn exported_symbols_provider_local(
310310

311311
if tcx.sess.opts.share_generics() && tcx.local_crate_exports_generics() {
312312
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
313-
use rustc_middle::ty::InstanceDef;
313+
use rustc_middle::ty::InstanceKind;
314314

315315
// Normally, we require that shared monomorphizations are not hidden,
316316
// because if we want to re-use a monomorphization from a Rust dylib, it
@@ -337,7 +337,7 @@ fn exported_symbols_provider_local(
337337
}
338338

339339
match *mono_item {
340-
MonoItem::Fn(Instance { def: InstanceDef::Item(def), args }) => {
340+
MonoItem::Fn(Instance { def: InstanceKind::Item(def), args }) => {
341341
if args.non_erasable_generics(tcx, def).next().is_some() {
342342
let symbol = ExportedSymbol::Generic(def, args);
343343
symbols.push((
@@ -350,7 +350,7 @@ fn exported_symbols_provider_local(
350350
));
351351
}
352352
}
353-
MonoItem::Fn(Instance { def: InstanceDef::DropGlue(def_id, Some(ty)), args }) => {
353+
MonoItem::Fn(Instance { def: InstanceKind::DropGlue(def_id, Some(ty)), args }) => {
354354
// A little sanity-check
355355
debug_assert_eq!(
356356
args.non_erasable_generics(tcx, def_id).next(),
@@ -366,7 +366,7 @@ fn exported_symbols_provider_local(
366366
));
367367
}
368368
MonoItem::Fn(Instance {
369-
def: InstanceDef::AsyncDropGlueCtorShim(def_id, Some(ty)),
369+
def: InstanceKind::AsyncDropGlueCtorShim(def_id, Some(ty)),
370370
args,
371371
}) => {
372372
// A little sanity-check
@@ -556,7 +556,7 @@ pub fn symbol_name_for_instance_in_crate<'tcx>(
556556
rustc_symbol_mangling::symbol_name_for_instance_in_crate(
557557
tcx,
558558
ty::Instance {
559-
def: ty::InstanceDef::ThreadLocalShim(def_id),
559+
def: ty::InstanceKind::ThreadLocalShim(def_id),
560560
args: ty::GenericArgs::empty(),
561561
},
562562
instantiating_crate,

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
510510
let ty = self.monomorphize(ty);
511511
let drop_fn = Instance::resolve_drop_in_place(bx.tcx(), ty);
512512

513-
if let ty::InstanceDef::DropGlue(_, None) = drop_fn.def {
513+
if let ty::InstanceKind::DropGlue(_, None) = drop_fn.def {
514514
// we don't actually need to drop anything.
515515
return helper.funclet_br(self, bx, target, mergeable_succ);
516516
}
@@ -541,7 +541,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
541541
// \-------/
542542
//
543543
let virtual_drop = Instance {
544-
def: ty::InstanceDef::Virtual(drop_fn.def_id(), 0), // idx 0: the drop function
544+
def: ty::InstanceKind::Virtual(drop_fn.def_id(), 0), // idx 0: the drop function
545545
args: drop_fn.args,
546546
};
547547
debug!("ty = {:?}", ty);
@@ -583,7 +583,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
583583
//
584584
// SO THEN WE CAN USE THE ABOVE CODE.
585585
let virtual_drop = Instance {
586-
def: ty::InstanceDef::Virtual(drop_fn.def_id(), 0), // idx 0: the drop function
586+
def: ty::InstanceKind::Virtual(drop_fn.def_id(), 0), // idx 0: the drop function
587587
args: drop_fn.args,
588588
};
589589
debug!("ty = {:?}", ty);
@@ -855,7 +855,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
855855
let def = instance.map(|i| i.def);
856856

857857
if let Some(
858-
ty::InstanceDef::DropGlue(_, None) | ty::InstanceDef::AsyncDropGlueCtorShim(_, None),
858+
ty::InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None),
859859
) = def
860860
{
861861
// Empty drop glue; a no-op.
@@ -871,7 +871,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
871871

872872
// Handle intrinsics old codegen wants Expr's for, ourselves.
873873
let intrinsic = match def {
874-
Some(ty::InstanceDef::Intrinsic(def_id)) => Some(bx.tcx().intrinsic(def_id).unwrap()),
874+
Some(ty::InstanceKind::Intrinsic(def_id)) => Some(bx.tcx().intrinsic(def_id).unwrap()),
875875
_ => None,
876876
};
877877

@@ -1026,7 +1026,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10261026
'make_args: for (i, arg) in first_args.iter().enumerate() {
10271027
let mut op = self.codegen_operand(bx, &arg.node);
10281028

1029-
if let (0, Some(ty::InstanceDef::Virtual(_, idx))) = (i, def) {
1029+
if let (0, Some(ty::InstanceKind::Virtual(_, idx))) = (i, def) {
10301030
match op.val {
10311031
Pair(data_ptr, meta) => {
10321032
// In the case of Rc<Self>, we need to explicitly pass a

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
704704
let static_ = if !def_id.is_local() && bx.cx().tcx().needs_thread_local_shim(def_id)
705705
{
706706
let instance = ty::Instance {
707-
def: ty::InstanceDef::ThreadLocalShim(def_id),
707+
def: ty::InstanceKind::ThreadLocalShim(def_id),
708708
args: ty::GenericArgs::empty(),
709709
};
710710
let fn_ptr = bx.get_fn_addr(instance);

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceC
1010
use rustc_middle::mir::*;
1111
use rustc_middle::span_bug;
1212
use rustc_middle::ty::{self, adjustment::PointerCoercion, Ty, TyCtxt};
13-
use rustc_middle::ty::{Instance, InstanceDef, TypeVisitableExt};
13+
use rustc_middle::ty::{Instance, InstanceKind, TypeVisitableExt};
1414
use rustc_mir_dataflow::Analysis;
1515
use rustc_span::{sym, Span, Symbol, DUMMY_SP};
1616
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
@@ -769,7 +769,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
769769

770770
if let Ok(Some(instance)) =
771771
Instance::resolve(tcx, param_env, callee, fn_args)
772-
&& let InstanceDef::Item(def) = instance.def
772+
&& let InstanceKind::Item(def) = instance.def
773773
{
774774
// Resolve a trait method call to its concrete implementation, which may be in a
775775
// `const` trait impl. This is only used for the const stability check below, since

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
289289

290290
// We call `const_eval` for zero arg intrinsics, too, in order to cache their value.
291291
// Catch such calls and evaluate them instead of trying to load a constant's MIR.
292-
if let ty::InstanceDef::Intrinsic(def_id) = key.value.instance.def {
292+
if let ty::InstanceKind::Intrinsic(def_id) = key.value.instance.def {
293293
let ty = key.value.instance.ty(tcx, key.param_env);
294294
let ty::FnDef(_, args) = ty.kind() else {
295295
bug!("intrinsic with type {:?}", ty);

0 commit comments

Comments
 (0)