File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
src/test/ui/specialization Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ crate_type = "lib" ]
2
+ #![ feature( specialization) ]
3
+ #![ feature( unsize, coerce_unsized) ]
4
+ #![ allow( incomplete_features) ]
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 = ( ) ;
22
+ //~^ ERROR: the trait bound `(): std::ops::CoerceUnsized<*const [u8]>` is not satisfied
23
+ }
24
+
25
+ impl Smartass for ( ) {
26
+ type Data2 = * const [ u8 ; 1 ] ;
27
+ }
28
+
29
+ impl Smartass for dyn MaybeObjectSafe {
30
+ type Data = * const [ u8 ] ;
31
+ type Data2 = * const [ u8 ; 0 ] ;
32
+ }
33
+
34
+ impl < U : Smartass +?Sized , T : Smartass +?Sized > CoerceUnsized < SmartassPtr < T > > for SmartassPtr < U >
35
+ where <U as Smartass >:: Data : std:: ops:: CoerceUnsized < <T as Smartass >:: Data >
36
+ { }
37
+
38
+ pub fn conv ( s : SmartassPtr < ( ) > ) -> SmartassPtr < dyn MaybeObjectSafe > {
39
+ s
40
+ }
Original file line number Diff line number Diff line change
1
+ error[E0277]: the trait bound `(): std::ops::CoerceUnsized<*const [u8]>` is not satisfied
2
+ --> $DIR/issue-44861.rs:21:5
3
+ |
4
+ LL | type Data2: CoerceUnsized<*const [u8]>;
5
+ | --------------------------------------- required by `Smartass::Data2`
6
+ ...
7
+ LL | default type Data2 = ();
8
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::CoerceUnsized<*const [u8]>` is not implemented for `()`
9
+
10
+ error: aborting due to previous error
11
+
12
+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments