File tree Expand file tree Collapse file tree
compiler/rustc_hir_analysis/src
tests/ui/delegation/generics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -572,17 +572,15 @@ fn get_delegation_user_specified_args<'tcx>(
572572 . opt_delegation_generics ( )
573573 . expect ( "Lowering delegation" ) ;
574574
575- let get_segment = |hir_id : HirId | -> ( & ' tcx PathSegment < ' tcx > , DefId ) {
575+ let get_segment = |hir_id : HirId | -> Option < ( & ' tcx PathSegment < ' tcx > , DefId ) > {
576576 let segment = tcx. hir_node ( hir_id) . expect_path_segment ( ) ;
577- let def_id = segment. res . def_id ( ) ;
578-
579- ( segment, def_id)
577+ segment. res . opt_def_id ( ) . map ( |def_id| ( segment, def_id) )
580578 } ;
581579
582580 let ctx = ItemCtxt :: new ( tcx, delegation_id) ;
583581 let lowerer = ctx. lowerer ( ) ;
584582
585- let parent_args = info. parent_args_segment_id . map ( get_segment) . map ( |( segment, def_id) | {
583+ let parent_args = info. parent_args_segment_id . and_then ( get_segment) . map ( |( segment, def_id) | {
586584 let self_ty = get_delegation_self_ty ( tcx, delegation_id) ;
587585
588586 lowerer
@@ -598,7 +596,7 @@ fn get_delegation_user_specified_args<'tcx>(
598596 . as_slice ( )
599597 } ) ;
600598
601- let child_args = info. child_args_segment_id . map ( get_segment) . map ( |( segment, def_id) | {
599+ let child_args = info. child_args_segment_id . and_then ( get_segment) . map ( |( segment, def_id) | {
602600 let parent_args = if let Some ( parent_args) = parent_args {
603601 parent_args
604602 } else {
Original file line number Diff line number Diff line change 1+ #![ feature( fn_delegation) ]
2+ #![ allow( incomplete_features) ]
3+
4+ trait Trait {
5+ fn bar ( ) ;
6+ }
7+
8+ impl Trait for ( ) {
9+ reuse missing:: <> as bar;
10+ //~^ ERROR: cannot find function `missing` in this scope
11+ }
12+
13+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0425]: cannot find function `missing` in this scope
2+ --> $DIR/unresolved-segment-ice-153389.rs:9:11
3+ |
4+ LL | reuse missing::<> as bar;
5+ | ^^^^^^^ not found in this scope
6+
7+ error: aborting due to 1 previous error
8+
9+ For more information about this error, try `rustc --explain E0425`.
You can’t perform that action at this time.
0 commit comments