diff options
author | Jade <[email protected]> | 2021-05-14 08:59:30 +0100 |
---|---|---|
committer | Jade <[email protected]> | 2021-05-14 09:39:28 +0100 |
commit | 78d6b88f211cc9faf88815ce7fb1a91546cfce15 (patch) | |
tree | 6b54a10d2eeee6fc03d63015e4b7c9838b4b02b9 /crates/hir | |
parent | 32c600664e5a599bbe3f0254274211474b89914a (diff) |
Add more tests, refactor array lengths/consteval work
Fix #2922: add unknown length as a condition for a type having unknown.
Incorporate reviews:
* Extract some of the const evaluation workings into functions
* Add fixmes on the hacks
* Add tests for impls on specific array lengths (these work!!! 😁)
* Add tests for const generics (indeed we don't support it yet)
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c9ef4b420..d7065ff2b 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -52,7 +52,9 @@ use hir_def::{ | |||
52 | }; | 52 | }; |
53 | use hir_expand::{diagnostics::DiagnosticSink, name::name, MacroDefKind}; | 53 | use hir_expand::{diagnostics::DiagnosticSink, name::name, MacroDefKind}; |
54 | use hir_ty::{ | 54 | use hir_ty::{ |
55 | autoderef, could_unify, | 55 | autoderef, |
56 | consteval::ConstExtension, | ||
57 | could_unify, | ||
56 | method_resolution::{self, def_crates, TyFingerprint}, | 58 | method_resolution::{self, def_crates, TyFingerprint}, |
57 | primitive::UintTy, | 59 | primitive::UintTy, |
58 | subst_prefix, | 60 | subst_prefix, |
@@ -1910,6 +1912,7 @@ impl Type { | |||
1910 | substs.iter(&Interner).filter_map(|a| a.ty(&Interner)).any(go) | 1912 | substs.iter(&Interner).filter_map(|a| a.ty(&Interner)).any(go) |
1911 | } | 1913 | } |
1912 | 1914 | ||
1915 | TyKind::Array(_ty, len) if len.is_unknown() => true, | ||
1913 | TyKind::Array(ty, _) | 1916 | TyKind::Array(ty, _) |
1914 | | TyKind::Slice(ty) | 1917 | | TyKind::Slice(ty) |
1915 | | TyKind::Raw(_, ty) | 1918 | | TyKind::Raw(_, ty) |