This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc -Zsave-analysis - << EOF
4
+ #![feature(lang_items)]
5
+ // #![feature(no_core)]
6
+ // #![no_core]
7
+
8
+ #[lang = "fn"]
9
+ trait MyFn<T> {
10
+ const call: i32 = 42;
11
+ //~^ ERROR: ` call` trait item in ` fn` /` fn_mut` lang item must be a function
12
+ }
13
+
14
+ #[lang = "fn_mut"]
15
+ trait MyFnMut<T> {
16
+ fn call(i: i32, j: i32) -> i32 { i + j }
17
+ //~^ ERROR: first argument of ` call` in ` fn` /` fn_mut` lang item must be a reference
18
+ }
19
+
20
+ fn main() {
21
+ let a = || 42;
22
+ a();
23
+
24
+ let mut i = 0;
25
+ let mut b = || { i += 1; };
26
+ b();
27
+ }
28
+
29
+ fn main() {}
30
+ EOF
Original file line number Diff line number Diff line change
1
+ #![ feature( const_fn_trait_bound) ]
2
+ #![ feature( const_trait_impl) ]
3
+
4
+ const fn foo < T : ~const Drop > ( _: T ) { }
5
+
6
+ const fn bar ( ) {
7
+ foo ( || ( ) ) ;
8
+ }
9
+
10
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ feature( generic_const_exprs) ]
2
+
3
+ struct GenericStruct < const T : usize > { val : i64 }
4
+
5
+ impl < const T : usize > From < GenericStruct < T > > for GenericStruct < { T + 1 } > {
6
+ fn from ( other : GenericStruct < T > ) -> Self {
7
+ Self { val : other. val }
8
+ }
9
+ }
10
+
11
+ impl < const T : usize > From < GenericStruct < { T + 1 } > > for GenericStruct < T > {
12
+ fn from ( other : GenericStruct < { T + 1 } > ) -> Self {
13
+ Self { val : other. val }
14
+ }
15
+ }
16
+
17
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ feature( type_alias_impl_trait) ]
2
+
3
+ trait T { type Item ; }
4
+
5
+ type Alias < ' a > = impl T < Item = & ' a ( ) > ;
6
+
7
+ struct S ;
8
+ impl < ' a > T for & ' a S {
9
+ type Item = & ' a ( ) ;
10
+ }
11
+
12
+ fn filter_positive < ' a > ( ) -> Alias < ' a > {
13
+ & S
14
+ }
15
+
16
+ fn with_positive ( fun : impl Fn ( Alias < ' _ > ) ) {
17
+ fun ( filter_positive ( ) ) ;
18
+ }
19
+
20
+ fn main ( ) {
21
+ with_positive ( |_| ( ) ) ;
22
+ }
You can’t perform that action at this time.
0 commit comments