This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree 5 files changed +120
-0
lines changed
5 files changed +120
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc -Z mir-opt-level=3 - << EOF
4
+
5
+ fn main() {
6
+ let i = (0..usize::max_value()).chain(0..10).skip(usize::max_value());
7
+ assert_eq!(i.count(), 10);
8
+ }
9
+
10
+ EOF
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc --emit=mir --edition 2018 - << EOF
4
+
5
+ fn main() {}
6
+
7
+ struct StructA {}
8
+ struct StructB {}
9
+
10
+ impl StructA {
11
+ fn fn_taking_struct_b(&self, struct_b: &StructB) -> bool {
12
+ true
13
+ }
14
+ }
15
+
16
+ async fn get_struct_a_async() -> StructA {
17
+ StructA {}
18
+ }
19
+
20
+ async fn ice() {
21
+ match Some(StructB {}) {
22
+ Some(struct_b) if get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {}
23
+ _ => {}
24
+ }
25
+ }
26
+
27
+ EOF
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
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ #![ allow( incomplete_features) ]
3
+ struct Arr < const N : usize >
4
+ where Assert :: < { N < usize:: max_value ( ) / 2 } > : IsTrue ,
5
+ {
6
+ }
7
+
8
+ enum Assert < const CHECK : bool > { }
9
+
10
+ trait IsTrue { }
11
+
12
+ impl IsTrue for Assert < true > { }
13
+
14
+ fn main ( ) {
15
+ let x: Arr < { usize:: max_value ( ) } > = Arr { } ;
16
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ #![ feature( specialization) ]
3
+ #![ allow( incomplete_features) ]
4
+
5
+ //--------------------------------------------------
6
+
7
+ trait Depth {
8
+ const C : usize ;
9
+ }
10
+
11
+ trait Type {
12
+ type AT : Depth ;
13
+ }
14
+
15
+ //--------------------------------------------------
16
+
17
+ enum Predicate < const B : bool > { }
18
+
19
+ trait Satisfied { }
20
+
21
+ impl Satisfied for Predicate < true > { }
22
+
23
+ //--------------------------------------------------
24
+
25
+ trait Spec1 { }
26
+
27
+ impl < T : Type > Spec1 for T where Predicate < { T :: AT :: C > 0 } > : Satisfied { }
28
+
29
+ trait Spec2 : Spec1 { }
30
+
31
+ impl < T : Type + Spec1 > Spec2 for T where Predicate < { T :: AT :: C > 1 } > : Satisfied { }
32
+
33
+ //--------------------------------------------------
34
+
35
+ trait Foo {
36
+ fn Bar ( ) ;
37
+ }
38
+
39
+ impl < T : Spec1 > Foo for T {
40
+ default fn Bar ( ) { }
41
+ }
42
+
43
+ impl < T : Spec2 > Foo for T {
44
+ fn Bar ( ) { }
45
+ }
You can’t perform that action at this time.
0 commit comments