@@ -14,20 +14,20 @@ use rustc::session::{Session, CrateDisambiguator};
14
14
use rustc:: session:: config:: { Sanitizer , self } ;
15
15
use rustc_target:: spec:: { PanicStrategy , TargetTriple } ;
16
16
use rustc:: session:: search_paths:: PathKind ;
17
- use rustc:: middle:: cstore:: { CrateSource , ExternCrate , ExternCrateSource , MetadataLoader } ;
17
+ use rustc:: middle:: cstore:: { CrateSource , ExternCrate , ExternCrateSource } ;
18
18
use rustc:: util:: common:: record_time;
19
19
use rustc:: util:: nodemap:: FxHashSet ;
20
20
use rustc:: hir:: map:: Definitions ;
21
21
use rustc:: hir:: def_id:: LOCAL_CRATE ;
22
22
23
- use std:: path:: { Path , PathBuf } ;
23
+ use std:: path:: Path ;
24
24
use std:: { cmp, fs} ;
25
25
26
26
use syntax:: ast;
27
27
use syntax:: attr;
28
28
use syntax_expand:: allocator:: { global_allocator_spans, AllocatorKind } ;
29
29
use syntax:: symbol:: { Symbol , sym} ;
30
- use syntax:: { span_err , span_fatal} ;
30
+ use syntax:: span_fatal;
31
31
use syntax_pos:: { Span , DUMMY_SP } ;
32
32
use log:: { debug, info, log_enabled} ;
33
33
use proc_macro:: bridge:: client:: ProcMacro ;
@@ -471,62 +471,7 @@ impl<'a> CrateLoader<'a> {
471
471
self . resolve_crate ( dep. name , span, dep_kind, Some ( ( root, & dep) ) ) . 0
472
472
} ) ) . collect ( )
473
473
}
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
- } ;
525
474
526
- ( library, target_only)
527
- }
528
-
529
- impl < ' a > CrateLoader < ' a > {
530
475
fn dlsym_proc_macros ( & self ,
531
476
path : & Path ,
532
477
disambiguator : CrateDisambiguator ,
@@ -557,44 +502,7 @@ impl<'a> CrateLoader<'a> {
557
502
558
503
decls
559
504
}
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
- }
596
505
597
- impl < ' a > CrateLoader < ' a > {
598
506
fn inject_panic_runtime ( & self , krate : & ast:: Crate ) {
599
507
// If we're only compiling an rlib, then there's no need to select a
600
508
// panic runtime, so we just skip this section entirely.
0 commit comments