File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -1142,8 +1142,7 @@ impl<'gctx> Workspace<'gctx> {
1142
1142
MaybePackage :: Package ( ref p) => p. clone ( ) ,
1143
1143
MaybePackage :: Virtual ( _) => continue ,
1144
1144
} ;
1145
- let mut src = PathSource :: new ( pkg. root ( ) , pkg. package_id ( ) . source_id ( ) , self . gctx ) ;
1146
- src. preload_with ( pkg) ;
1145
+ let src = PathSource :: preload_with ( pkg, self . gctx ) ;
1147
1146
registry. add_preloaded ( Box :: new ( src) ) ;
1148
1147
}
1149
1148
}
Original file line number Diff line number Diff line change @@ -54,11 +54,16 @@ impl<'gctx> PathSource<'gctx> {
54
54
55
55
/// Preloads a package for this source. The source is assumed that it has
56
56
/// yet loaded any other packages.
57
- pub fn preload_with ( & mut self , pkg : Package ) {
58
- assert ! ( !self . updated) ;
59
- assert ! ( self . packages. is_empty( ) ) ;
60
- self . updated = true ;
61
- self . packages . push ( pkg) ;
57
+ pub fn preload_with ( pkg : Package , gctx : & ' gctx GlobalContext ) -> Self {
58
+ let source_id = pkg. package_id ( ) . source_id ( ) ;
59
+ let path = pkg. root ( ) . to_owned ( ) ;
60
+ Self {
61
+ source_id,
62
+ path,
63
+ updated : true ,
64
+ packages : vec ! [ pkg] ,
65
+ gctx,
66
+ }
62
67
}
63
68
64
69
/// Gets the package on the root path.
You can’t perform that action at this time.
0 commit comments