summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/util
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_middle/src/util
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_middle/src/util')
-rw-r--r--compiler/rustc_middle/src/util/bug.rs2
-rw-r--r--compiler/rustc_middle/src/util/call_kind.rs26
-rw-r--r--compiler/rustc_middle/src/util/common.rs2
-rw-r--r--compiler/rustc_middle/src/util/find_self_call.rs10
4 files changed, 20 insertions, 20 deletions
diff --git a/compiler/rustc_middle/src/util/bug.rs b/compiler/rustc_middle/src/util/bug.rs
index 43ee0343f..634ed5ec5 100644
--- a/compiler/rustc_middle/src/util/bug.rs
+++ b/compiler/rustc_middle/src/util/bug.rs
@@ -29,7 +29,7 @@ fn opt_span_bug_fmt<S: Into<MultiSpan>>(
location: &Location<'_>,
) -> ! {
tls::with_opt(move |tcx| {
- let msg = format!("{}: {}", location, args);
+ let msg = format!("{location}: {args}");
match (tcx, span) {
(Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, msg),
(Some(tcx), None) => tcx.sess.diagnostic().bug(msg),
diff --git a/compiler/rustc_middle/src/util/call_kind.rs b/compiler/rustc_middle/src/util/call_kind.rs
index 98d55ea6d..4e2a2c6ae 100644
--- a/compiler/rustc_middle/src/util/call_kind.rs
+++ b/compiler/rustc_middle/src/util/call_kind.rs
@@ -2,7 +2,7 @@
//! as well as errors when attempting to call a non-const function in a const
//! context.
-use crate::ty::subst::SubstsRef;
+use crate::ty::GenericArgsRef;
use crate::ty::{AssocItemContainer, Instance, ParamEnv, Ty, TyCtxt};
use rustc_hir::def_id::DefId;
use rustc_hir::{lang_items, LangItem};
@@ -43,7 +43,7 @@ pub enum CallKind<'tcx> {
self_arg: Option<Ident>,
desugaring: Option<(CallDesugaringKind, Ty<'tcx>)>,
method_did: DefId,
- method_substs: SubstsRef<'tcx>,
+ method_args: GenericArgsRef<'tcx>,
},
/// A call to `Fn(..)::call(..)`, desugared from `my_closure(a, b, c)`
FnCall { fn_trait_id: DefId, self_ty: Ty<'tcx> },
@@ -63,7 +63,7 @@ pub fn call_kind<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
method_did: DefId,
- method_substs: SubstsRef<'tcx>,
+ method_args: GenericArgsRef<'tcx>,
fn_call_span: Span,
from_hir_call: bool,
self_arg: Option<Ident>,
@@ -92,19 +92,19 @@ pub fn call_kind<'tcx>(
// an FnOnce call, an operator (e.g. `<<`), or a
// deref coercion.
let kind = if let Some(trait_id) = fn_call {
- Some(CallKind::FnCall { fn_trait_id: trait_id, self_ty: method_substs.type_at(0) })
+ Some(CallKind::FnCall { fn_trait_id: trait_id, self_ty: method_args.type_at(0) })
} else if let Some(trait_id) = operator {
- Some(CallKind::Operator { self_arg, trait_id, self_ty: method_substs.type_at(0) })
+ Some(CallKind::Operator { self_arg, trait_id, self_ty: method_args.type_at(0) })
} else if is_deref {
let deref_target = tcx.get_diagnostic_item(sym::deref_target).and_then(|deref_target| {
- Instance::resolve(tcx, param_env, deref_target, method_substs).transpose()
+ Instance::resolve(tcx, param_env, deref_target, method_args).transpose()
});
if let Some(Ok(instance)) = deref_target {
let deref_target_ty = instance.ty(tcx, param_env);
Some(CallKind::DerefCoercion {
deref_target: tcx.def_span(instance.def_id()),
deref_target_ty,
- self_ty: method_substs.type_at(0),
+ self_ty: method_args.type_at(0),
})
} else {
None
@@ -119,24 +119,24 @@ pub fn call_kind<'tcx>(
let desugaring = if Some(method_did) == tcx.lang_items().into_iter_fn()
&& fn_call_span.desugaring_kind() == Some(DesugaringKind::ForLoop)
{
- Some((CallDesugaringKind::ForLoopIntoIter, method_substs.type_at(0)))
+ Some((CallDesugaringKind::ForLoopIntoIter, method_args.type_at(0)))
} else if fn_call_span.desugaring_kind() == Some(DesugaringKind::QuestionMark) {
if Some(method_did) == tcx.lang_items().branch_fn() {
- Some((CallDesugaringKind::QuestionBranch, method_substs.type_at(0)))
+ Some((CallDesugaringKind::QuestionBranch, method_args.type_at(0)))
} else if Some(method_did) == tcx.lang_items().from_residual_fn() {
- Some((CallDesugaringKind::QuestionFromResidual, method_substs.type_at(0)))
+ Some((CallDesugaringKind::QuestionFromResidual, method_args.type_at(0)))
} else {
None
}
} else if Some(method_did) == tcx.lang_items().from_output_fn()
&& fn_call_span.desugaring_kind() == Some(DesugaringKind::TryBlock)
{
- Some((CallDesugaringKind::TryBlockFromOutput, method_substs.type_at(0)))
+ Some((CallDesugaringKind::TryBlockFromOutput, method_args.type_at(0)))
} else if fn_call_span.is_desugaring(DesugaringKind::Await) {
- Some((CallDesugaringKind::Await, method_substs.type_at(0)))
+ Some((CallDesugaringKind::Await, method_args.type_at(0)))
} else {
None
};
- CallKind::Normal { self_arg, desugaring, method_did, method_substs }
+ CallKind::Normal { self_arg, desugaring, method_did, method_args }
})
}
diff --git a/compiler/rustc_middle/src/util/common.rs b/compiler/rustc_middle/src/util/common.rs
index 08977049d..df101a2f6 100644
--- a/compiler/rustc_middle/src/util/common.rs
+++ b/compiler/rustc_middle/src/util/common.rs
@@ -17,7 +17,7 @@ pub fn to_readable_str(mut val: usize) -> String {
groups.push(group.to_string());
break;
} else {
- groups.push(format!("{:03}", group));
+ groups.push(format!("{group:03}"));
}
}
diff --git a/compiler/rustc_middle/src/util/find_self_call.rs b/compiler/rustc_middle/src/util/find_self_call.rs
index 0eab0adf0..1b845334c 100644
--- a/compiler/rustc_middle/src/util/find_self_call.rs
+++ b/compiler/rustc_middle/src/util/find_self_call.rs
@@ -1,5 +1,5 @@
use crate::mir::*;
-use crate::ty::subst::SubstsRef;
+use crate::ty::GenericArgsRef;
use crate::ty::{self, TyCtxt};
use rustc_span::def_id::DefId;
@@ -11,21 +11,21 @@ pub fn find_self_call<'tcx>(
body: &Body<'tcx>,
local: Local,
block: BasicBlock,
-) -> Option<(DefId, SubstsRef<'tcx>)> {
+) -> Option<(DefId, GenericArgsRef<'tcx>)> {
debug!("find_self_call(local={:?}): terminator={:?}", local, &body[block].terminator);
if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) =
&body[block].terminator
{
debug!("find_self_call: func={:?}", func);
if let Operand::Constant(box Constant { literal, .. }) = func {
- if let ty::FnDef(def_id, substs) = *literal.ty().kind() {
+ if let ty::FnDef(def_id, fn_args) = *literal.ty().kind() {
if let Some(ty::AssocItem { fn_has_self_parameter: true, .. }) =
tcx.opt_associated_item(def_id)
{
- debug!("find_self_call: args={:?}", args);
+ debug!("find_self_call: args={:?}", fn_args);
if let [Operand::Move(self_place) | Operand::Copy(self_place), ..] = **args {
if self_place.as_local() == Some(local) {
- return Some((def_id, substs));
+ return Some((def_id, fn_args));
}
}
}