diff options
| author | kadmin <julianknodt@gmail.com> | 2021-04-26 18:19:23 +0000 |
|---|---|---|
| committer | kadmin <julianknodt@gmail.com> | 2021-07-25 07:28:51 +0000 |
| commit | 8286824ab2f776eeaebd21b1f78bacda34dcbcba (patch) | |
| tree | fe68ff90d14001ab4574914fb7b8d1222cbc3cef /clippy_utils | |
| parent | 00faed9f0cb0129dc39d3f6ea769df35c68a4d05 (diff) | |
| download | rust-8286824ab2f776eeaebd21b1f78bacda34dcbcba.tar.gz rust-8286824ab2f776eeaebd21b1f78bacda34dcbcba.zip | |
Add inferred args to typeck
Diffstat (limited to 'clippy_utils')
| -rw-r--r-- | clippy_utils/src/hir_utils.rs | 8 | ||||
| -rw-r--r-- | clippy_utils/src/ty.rs | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index 63737955f09..e636038b6e1 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -288,6 +288,8 @@ impl HirEqInterExpr<'_, '_, '_> { (GenericArg::Const(l), GenericArg::Const(r)) => self.eq_body(l.value.body, r.value.body), (GenericArg::Lifetime(l_lt), GenericArg::Lifetime(r_lt)) => Self::eq_lifetime(l_lt, r_lt), (GenericArg::Type(l_ty), GenericArg::Type(r_ty)) => self.eq_ty(l_ty, r_ty), + (GenericArg::Infer(l_inf), GenericArg::Infer(r_inf)) => + self.eq_ty(&l_inf.to_ty(), &r_inf.to_ty()), _ => false, } } @@ -888,10 +890,6 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_tykind(&ty.kind); } - pub fn hash_infer(&mut self) { - "_".hash(&mut self.s); - } - pub fn hash_tykind(&mut self, ty: &TyKind<'_>) { match ty { TyKind::Slice(ty) => { @@ -957,7 +955,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { GenericArg::Lifetime(l) => self.hash_lifetime(l), GenericArg::Type(ref ty) => self.hash_ty(ty), GenericArg::Const(ref ca) => self.hash_body(ca.value.body), - GenericArg::Infer(ref _inf) => self.hash_infer(), + GenericArg::Infer(ref inf) => self.hash_ty(&inf.to_ty()), } } } diff --git a/clippy_utils/src/ty.rs b/clippy_utils/src/ty.rs index 523d55219ab..e914dc1c222 100644 --- a/clippy_utils/src/ty.rs +++ b/clippy_utils/src/ty.rs @@ -180,7 +180,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool { } // FIXME: Per https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/at/struct.At.html#method.normalize -// this function can be removed once the `normalizie` method does not panic when normalization does +// this function can be removed once the `normalize` method does not panic when normalization does // not succeed /// Checks if `Ty` is normalizable. This function is useful /// to avoid crashes on `layout_of`. |
