Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/simple.rs')
-rw-r--r--crates/hir-ty/src/tests/simple.rs44
1 files changed, 26 insertions, 18 deletions
diff --git a/crates/hir-ty/src/tests/simple.rs b/crates/hir-ty/src/tests/simple.rs
index 0c57d050f3..e8f378db32 100644
--- a/crates/hir-ty/src/tests/simple.rs
+++ b/crates/hir-ty/src/tests/simple.rs
@@ -2879,6 +2879,10 @@ unsafe impl Allocator for Global {}
#[fundamental]
pub struct Box<T: ?Sized, A: Allocator = Global>(T, A);
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+pub fn box_new<T>(_x: T) -> Box<T>;
+
impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
pub struct Vec<T, A: Allocator = Global>(T, A);
@@ -2895,8 +2899,8 @@ impl<T> [T] {
}
fn test() {
- let vec = <[_]>::into_vec(#[rustc_box] Box::new([1i32]));
- let v: Vec<Box<dyn B>> = <[_]> :: into_vec(#[rustc_box] Box::new([#[rustc_box] Box::new(Astruct)]));
+ let vec = <[_]>::into_vec(box_new([1i32]));
+ let v: Vec<Box<dyn B>> = <[_]> :: into_vec(box_new([box_new(Astruct)]));
}
trait B{}
@@ -2904,22 +2908,26 @@ struct Astruct;
impl B for Astruct {}
"#,
expect![[r#"
- 639..643 'self': Box<[T], A>
- 672..704 '{ ... }': Vec<T, A>
- 718..888 '{ ...])); }': ()
- 728..731 'vec': Vec<i32, Global>
- 734..749 '<[_]>::into_vec': fn into_vec<i32, Global>(Box<[i32], Global>) -> Vec<i32, Global>
- 734..780 '<[_]>:...i32]))': Vec<i32, Global>
- 750..779 '#[rust...1i32])': Box<[i32; 1], Global>
- 772..778 '[1i32]': [i32; 1]
- 773..777 '1i32': i32
- 790..791 'v': Vec<Box<dyn B + 'static, Global>, Global>
- 811..828 '<[_]> ...to_vec': fn into_vec<Box<dyn B + '?, Global>, Global>(Box<[Box<dyn B + '?, Global>], Global>) -> Vec<Box<dyn B + '?, Global>, Global>
- 811..885 '<[_]> ...ct)]))': Vec<Box<dyn B + '?, Global>, Global>
- 829..884 '#[rust...uct)])': Box<[Box<dyn B + '?, Global>; 1], Global>
- 851..883 '[#[rus...ruct)]': [Box<dyn B + '?, Global>; 1]
- 852..882 '#[rust...truct)': Box<Astruct, Global>
- 874..881 'Astruct': Astruct
+ 428..430 '_x': T
+ 733..737 'self': Box<[T], A>
+ 766..798 '{ ... }': Vec<T, A>
+ 812..940 '{ ...])); }': ()
+ 822..825 'vec': Vec<i32, Global>
+ 828..843 '<[_]>::into_vec': fn into_vec<i32, Global>(Box<[i32], Global>) -> Vec<i32, Global>
+ 828..860 '<[_]>:...i32]))': Vec<i32, Global>
+ 844..851 'box_new': fn box_new<[i32; 1]>([i32; 1]) -> Box<[i32; 1], Global>
+ 844..859 'box_new([1i32])': Box<[i32; 1], Global>
+ 852..858 '[1i32]': [i32; 1]
+ 853..857 '1i32': i32
+ 870..871 'v': Vec<Box<dyn B + 'static, Global>, Global>
+ 891..908 '<[_]> ...to_vec': fn into_vec<Box<dyn B + '?, Global>, Global>(Box<[Box<dyn B + '?, Global>], Global>) -> Vec<Box<dyn B + '?, Global>, Global>
+ 891..937 '<[_]> ...ct)]))': Vec<Box<dyn B + '?, Global>, Global>
+ 909..916 'box_new': fn box_new<[Box<dyn B + '?, Global>; 1]>([Box<dyn B + '?, Global>; 1]) -> Box<[Box<dyn B + '?, Global>; 1], Global>
+ 909..936 'box_ne...uct)])': Box<[Box<dyn B + '?, Global>; 1], Global>
+ 917..935 '[box_n...ruct)]': [Box<dyn B + '?, Global>; 1]
+ 918..925 'box_new': fn box_new<Astruct>(Astruct) -> Box<Astruct, Global>
+ 918..934 'box_ne...truct)': Box<Astruct, Global>
+ 926..933 'Astruct': Astruct
"#]],
)
}