@@ -14,20 +14,20 @@ use rustc::session::{Session, CrateDisambiguator};
1414use rustc:: session:: config:: { Sanitizer , self } ;
1515use rustc_target:: spec:: { PanicStrategy , TargetTriple } ;
1616use rustc:: session:: search_paths:: PathKind ;
17- use rustc:: middle:: cstore:: { CrateSource , ExternCrate , ExternCrateSource , MetadataLoader } ;
17+ use rustc:: middle:: cstore:: { CrateSource , ExternCrate , ExternCrateSource } ;
1818use rustc:: util:: common:: record_time;
1919use rustc:: util:: nodemap:: FxHashSet ;
2020use rustc:: hir:: map:: Definitions ;
2121use rustc:: hir:: def_id:: LOCAL_CRATE ;
2222
23- use std:: path:: { Path , PathBuf } ;
23+ use std:: path:: Path ;
2424use std:: { cmp, fs} ;
2525
2626use syntax:: ast;
2727use syntax:: attr;
2828use syntax_expand:: allocator:: { global_allocator_spans, AllocatorKind } ;
2929use syntax:: symbol:: { Symbol , sym} ;
30- use syntax:: { span_err , span_fatal} ;
30+ use syntax:: span_fatal;
3131use syntax_pos:: { Span , DUMMY_SP } ;
3232use log:: { debug, info, log_enabled} ;
3333use proc_macro:: bridge:: client:: ProcMacro ;
@@ -471,62 +471,7 @@ impl<'a> CrateLoader<'a> {
471471 self . resolve_crate ( dep. name , span, dep_kind, Some ( ( root, & dep) ) ) . 0
472472 } ) ) . collect ( )
473473 }
474- }
475-
476- fn read_extension_crate (
477- sess : & Session ,
478- metadata_loader : & dyn MetadataLoader ,
479- name : Symbol ,
480- span : Span ,
481- ) -> ( Library , bool ) {
482- info ! ( "read extension crate `{}`" , name) ;
483- let target_triple = sess. opts . target_triple . clone ( ) ;
484- let host_triple = TargetTriple :: from_triple ( config:: host_triple ( ) ) ;
485- let is_cross = target_triple != host_triple;
486- let mut target_only = false ;
487- let mut locate_ctxt = locator:: Context {
488- sess,
489- span,
490- crate_name : name,
491- hash : None ,
492- extra_filename : None ,
493- filesearch : sess. host_filesearch ( PathKind :: Crate ) ,
494- target : & sess. host ,
495- triple : host_triple,
496- root : None ,
497- rejected_via_hash : vec ! [ ] ,
498- rejected_via_triple : vec ! [ ] ,
499- rejected_via_kind : vec ! [ ] ,
500- rejected_via_version : vec ! [ ] ,
501- rejected_via_filename : vec ! [ ] ,
502- should_match_name : true ,
503- is_proc_macro : None ,
504- metadata_loader,
505- } ;
506-
507- let library = locate_ctxt. maybe_load_library_crate ( ) . or_else ( || {
508- if !is_cross {
509- return None
510- }
511- // Try loading from target crates. This will abort later if we
512- // try to load a plugin registrar function,
513- target_only = true ;
514-
515- locate_ctxt. target = & sess. target . target ;
516- locate_ctxt. triple = target_triple;
517- locate_ctxt. filesearch = sess. target_filesearch ( PathKind :: Crate ) ;
518-
519- locate_ctxt. maybe_load_library_crate ( )
520- } ) ;
521- let library = match library {
522- Some ( l) => l,
523- None => locate_ctxt. report_errs ( ) ,
524- } ;
525474
526- ( library, target_only)
527- }
528-
529- impl < ' a > CrateLoader < ' a > {
530475 fn dlsym_proc_macros ( & self ,
531476 path : & Path ,
532477 disambiguator : CrateDisambiguator ,
@@ -557,44 +502,7 @@ impl<'a> CrateLoader<'a> {
557502
558503 decls
559504 }
560- }
561-
562- /// Look for a plugin registrar. Returns library path, crate
563- /// SVH and DefIndex of the registrar function.
564- pub fn find_plugin_registrar ( sess : & Session ,
565- metadata_loader : & dyn MetadataLoader ,
566- span : Span ,
567- name : Symbol )
568- -> Option < ( PathBuf , CrateDisambiguator ) > {
569- let ( library, target_only) = read_extension_crate ( sess, metadata_loader, name, span) ;
570-
571- if target_only {
572- // Need to abort before syntax expansion.
573- let message = format ! ( "plugin `{}` is not available for triple `{}` \
574- (only found {})",
575- name,
576- config:: host_triple( ) ,
577- sess. opts. target_triple) ;
578- span_fatal ! ( sess, span, E0456 , "{}" , & message) ;
579- }
580-
581- match library. source . dylib {
582- Some ( dylib) => {
583- Some ( ( dylib. 0 , library. metadata . get_root ( ) . disambiguator ) )
584- }
585- None => {
586- span_err ! ( sess, span, E0457 ,
587- "plugin `{}` only found in rlib format, but must be available \
588- in dylib format",
589- name) ;
590- // No need to abort because the loading code will just ignore this
591- // empty dylib.
592- None
593- }
594- }
595- }
596505
597- impl < ' a > CrateLoader < ' a > {
598506 fn inject_panic_runtime ( & self , krate : & ast:: Crate ) {
599507 // If we're only compiling an rlib, then there's no need to select a
600508 // panic runtime, so we just skip this section entirely.
0 commit comments