File tree Expand file tree Collapse file tree 2 files changed +60
-2
lines changed Expand file tree Collapse file tree 2 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -118,4 +118,33 @@ fn bad_trait_object(arg0: &(dyn Any + Send)) {
118118 unimplemented!();
119119}
120120
121- fn main() {}
121+ trait Proj {
122+ type S;
123+ }
124+
125+ impl Proj for () {
126+ type S = ();
127+ }
128+
129+ impl Proj for i32 {
130+ type S = i32;
131+ }
132+
133+ trait Base<T> {
134+ fn is_base(&self);
135+ }
136+
137+ trait Derived<B: Proj>: Base<B::S> + Base<()> {
138+ fn is_derived(&self);
139+ }
140+
141+ fn f<P: Proj>(obj: &dyn Derived<P>) {
142+ obj.is_derived();
143+ Base::<P::S>::is_base(obj);
144+ Base::<()>::is_base(obj);
145+ }
146+
147+ fn main() {
148+ let _x: fn(_) = f::<()>;
149+ let _x: fn(_) = f::<i32>;
150+ }
Original file line number Diff line number Diff line change @@ -118,4 +118,33 @@ fn bad_trait_object(arg0: &(dyn Any + Send + Send)) {
118118 unimplemented ! ( ) ;
119119}
120120
121- fn main ( ) { }
121+ trait Proj {
122+ type S ;
123+ }
124+
125+ impl Proj for ( ) {
126+ type S = ( ) ;
127+ }
128+
129+ impl Proj for i32 {
130+ type S = i32 ;
131+ }
132+
133+ trait Base < T > {
134+ fn is_base ( & self ) ;
135+ }
136+
137+ trait Derived < B : Proj > : Base < B :: S > + Base < ( ) > {
138+ fn is_derived ( & self ) ;
139+ }
140+
141+ fn f < P : Proj > ( obj : & dyn Derived < P > ) {
142+ obj. is_derived ( ) ;
143+ Base :: < P :: S > :: is_base ( obj) ;
144+ Base :: < ( ) > :: is_base ( obj) ;
145+ }
146+
147+ fn main ( ) {
148+ let _x: fn ( _) = f :: < ( ) > ;
149+ let _x: fn ( _) = f :: < i32 > ;
150+ }
You can’t perform that action at this time.
0 commit comments