@@ -21,7 +21,7 @@ use rustc_session::config::{self, CrateType, ExternLocation};
2121use rustc_session:: lint:: { self , BuiltinLintDiagnostics , ExternDepSpec } ;
2222use rustc_session:: output:: validate_crate_name;
2323use rustc_session:: search_paths:: PathKind ;
24- use rustc_session:: { CrateDisambiguator , Session } ;
24+ use rustc_session:: Session ;
2525use rustc_span:: edition:: Edition ;
2626use rustc_span:: symbol:: { sym, Symbol } ;
2727use rustc_span:: { Span , DUMMY_SP } ;
@@ -222,10 +222,8 @@ impl<'a> CrateLoader<'a> {
222222 metadata_loader : Box < MetadataLoaderDyn > ,
223223 local_crate_name : & str ,
224224 ) -> Self {
225- let local_crate_stable_id =
226- StableCrateId :: new ( local_crate_name, sess. local_crate_disambiguator ( ) ) ;
227225 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 ) ;
229227
230228 CrateLoader {
231229 sess,
@@ -327,17 +325,14 @@ impl<'a> CrateLoader<'a> {
327325
328326 fn verify_no_symbol_conflicts ( & self , root : & CrateRoot < ' _ > ) -> Result < ( ) , CrateError > {
329327 // 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 ( ) {
333329 return Err ( CrateError :: SymbolConflictsCurrent ( root. name ( ) ) ) ;
334330 }
335331
336332 // Check for conflicts with any crate loaded so far
337333 let mut res = Ok ( ( ) ) ;
338334 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
341336 other. hash ( ) != root. hash ( )
342337 {
343338 // but different SVH
@@ -411,7 +406,7 @@ impl<'a> CrateLoader<'a> {
411406 None => ( & source, & crate_root) ,
412407 } ;
413408 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 ( ) ) ?)
415410 } else {
416411 None
417412 } ;
@@ -664,7 +659,7 @@ impl<'a> CrateLoader<'a> {
664659 fn dlsym_proc_macros (
665660 & self ,
666661 path : & Path ,
667- disambiguator : CrateDisambiguator ,
662+ stable_crate_id : StableCrateId ,
668663 ) -> Result < & ' static [ ProcMacro ] , CrateError > {
669664 // Make sure the path contains a / or the linker will search for it.
670665 let path = env:: current_dir ( ) . unwrap ( ) . join ( path) ;
@@ -673,7 +668,7 @@ impl<'a> CrateLoader<'a> {
673668 Err ( s) => return Err ( CrateError :: DlOpen ( s) ) ,
674669 } ;
675670
676- let sym = self . sess . generate_proc_macro_decls_symbol ( disambiguator ) ;
671+ let sym = self . sess . generate_proc_macro_decls_symbol ( stable_crate_id ) ;
677672 let decls = unsafe {
678673 let sym = match lib. symbol ( & sym) {
679674 Ok ( f) => f,
0 commit comments