File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -235,8 +235,20 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
235
235
"auto traits cannot have generics" ) ;
236
236
}
237
237
if !bounds. is_empty ( ) {
238
- self . err_handler ( ) . span_err ( item. span ,
239
- "auto traits cannot have super traits" ) ;
238
+ let all_bounds_are_maybe = bounds. iter ( )
239
+ . all ( |bound| {
240
+ match * bound {
241
+ TraitTyParamBound ( _, TraitBoundModifier :: Maybe ) => true ,
242
+ _ => false
243
+ }
244
+ } ) ;
245
+
246
+ // allow `?DynSized` bound, since the `DynSized` bound is implicit
247
+ // for traits
248
+ if !all_bounds_are_maybe {
249
+ self . err_handler ( ) . span_err ( item. span ,
250
+ "auto traits cannot have super traits" ) ;
251
+ }
240
252
}
241
253
if !trait_items. is_empty ( ) {
242
254
self . err_handler ( ) . span_err ( item. span ,
You can’t perform that action at this time.
0 commit comments