This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree 3 files changed +78
-0
lines changed
3 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc -Zsave-analysis - << EOF
4
+ #![feature(impl_trait_in_bindings)]
5
+
6
+ mod impl_trait_in_bindings {
7
+ struct Foo;
8
+
9
+ trait FooLike { type Output; }
10
+
11
+ impl FooLike for Foo {
12
+ type Output = u32;
13
+ }
14
+
15
+ trait Trait {
16
+ type Assoc;
17
+ }
18
+
19
+ fn foo<T: Trait<Assoc=u32>>() {
20
+ let _: impl FooLike<Output=T::Assoc> = Foo;
21
+ }
22
+ }
23
+
24
+ fn main() {}
25
+
26
+ EOF
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ #![ allow( incomplete_features) ]
3
+
4
+ fn test < const N : usize > ( ) { }
5
+
6
+ fn wow < ' a > ( ) {
7
+ test :: < {
8
+ let _: & ' a ( ) ;
9
+ 3
10
+ } > ( ) ;
11
+ }
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ feature( specialization) ]
2
+ #![ feature( unsize, coerce_unsized) ]
3
+ #![ allow( incomplete_features) ]
4
+ #![ crate_type = "lib" ]
5
+
6
+ use std:: ops:: CoerceUnsized ;
7
+
8
+ pub struct SmartassPtr < A : Smartass +?Sized > ( A :: Data ) ;
9
+
10
+ pub trait Smartass {
11
+ type Data ;
12
+ type Data2 : CoerceUnsized < * const [ u8 ] > ;
13
+ }
14
+
15
+ pub trait MaybeObjectSafe { }
16
+
17
+ impl MaybeObjectSafe for ( ) { }
18
+
19
+ impl < T > Smartass for T {
20
+ type Data = <Self as Smartass >:: Data2 ;
21
+ default type Data2 = * const [ u8 ; 0 ] ;
22
+ }
23
+
24
+ impl Smartass for ( ) {
25
+ type Data2 = * const [ u8 ; 1 ] ;
26
+ }
27
+
28
+ impl Smartass for dyn MaybeObjectSafe {
29
+ type Data = * const [ u8 ] ;
30
+ type Data2 = * const [ u8 ; 0 ] ;
31
+ }
32
+
33
+ impl < U : Smartass +?Sized , T : Smartass +?Sized > CoerceUnsized < SmartassPtr < T > > for SmartassPtr < U >
34
+ where <U as Smartass >:: Data : std:: ops:: CoerceUnsized < <T as Smartass >:: Data >
35
+ { }
36
+
37
+ pub fn conv ( s : SmartassPtr < ( ) > ) -> SmartassPtr < dyn MaybeObjectSafe > {
38
+ s // This shouldn't coerce
39
+ }
You can’t perform that action at this time.
0 commit comments