Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/consteval/tests.rs')
| -rw-r--r-- | crates/hir-ty/src/consteval/tests.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/hir-ty/src/consteval/tests.rs b/crates/hir-ty/src/consteval/tests.rs index 5bb327606d..de792a6c5a 100644 --- a/crates/hir-ty/src/consteval/tests.rs +++ b/crates/hir-ty/src/consteval/tests.rs @@ -114,7 +114,7 @@ fn eval_goal(db: &TestDB, file_id: FileId) -> Result<Const, ConstEvalError> { _ => None, }) .expect("No const named GOAL found in the test"); - db.const_eval(const_id.into(), Substitution::empty(Interner)) + db.const_eval(const_id.into(), Substitution::empty(Interner), None) } #[test] @@ -2494,6 +2494,28 @@ fn const_trait_assoc() { ); check_number( r#" + //- minicore: size_of + //- /a/lib.rs crate:a + use core::mem::size_of; + pub struct S<T>(T); + impl<T> S<T> { + pub const X: usize = core::mem::size_of::<T>(); + } + //- /main.rs crate:main deps:a + use a::{S}; + trait Tr { + type Ty; + } + impl Tr for i32 { + type Ty = u64; + } + struct K<T: Tr>(<T as Tr>::Ty); + const GOAL: usize = S::<K<i32>>::X; + "#, + 8, + ); + check_number( + r#" struct S<T>(*mut T); trait MySized: Sized { |