File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -258,8 +258,20 @@ fn setup(subcommand: MiriCommand) {
258
258
// Determine where the rust sources are located. `XARGO_RUST_SRC` env var trumps everything.
259
259
let rust_src = match std:: env:: var_os ( "XARGO_RUST_SRC" ) {
260
260
Some ( val) => {
261
- let val = PathBuf :: from ( val) ;
262
- val. canonicalize ( ) . unwrap_or ( val)
261
+ let path = PathBuf :: from ( val) ;
262
+ let path = path. canonicalize ( ) . unwrap_or ( path) ;
263
+
264
+ // On Windows, this produces a path starting with `\\?\`, which xargo cannot deal with.
265
+ // Strip that prefix; the resulting path should still be valid.
266
+ #[ cfg( windows) ]
267
+ let path = {
268
+ let str = path. into_os_string ( ) . into_string ( )
269
+ . expect ( "non-unicode paths are currently not supported" ) ;
270
+ let str = str. strip_prefix ( r"\\?\" ) . map ( String :: from) . unwrap_or ( str) ;
271
+ PathBuf :: from ( str)
272
+ } ;
273
+
274
+ path
263
275
}
264
276
None => {
265
277
// Check for `rust-src` rustup component.
You can’t perform that action at this time.
0 commit comments