File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
compiler/rustc_builtin_macros/src/deriving Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -356,21 +356,14 @@ fn contains_maybe_sized_bound(bounds: &[GenericBound]) -> bool {
356356 bounds. iter ( ) . any ( is_maybe_sized_bound)
357357}
358358
359- fn path_segment_is_exact_match ( path_segments : & [ ast:: PathSegment ] , syms : & [ Symbol ] ) -> bool {
360- path_segments. iter ( ) . zip ( syms) . all ( |( segment, & symbol) | segment. ident . name == symbol)
361- }
362-
363359fn is_sized_marker ( path : & ast:: Path ) -> bool {
364360 const CORE_UNSIZE : [ Symbol ; 3 ] = [ sym:: core, sym:: marker, sym:: Sized ] ;
365361 const STD_UNSIZE : [ Symbol ; 3 ] = [ sym:: std, sym:: marker, sym:: Sized ] ;
366- if path. segments . len ( ) == 4 && path. is_global ( ) {
367- path_segment_is_exact_match ( & path. segments [ 1 ..] , & CORE_UNSIZE )
368- || path_segment_is_exact_match ( & path. segments [ 1 ..] , & STD_UNSIZE )
369- } else if path. segments . len ( ) == 3 {
370- path_segment_is_exact_match ( & path. segments , & CORE_UNSIZE )
371- || path_segment_is_exact_match ( & path. segments , & STD_UNSIZE )
362+ let segments = || path. segments . iter ( ) . map ( |segment| segment. ident . name ) ;
363+ if path. is_global ( ) {
364+ segments ( ) . skip ( 1 ) . eq ( CORE_UNSIZE ) || segments ( ) . skip ( 1 ) . eq ( STD_UNSIZE )
372365 } else {
373- * path == sym:: Sized
366+ segments ( ) . eq ( CORE_UNSIZE ) || segments ( ) . eq ( STD_UNSIZE ) || * path == sym:: Sized
374367 }
375368}
376369
You can’t perform that action at this time.
0 commit comments