aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests
diff options
context:
space:
mode:
authorThiĆ©baud Weksteen <[email protected]>2021-01-22 10:17:45 +0000
committerThiĆ©baud Weksteen <[email protected]>2021-01-22 12:50:23 +0000
commitbe0691b02bd739310f6d6518dc10f01b9a692598 (patch)
tree5969dde061abd29d96d0c74f16d1d65775cb5937 /crates/hir_ty/src/tests
parentfde4a860aea903a0455a05c1def1d07a6573639b (diff)
Handle box with allocator
In 1.49.0, the definition of Box was modified to support an optional Allocator[1]. Adapt the parsing of the `box` keyword to supply the expected number of parameters to the constructor. [1] https://github.com/rust-lang/rust/commit/f288cd2e179f600fa00c2a407206a12f6c5a91e0
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r--crates/hir_ty/src/tests/simple.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs
index 8d431b920..16682f76f 100644
--- a/crates/hir_ty/src/tests/simple.rs
+++ b/crates/hir_ty/src/tests/simple.rs
@@ -29,6 +29,30 @@ mod boxed {
29} 29}
30 30
31#[test] 31#[test]
32fn infer_box_with_allocator() {
33 check_types(
34 r#"
35//- /main.rs crate:main deps:std
36fn test() {
37 let x = box 1;
38 let t = (x, box x, box &1, box [1]);
39 t;
40} //^ (Box<i32, {unknown}>, Box<Box<i32, {unknown}>, {unknown}>, Box<&i32, {unknown}>, Box<[i32; _], {unknown}>)
41
42//- /std.rs crate:std
43#[prelude_import] use prelude::*;
44mod boxed {
45 #[lang = "owned_box"]
46 pub struct Box<T: ?Sized, A: Allocator> {
47 inner: *mut T,
48 allocator: A,
49 }
50}
51"#,
52 );
53}
54
55#[test]
32fn infer_adt_self() { 56fn infer_adt_self() {
33 check_types( 57 check_types(
34 r#" 58 r#"