File tree 2 files changed +8
-7
lines changed 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use std::collections::BTreeMap;
13
13
use std:: env:: { self , remove_var, set_var, var_os} ;
14
14
use std:: ffi:: { OsStr , OsString } ;
15
15
use std:: fs;
16
- use std:: path:: { Path , PathBuf } ;
16
+ use std:: path:: Path ;
17
17
use std:: sync:: LazyLock ;
18
18
use test_utils:: IS_RUSTC_TEST_SUITE ;
19
19
@@ -124,10 +124,9 @@ fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
124
124
OutputConflictHandling :: Error ( "cargo uibless" . into ( ) )
125
125
} ,
126
126
target : None ,
127
- out_dir : PathBuf :: from ( std:: env:: var_os ( "CARGO_TARGET_DIR" ) . unwrap_or ( "target" . into ( ) ) )
128
- . join ( "ui_test" )
129
- . canonicalize ( )
130
- . unwrap ( ) ,
127
+ out_dir : fs:: canonicalize ( std:: env:: var_os ( "CARGO_TARGET_DIR" ) . unwrap_or ( "target" . into ( ) ) )
128
+ . unwrap ( )
129
+ . join ( "ui_test" ) ,
131
130
..compiletest:: Config :: rustc ( Path :: new ( "tests" ) . join ( test_dir) )
132
131
} ;
133
132
@@ -323,7 +322,9 @@ fn run_ui_cargo() {
323
322
|path, _args| test_filter ( path) && path. ends_with ( "Cargo.toml" ) ,
324
323
|config, path| {
325
324
let mut config = config. clone ( ) ;
326
- config. out_dir = PathBuf :: from ( "target/ui_test_cargo/" ) . join ( path. parent ( ) . unwrap ( ) ) ;
325
+ config. out_dir = fs:: canonicalize ( "target/ui_test_cargo/" )
326
+ . unwrap ( )
327
+ . join ( path. parent ( ) . unwrap ( ) ) ;
327
328
Some ( config)
328
329
} ,
329
330
if quiet {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ fn old_test_headers() {
16
16
continue ;
17
17
}
18
18
19
- let file = fs:: read_to_string ( entry. path ( ) ) . unwrap ( ) ;
19
+ let file = fs:: read_to_string ( entry. path ( ) ) . unwrap_or_else ( |err| panic ! ( "{}: {err}" , entry . path ( ) . display ( ) ) ) ;
20
20
21
21
if let Some ( header) = old_headers. find ( & file) {
22
22
println ! ( "Found header `{}` in {}" , header. as_str( ) , entry. path( ) . display( ) ) ;
You can’t perform that action at this time.
0 commit comments