File tree 3 files changed +8
-9
lines changed
3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
#![ allow( rustc:: bad_opt_access) ]
2
- use std:: collections:: { BTreeMap , BTreeSet } ;
2
+ use std:: collections:: BTreeMap ;
3
3
use std:: num:: NonZero ;
4
- use std:: path:: { Path , PathBuf } ;
4
+ use std:: path:: PathBuf ;
5
5
use std:: sync:: atomic:: AtomicBool ;
6
6
7
7
use rustc_abi:: Align ;
89
89
S : Into < String > ,
90
90
I : IntoIterator < Item = S > ,
91
91
{
92
- let locations: BTreeSet < CanonicalizedPath > =
93
- locations. into_iter ( ) . map ( |s| CanonicalizedPath :: new ( Path :: new ( & s. into ( ) ) ) ) . collect ( ) ;
92
+ let locations =
93
+ locations. into_iter ( ) . map ( |s| CanonicalizedPath :: new ( PathBuf :: from ( s. into ( ) ) ) ) . collect ( ) ;
94
94
95
95
ExternEntry {
96
96
location : ExternLocation :: ExactPaths ( locations) ,
Original file line number Diff line number Diff line change @@ -2323,14 +2323,13 @@ pub fn parse_externs(
2323
2323
let ExternOpt { crate_name : name, path, options } =
2324
2324
split_extern_opt ( early_dcx, unstable_opts, & arg) . unwrap_or_else ( |e| e. emit ( ) ) ;
2325
2325
2326
- let path = path. map ( |p| CanonicalizedPath :: new ( p. as_path ( ) ) ) ;
2327
-
2328
2326
let entry = externs. entry ( name. to_owned ( ) ) ;
2329
2327
2330
2328
use std:: collections:: btree_map:: Entry ;
2331
2329
2332
2330
let entry = if let Some ( path) = path {
2333
2331
// --extern prelude_name=some_file.rlib
2332
+ let path = CanonicalizedPath :: new ( path) ;
2334
2333
match entry {
2335
2334
Entry :: Vacant ( vacant) => {
2336
2335
let files = BTreeSet :: from_iter ( iter:: once ( path) ) ;
Original file line number Diff line number Diff line change 1
- use std:: path:: { Path , PathBuf } ;
1
+ use std:: path:: PathBuf ;
2
2
use std:: sync:: OnceLock ;
3
3
4
4
use rustc_data_structures:: profiling:: VerboseTimingGuard ;
@@ -104,8 +104,8 @@ pub struct CanonicalizedPath {
104
104
}
105
105
106
106
impl CanonicalizedPath {
107
- pub fn new ( path : & Path ) -> Self {
108
- Self { original : path . to_owned ( ) , canonicalized : try_canonicalize ( path) . ok ( ) }
107
+ pub fn new ( path : PathBuf ) -> Self {
108
+ Self { canonicalized : try_canonicalize ( & path) . ok ( ) , original : path }
109
109
}
110
110
111
111
pub fn canonicalized ( & self ) -> & PathBuf {
You can’t perform that action at this time.
0 commit comments