diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 869ae13f1..9a5f6949d 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -56,6 +56,37 @@ mod future { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | #[test] | 58 | #[test] |
59 | fn infer_box() { | ||
60 | let (mut db, pos) = MockDatabase::with_position( | ||
61 | r#" | ||
62 | //- /main.rs | ||
63 | |||
64 | fn test() { | ||
65 | let x = box 1; | ||
66 | let t = (x, box x, box &1, box [1]); | ||
67 | t<|>; | ||
68 | } | ||
69 | |||
70 | //- /std.rs | ||
71 | #[prelude_import] use prelude::*; | ||
72 | mod prelude {} | ||
73 | |||
74 | mod boxed { | ||
75 | pub struct Box<T: ?Sized> { | ||
76 | inner: *mut T, | ||
77 | } | ||
78 | } | ||
79 | |||
80 | "#, | ||
81 | ); | ||
82 | db.set_crate_graph_from_fixture(crate_graph! { | ||
83 | "main": ("/main.rs", ["std"]), | ||
84 | "std": ("/std.rs", []), | ||
85 | }); | ||
86 | assert_eq!("(Box<i32>, Box<Box<i32>>, Box<&i32>, Box<[i32;_]>)", type_at_pos(&db, pos)); | ||
87 | } | ||
88 | |||
89 | #[test] | ||
59 | fn infer_try() { | 90 | fn infer_try() { |
60 | let (mut db, pos) = MockDatabase::with_position( | 91 | let (mut db, pos) = MockDatabase::with_position( |
61 | r#" | 92 | r#" |