@@ -21,7 +21,7 @@ use rustc_session::config::{self, CrateType, ExternLocation};
21
21
use rustc_session:: lint:: { self , BuiltinLintDiagnostics , ExternDepSpec } ;
22
22
use rustc_session:: output:: validate_crate_name;
23
23
use rustc_session:: search_paths:: PathKind ;
24
- use rustc_session:: { CrateDisambiguator , Session } ;
24
+ use rustc_session:: Session ;
25
25
use rustc_span:: edition:: Edition ;
26
26
use rustc_span:: symbol:: { sym, Symbol } ;
27
27
use rustc_span:: { Span , DUMMY_SP } ;
@@ -222,10 +222,8 @@ impl<'a> CrateLoader<'a> {
222
222
metadata_loader : Box < MetadataLoaderDyn > ,
223
223
local_crate_name : & str ,
224
224
) -> Self {
225
- let local_crate_stable_id =
226
- StableCrateId :: new ( local_crate_name, sess. local_crate_disambiguator ( ) ) ;
227
225
let mut stable_crate_ids = FxHashMap :: default ( ) ;
228
- stable_crate_ids. insert ( local_crate_stable_id , LOCAL_CRATE ) ;
226
+ stable_crate_ids. insert ( sess . local_stable_crate_id ( ) , LOCAL_CRATE ) ;
229
227
230
228
CrateLoader {
231
229
sess,
@@ -327,17 +325,14 @@ impl<'a> CrateLoader<'a> {
327
325
328
326
fn verify_no_symbol_conflicts ( & self , root : & CrateRoot < ' _ > ) -> Result < ( ) , CrateError > {
329
327
// Check for (potential) conflicts with the local crate
330
- if self . local_crate_name == root. name ( )
331
- && self . sess . local_crate_disambiguator ( ) == root. disambiguator ( )
332
- {
328
+ if self . sess . local_stable_crate_id ( ) == root. stable_crate_id ( ) {
333
329
return Err ( CrateError :: SymbolConflictsCurrent ( root. name ( ) ) ) ;
334
330
}
335
331
336
332
// Check for conflicts with any crate loaded so far
337
333
let mut res = Ok ( ( ) ) ;
338
334
self . cstore . iter_crate_data ( |_, other| {
339
- if other. name ( ) == root. name ( ) && // same crate-name
340
- other. disambiguator ( ) == root. disambiguator ( ) && // same crate-disambiguator
335
+ if other. stable_crate_id ( ) == root. stable_crate_id ( ) && // same stable crate id
341
336
other. hash ( ) != root. hash ( )
342
337
{
343
338
// but different SVH
@@ -411,7 +406,7 @@ impl<'a> CrateLoader<'a> {
411
406
None => ( & source, & crate_root) ,
412
407
} ;
413
408
let dlsym_dylib = dlsym_source. dylib . as_ref ( ) . expect ( "no dylib for a proc-macro crate" ) ;
414
- Some ( self . dlsym_proc_macros ( & dlsym_dylib. 0 , dlsym_root. disambiguator ( ) ) ?)
409
+ Some ( self . dlsym_proc_macros ( & dlsym_dylib. 0 , dlsym_root. stable_crate_id ( ) ) ?)
415
410
} else {
416
411
None
417
412
} ;
@@ -664,7 +659,7 @@ impl<'a> CrateLoader<'a> {
664
659
fn dlsym_proc_macros (
665
660
& self ,
666
661
path : & Path ,
667
- disambiguator : CrateDisambiguator ,
662
+ stable_crate_id : StableCrateId ,
668
663
) -> Result < & ' static [ ProcMacro ] , CrateError > {
669
664
// Make sure the path contains a / or the linker will search for it.
670
665
let path = env:: current_dir ( ) . unwrap ( ) . join ( path) ;
@@ -673,7 +668,7 @@ impl<'a> CrateLoader<'a> {
673
668
Err ( s) => return Err ( CrateError :: DlOpen ( s) ) ,
674
669
} ;
675
670
676
- let sym = self . sess . generate_proc_macro_decls_symbol ( disambiguator ) ;
671
+ let sym = self . sess . generate_proc_macro_decls_symbol ( stable_crate_id ) ;
677
672
let decls = unsafe {
678
673
let sym = match lib. symbol ( & sym) {
679
674
Ok ( f) => f,
0 commit comments