Skip to content

Commit 8e27211

Browse files
is_ty_infer -> is_ty_or_numeric_infer
1 parent 61a415b commit 8e27211

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1782,9 +1782,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
17821782
// like when you have two references but one is `usize` and the other
17831783
// is `f32`. In those cases we still want to show the `note`. If the
17841784
// value from `ef` is `Infer(_)`, then we ignore it.
1785-
if !ef.expected.is_ty_infer() {
1785+
if !ef.expected.is_ty_or_numeric_infer() {
17861786
ef.expected != values.expected
1787-
} else if !ef.found.is_ty_infer() {
1787+
} else if !ef.found.is_ty_or_numeric_infer() {
17881788
ef.found != values.found
17891789
} else {
17901790
false

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl InferenceDiagnosticsData {
7878
}
7979

8080
fn where_x_is_kind(&self, in_type: Ty<'_>) -> &'static str {
81-
if in_type.is_ty_infer() {
81+
if in_type.is_ty_or_numeric_infer() {
8282
""
8383
} else if self.name == "_" {
8484
// FIXME: Consider specializing this message if there is a single `_`
@@ -195,12 +195,12 @@ fn ty_to_string<'tcx>(
195195
// invalid pseudo-syntax, we want the `fn`-pointer output instead.
196196
(ty::FnDef(..), _) => ty.fn_sig(infcx.tcx).print(printer).unwrap().into_buffer(),
197197
(_, Some(def_id))
198-
if ty.is_ty_infer()
198+
if ty.is_ty_or_numeric_infer()
199199
&& infcx.tcx.get_diagnostic_item(sym::iterator_collect_fn) == Some(def_id) =>
200200
{
201201
"Vec<_>".to_string()
202202
}
203-
_ if ty.is_ty_infer() => "/* Type */".to_string(),
203+
_ if ty.is_ty_or_numeric_infer() => "/* Type */".to_string(),
204204
// FIXME: The same thing for closures, but this only works when the closure
205205
// does not capture anything.
206206
//
@@ -680,7 +680,7 @@ impl<'tcx> InferSourceKind<'tcx> {
680680
| InferSourceKind::ClosureReturn { ty, .. } => {
681681
if ty.is_closure() {
682682
("closure", closure_as_fn_str(infcx, ty))
683-
} else if !ty.is_ty_infer() {
683+
} else if !ty.is_ty_or_numeric_infer() {
684684
("normal", ty_to_string(infcx, ty, None))
685685
} else {
686686
("other", String::new())
@@ -813,7 +813,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
813813
self.attempt += 1;
814814
if let Some(InferSource { kind: InferSourceKind::GenericArg { def_id: did, ..}, .. }) = self.infer_source
815815
&& let InferSourceKind::LetBinding { ref ty, ref mut def_id, ..} = new_source.kind
816-
&& ty.is_ty_infer()
816+
&& ty.is_ty_or_numeric_infer()
817817
{
818818
// Customize the output so we talk about `let x: Vec<_> = iter.collect();` instead of
819819
// `let x: _ = iter.collect();`, as this is a very common case.

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ impl<'tcx> Ty<'tcx> {
16861686
}
16871687

16881688
#[inline]
1689-
pub fn is_ty_infer(self) -> bool {
1689+
pub fn is_ty_or_numeric_infer(self) -> bool {
16901690
matches!(self.kind(), Infer(_))
16911691
}
16921692

compiler/rustc_middle/src/ty/subst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<'tcx> GenericArg<'tcx> {
202202
pub fn is_non_region_infer(self) -> bool {
203203
match self.unpack() {
204204
GenericArgKind::Lifetime(_) => false,
205-
GenericArgKind::Type(ty) => ty.is_ty_infer(),
205+
GenericArgKind::Type(ty) => ty.is_ty_or_numeric_infer(),
206206
GenericArgKind::Const(ct) => ct.is_ct_infer(),
207207
}
208208
}

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -2252,8 +2252,11 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
22522252
Ok(None) => {
22532253
let ambiguities =
22542254
ambiguity::recompute_applicable_impls(self.infcx, &obligation);
2255-
let has_non_region_infer =
2256-
trait_ref.skip_binder().substs.types().any(|t| !t.is_ty_infer());
2255+
let has_non_region_infer = trait_ref
2256+
.skip_binder()
2257+
.substs
2258+
.types()
2259+
.any(|t| !t.is_ty_or_numeric_infer());
22572260
// It doesn't make sense to talk about applicable impls if there are more
22582261
// than a handful of them.
22592262
if ambiguities.len() > 1 && ambiguities.len() < 10 && has_non_region_infer {

0 commit comments

Comments
 (0)