diff options
| author | hkalbasi <hamidrezakalbasi@protonmail.com> | 2022-04-22 19:22:18 +0430 |
|---|---|---|
| committer | hkalbasi <hamidrezakalbasi@protonmail.com> | 2022-04-22 19:22:18 +0430 |
| commit | 0b5dd42facb8f34da578afb11870e6f4e674708a (patch) | |
| tree | 74a79befe0c331d5a3568f79a9b73fe5021edfc2 | |
| parent | d33d5fca1dd8c0da5c47d223ab5a52cf1633db98 (diff) | |
| download | rust-0b5dd42facb8f34da578afb11870e6f4e674708a.tar.gz rust-0b5dd42facb8f34da578afb11870e6f4e674708a.zip | |
Add some comments about why never!() never happens
| -rw-r--r-- | crates/hir_ty/src/lower.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 427791afa2c..29bf16d23fe 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -749,7 +749,8 @@ impl<'a> TyLoweringContext<'a> { had_explicit_args = true; substs.push(x); } else { - never!(); + // we just filtered them out + never!("Unexpected lifetime argument"); } } } @@ -1673,6 +1674,10 @@ pub(crate) fn lower_to_chalk_mutability(m: hir_def::type_ref::Mutability) -> Mut } } +/// Checks if the provided generic arg matches its expected kind, then lower them via +/// provided closures. Use unknown if there was kind mismatch. +/// +/// Returns `Some` of the lowered generic arg. `None` if the provided arg is a lifetime. pub(crate) fn generic_arg_to_chalk<'a, T>( db: &dyn HirDatabase, kind_id: Either<TypeParamId, ConstParamId>, |
