File tree 5 files changed +108
-0
lines changed
5 files changed +108
-0
lines changed Original file line number Diff line number Diff line change
1
+ // edition:2018
2
+ // compile-flags: -Z mir-opt-level=2 -Z unsound-mir-opts
3
+
4
+ #[ inline( always) ]
5
+ pub fn f ( s : bool ) -> String {
6
+ let a = "Hello world!" . to_string ( ) ;
7
+ let b = a;
8
+ let c = b;
9
+ if s {
10
+ c
11
+ } else {
12
+ String :: new ( )
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Z mir-opt-level=2
2
+ // edition:2018
3
+ // build-pass
4
+
5
+ #![ feature( async_closure) ]
6
+
7
+ use std:: future:: Future ;
8
+
9
+ fn async_closure ( ) -> impl Future < Output = u8 > {
10
+ ( async move || -> u8 { 42 } ) ( )
11
+ }
12
+
13
+ fn main ( ) {
14
+ let _fut = async_closure ( ) ;
15
+ }
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Z mir-opt-level=2
2
+ // build-pass
3
+
4
+ #![ feature( type_alias_impl_trait) ]
5
+
6
+ use std:: marker:: PhantomData ;
7
+
8
+ trait MyIndex < T > {
9
+ type O ;
10
+ fn my_index ( self ) -> Self :: O ;
11
+ }
12
+ trait MyFrom < T > : Sized {
13
+ type Error ;
14
+ fn my_from ( value : T ) -> Result < Self , Self :: Error > ;
15
+ }
16
+
17
+ trait F { }
18
+ impl F for ( ) { }
19
+ type DummyT < T > = impl F ;
20
+ fn _dummy_t < T > ( ) -> DummyT < T > { }
21
+
22
+ struct Phantom1 < T > ( PhantomData < T > ) ;
23
+ struct Phantom2 < T > ( PhantomData < T > ) ;
24
+ struct Scope < T > ( Phantom2 < DummyT < T > > ) ;
25
+
26
+ impl < T > Scope < T > {
27
+ fn new ( ) -> Self {
28
+ unimplemented ! ( )
29
+ }
30
+ }
31
+
32
+ impl < T > MyFrom < Phantom2 < T > > for Phantom1 < T > {
33
+ type Error = ( ) ;
34
+ fn my_from ( _: Phantom2 < T > ) -> Result < Self , Self :: Error > {
35
+ unimplemented ! ( )
36
+ }
37
+ }
38
+
39
+ impl < T : MyFrom < Phantom2 < DummyT < U > > > , U > MyIndex < Phantom1 < T > > for Scope < U > {
40
+ type O = T ;
41
+ fn my_index ( self ) -> Self :: O {
42
+ MyFrom :: my_from ( self . 0 ) . ok ( ) . unwrap ( )
43
+ }
44
+ }
45
+
46
+ fn main ( ) {
47
+ let _pos: Phantom1 < DummyT < ( ) > > = Scope :: new ( ) . my_index ( ) ;
48
+ }
Original file line number Diff line number Diff line change
1
+ // edition:2018
2
+ // build-pass
3
+ // compile-flags: -Z mir-opt-level=2 -L.
4
+ // aux-build:issue_76375_aux.rs
5
+
6
+ #![ crate_type = "lib" ]
7
+
8
+ extern crate issue_76375_aux;
9
+
10
+ pub async fn g ( ) {
11
+ issue_76375_aux:: f ( true ) ;
12
+ h ( ) . await ;
13
+ }
14
+
15
+ pub async fn h ( ) { }
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Z mir-opt-level=2
2
+ // ignore-cloudabi no std::fs
3
+ // build-pass
4
+
5
+ use std:: fs:: File ;
6
+ use std:: io:: { BufRead , BufReader } ;
7
+
8
+ fn file_lines ( ) -> impl Iterator < Item = String > {
9
+ BufReader :: new ( File :: open ( "" ) . unwrap ( ) )
10
+ . lines ( )
11
+ . map ( Result :: unwrap)
12
+ }
13
+
14
+ fn main ( ) {
15
+ for _ in file_lines ( ) { }
16
+ }
You can’t perform that action at this time.
0 commit comments