@@ -151,6 +151,22 @@ pub trait Resolver {
151
151
/// We must keep the set of definitions up to date as we add nodes that weren't in the AST.
152
152
/// This should only return `None` during testing.
153
153
fn definitions ( & mut self ) -> & mut Definitions ;
154
+
155
+ /// Given suffix ["b","c","d"], returns path `::cratename::b::c::d` when
156
+ /// The path is also resolved according to `is_value`.
157
+ fn std_path ( & mut self , span : Span , crate_root : Option < & str > ,
158
+ components : & [ & str ] , is_value : bool ) -> hir:: Path {
159
+ let mut path = hir:: Path {
160
+ span,
161
+ def : Def :: Err ,
162
+ segments : iter:: once ( keywords:: CrateRoot . name ( ) ) . chain ( {
163
+ crate_root. into_iter ( ) . chain ( components. iter ( ) . cloned ( ) ) . map ( Symbol :: intern)
164
+ } ) . map ( hir:: PathSegment :: from_name) . collect ( ) ,
165
+ } ;
166
+
167
+ self . resolve_hir_path ( & mut path, is_value) ;
168
+ path
169
+ }
154
170
}
155
171
156
172
#[ derive( Clone , Copy , Debug ) ]
@@ -3625,16 +3641,7 @@ impl<'a> LoweringContext<'a> {
3625
3641
/// `fld.cx.use_std`, and `::core::b::c::d` otherwise.
3626
3642
/// The path is also resolved according to `is_value`.
3627
3643
fn std_path ( & mut self , span : Span , components : & [ & str ] , is_value : bool ) -> hir:: Path {
3628
- let mut path = hir:: Path {
3629
- span,
3630
- def : Def :: Err ,
3631
- segments : iter:: once ( keywords:: CrateRoot . name ( ) ) . chain ( {
3632
- self . crate_root . into_iter ( ) . chain ( components. iter ( ) . cloned ( ) ) . map ( Symbol :: intern)
3633
- } ) . map ( hir:: PathSegment :: from_name) . collect ( ) ,
3634
- } ;
3635
-
3636
- self . resolver . resolve_hir_path ( & mut path, is_value) ;
3637
- path
3644
+ self . resolver . std_path ( span, self . crate_root , components, is_value)
3638
3645
}
3639
3646
3640
3647
fn signal_block_expr ( & mut self ,
0 commit comments