File tree Expand file tree Collapse file tree 5 files changed +120
-0
lines changed Expand file tree Collapse file tree 5 files changed +120
-0
lines changed Original file line number Diff line number Diff line change
1
+ struct Foo < T > {
2
+ inner : Vec < T > ,
3
+ }
4
+
5
+ impl < T > Foo < T > {
6
+ fn get ( & self ) -> impl Iterator < Item = & T > {
7
+ self . inner . iter ( )
8
+ }
9
+ }
10
+
11
+ fn main ( ) {
12
+ let foo: Foo < ( ) > = Foo { inner : Vec :: new ( ) } ;
13
+ let vals: Vec < _ > = foo. get ( ) ;
14
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc -Copt-level=2 --crate-type lib - << 'EOF '
4
+
5
+ pub trait Trait {
6
+ type Associated;
7
+ }
8
+ impl<T> Trait for T {
9
+ type Associated = T;
10
+ }
11
+
12
+ pub struct Struct<T>(<T as Trait>::Associated);
13
+
14
+ pub fn foo<T>() -> Struct<T>
15
+ where
16
+ T: Trait,
17
+ {
18
+ bar()
19
+ }
20
+
21
+ #[inline]
22
+ fn bar<T>() -> Struct<T> {
23
+ Struct(baz())
24
+ }
25
+
26
+ fn baz<T>() -> T {
27
+ unimplemented!()
28
+ }
29
+
30
+ EOF
31
+
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc " -Cdebuginfo=2" - << 'EOF '
4
+
5
+ // run-pass
6
+ #![feature(repr128, arbitrary_enum_discriminant)]
7
+ //~^ WARN the feature `repr128` is incomplete
8
+
9
+ #[derive(PartialEq, Debug)]
10
+ #[repr(i128)]
11
+ enum Test {
12
+ A(Box<u64>) = 0,
13
+ B(usize) = u64::MAX as i128 + 1,
14
+ }
15
+
16
+ fn main() {
17
+ assert_ne!(Test::A(Box::new(2)), Test::B(0));
18
+ // This previously caused a segfault.
19
+ //
20
+ // See https://github.com/rust-lang/rust/issues/70509#issuecomment-620654186
21
+ // for a detailed explanation.
22
+ }
23
+
24
+ EOF
25
+
Original file line number Diff line number Diff line change
1
+ #![ feature( generic_associated_types) ]
2
+
3
+ trait Bar < ' a > {
4
+ type Ref < ' b >
5
+ where
6
+ ' a : ' b ;
7
+ fn uwu ( f : impl Fn ( Self :: Ref < ' _ > ) ) ;
8
+ }
9
+
10
+ impl < ' a > Bar < ' a > for ( ) {
11
+ type Ref < ' b > = ( ) where ' a : ' b ;
12
+ fn uwu ( f : impl Fn ( ( ) ) ) { }
13
+ }
14
+
15
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ feature( generic_associated_types) ]
2
+
3
+ struct Foo < ' a > {
4
+ foo : & ' a mut usize ,
5
+ }
6
+
7
+ trait Bar < ' a > {
8
+ type FooRef < ' b >
9
+ where
10
+ ' a : ' b ,
11
+ ;
12
+ fn uwu (
13
+ foo : Foo < ' a > ,
14
+ f : impl for < ' b > FnMut ( Self :: FooRef < ' b > ) ,
15
+ )
16
+ ;
17
+ }
18
+ impl < ' a > Bar < ' a > for ( ) {
19
+ type FooRef < ' b >
20
+ =
21
+ & ' b Foo < ' a >
22
+ where
23
+ ' a : ' b ,
24
+ ;
25
+
26
+ fn uwu (
27
+ foo : Foo < ' a > ,
28
+ mut f : impl for < ' b > FnMut ( & ' b Foo < ' a > ) , //relevant part
29
+ )
30
+ {
31
+ f ( & foo) ;
32
+ }
33
+ }
34
+
35
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments