Skip to content

Commit 725b799

Browse files
authored
Rollup merge of rust-lang#135069 - matthiaskrgr:param_rec_usage, r=jieyouxu
remove unused function params
2 parents e4cc2db + e839d05 commit 725b799

File tree

3 files changed

+14
-25
lines changed

3 files changed

+14
-25
lines changed

compiler/rustc_middle/src/ty/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ impl<'tcx> Ty<'tcx> {
6969
/// description in error messages. This is used in the primary span label. Beyond what
7070
/// `is_simple_ty` includes, it also accepts ADTs with no type arguments and references to
7171
/// ADTs with no type arguments.
72-
pub fn is_simple_text(self, tcx: TyCtxt<'tcx>) -> bool {
72+
pub fn is_simple_text(self) -> bool {
7373
match self.kind() {
7474
Adt(_, args) => args.non_erasable_generics().next().is_none(),
75-
Ref(_, ty, _) => ty.is_simple_text(tcx),
75+
Ref(_, ty, _) => ty.is_simple_text(),
7676
_ => self.is_simple_ty(),
7777
}
7878
}

compiler/rustc_mir_transform/src/coroutine.rs

+9-19
Original file line numberDiff line numberDiff line change
@@ -1822,9 +1822,6 @@ impl<'tcx> Visitor<'tcx> for EnsureCoroutineFieldAssignmentsNeverAlias<'_> {
18221822
fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &CoroutineLayout<'tcx>, body: &Body<'tcx>) {
18231823
let mut linted_tys = FxHashSet::default();
18241824

1825-
// We want a user-facing param-env.
1826-
let param_env = tcx.param_env(body.source.def_id());
1827-
18281825
for (variant, yield_source_info) in
18291826
layout.variant_fields.iter().zip(&layout.variant_source_info)
18301827
{
@@ -1838,7 +1835,7 @@ fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &CoroutineLayout<'tcx>, bo
18381835
continue;
18391836
};
18401837

1841-
check_must_not_suspend_ty(tcx, decl.ty, hir_id, param_env, SuspendCheckData {
1838+
check_must_not_suspend_ty(tcx, decl.ty, hir_id, SuspendCheckData {
18421839
source_span: decl.source_info.span,
18431840
yield_span: yield_source_info.span,
18441841
plural_len: 1,
@@ -1868,7 +1865,6 @@ fn check_must_not_suspend_ty<'tcx>(
18681865
tcx: TyCtxt<'tcx>,
18691866
ty: Ty<'tcx>,
18701867
hir_id: hir::HirId,
1871-
param_env: ty::ParamEnv<'tcx>,
18721868
data: SuspendCheckData<'_>,
18731869
) -> bool {
18741870
if ty.is_unit() {
@@ -1883,16 +1879,13 @@ fn check_must_not_suspend_ty<'tcx>(
18831879
ty::Adt(_, args) if ty.is_box() => {
18841880
let boxed_ty = args.type_at(0);
18851881
let allocator_ty = args.type_at(1);
1886-
check_must_not_suspend_ty(tcx, boxed_ty, hir_id, param_env, SuspendCheckData {
1882+
check_must_not_suspend_ty(tcx, boxed_ty, hir_id, SuspendCheckData {
18871883
descr_pre: &format!("{}boxed ", data.descr_pre),
18881884
..data
1889-
}) || check_must_not_suspend_ty(
1890-
tcx,
1891-
allocator_ty,
1892-
hir_id,
1893-
param_env,
1894-
SuspendCheckData { descr_pre: &format!("{}allocator ", data.descr_pre), ..data },
1895-
)
1885+
}) || check_must_not_suspend_ty(tcx, allocator_ty, hir_id, SuspendCheckData {
1886+
descr_pre: &format!("{}allocator ", data.descr_pre),
1887+
..data
1888+
})
18961889
}
18971890
ty::Adt(def, _) => check_must_not_suspend_def(tcx, def.did(), hir_id, data),
18981891
// FIXME: support adding the attribute to TAITs
@@ -1937,7 +1930,7 @@ fn check_must_not_suspend_ty<'tcx>(
19371930
let mut has_emitted = false;
19381931
for (i, ty) in fields.iter().enumerate() {
19391932
let descr_post = &format!(" in tuple element {i}");
1940-
if check_must_not_suspend_ty(tcx, ty, hir_id, param_env, SuspendCheckData {
1933+
if check_must_not_suspend_ty(tcx, ty, hir_id, SuspendCheckData {
19411934
descr_post,
19421935
..data
19431936
}) {
@@ -1948,7 +1941,7 @@ fn check_must_not_suspend_ty<'tcx>(
19481941
}
19491942
ty::Array(ty, len) => {
19501943
let descr_pre = &format!("{}array{} of ", data.descr_pre, plural_suffix);
1951-
check_must_not_suspend_ty(tcx, ty, hir_id, param_env, SuspendCheckData {
1944+
check_must_not_suspend_ty(tcx, ty, hir_id, SuspendCheckData {
19521945
descr_pre,
19531946
// FIXME(must_not_suspend): This is wrong. We should handle printing unevaluated consts.
19541947
plural_len: len.try_to_target_usize(tcx).unwrap_or(0) as usize + 1,
@@ -1959,10 +1952,7 @@ fn check_must_not_suspend_ty<'tcx>(
19591952
// may not be considered live across the await point.
19601953
ty::Ref(_region, ty, _mutability) => {
19611954
let descr_pre = &format!("{}reference{} to ", data.descr_pre, plural_suffix);
1962-
check_must_not_suspend_ty(tcx, ty, hir_id, param_env, SuspendCheckData {
1963-
descr_pre,
1964-
..data
1965-
})
1955+
check_must_not_suspend_ty(tcx, ty, hir_id, SuspendCheckData { descr_pre, ..data })
19661956
}
19671957
_ => false,
19681958
}

compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1496,8 +1496,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
14961496
ValuePairs::Terms(ExpectedFound { expected, found }) => {
14971497
match (expected.unpack(), found.unpack()) {
14981498
(ty::TermKind::Ty(expected), ty::TermKind::Ty(found)) => {
1499-
let is_simple_err = expected.is_simple_text(self.tcx)
1500-
&& found.is_simple_text(self.tcx);
1499+
let is_simple_err =
1500+
expected.is_simple_text() && found.is_simple_text();
15011501
OpaqueTypesVisitor::visit_expected_found(
15021502
self.tcx, expected, found, span,
15031503
)
@@ -1736,8 +1736,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
17361736
(true, _) => format!(" ({})", ty.sort_string(self.tcx)),
17371737
(false, _) => "".to_string(),
17381738
};
1739-
if !(values.expected.is_simple_text(self.tcx)
1740-
&& values.found.is_simple_text(self.tcx))
1739+
if !(values.expected.is_simple_text() && values.found.is_simple_text())
17411740
|| (exp_found.is_some_and(|ef| {
17421741
// This happens when the type error is a subset of the expectation,
17431742
// like when you have two references but one is `usize` and the other

0 commit comments

Comments
 (0)