pub fn find_plugin_registrar(&mut self, span: Span, name: &str)
                                 -> Option<(PathBuf, Svh, DefIndex)> {
        let ekrate = self.read_extension_crate(span, &CrateInfo {
             name: name.to_string(),
             ident: name.to_string(),
             id: ast::DUMMY_NODE_ID,
             should_link: false,
        });

        if ekrate.target_only {
            // Need to abort before syntax expansion.
            let message = format!("plugin `{}` is not available for triple `{}` \
                                   (only found {})",
                                  name,
                                  config::host_triple(),
                                  self.sess.opts.target_triple);
            span_fatal!(self.sess, span, E0456, "{}", &message[..]);
        }

        let svh = decoder::get_crate_hash(ekrate.metadata.as_slice());
        let registrar =
            decoder::get_plugin_registrar_fn(ekrate.metadata.as_slice());

        match (ekrate.dylib.as_ref(), registrar) {
            (Some(dylib), Some(reg)) => {
                Some((dylib.to_path_buf(), svh, reg))
            }
            (None, Some(_)) => {
                span_err!(self.sess, span, E0457,
                          "plugin `{}` only found in rlib format, but must be available \
                           in dylib format",
                          name);
                // No need to abort because the loading code will just ignore this
                // empty dylib.
                None
            }
            _ => None,
        }
    }
/// Look for a plugin registrar. Returns library path, crate
/// SVH and DefIndex of the registrar function.
Look for a plugin registrar. Returns library path, crate
SVH and DefIndex of the registrar function.
Look for a plugin registrar . Returns library path crate SVH and DefIndex of the registrar function .
pub fn find_plugin_registrar(&mut self, span: Span, name: &str)
                                 -> Option<(PathBuf, Svh, DefIndex)> {
        let ekrate = self.read_extension_crate(span, &CrateInfo {
             name: name.to_string(),
             ident: name.to_string(),
             id: ast::DUMMY_NODE_ID,
             should_link: false,
        });
        if ekrate.target_only {
            // Need to abort before syntax expansion.
            let message = format!("plugin `{}` is not available for triple `{}` \
                                   (only found {})",
                                  name,
                                  config::host_triple(),
                                  self.sess.opts.target_triple);
            span_fatal!(self.sess, span, E0456, "{}", &message[..]);
        }
        let svh = decoder::get_crate_hash(ekrate.metadata.as_slice());
        let registrar =
            decoder::get_plugin_registrar_fn(ekrate.metadata.as_slice());
        match (ekrate.dylib.as_ref(), registrar) {
            (Some(dylib), Some(reg)) => {
                Some((dylib.to_path_buf(), svh, reg))
            }
            (None, Some(_)) => {
                span_err!(self.sess, span, E0457,
                          "plugin `{}` only found in rlib format, but must be available \
                           in dylib format",
                          name);
                // No need to abort because the loading code will just ignore this
                // empty dylib.
                None
            }
            _ => None,
        }
    }
pub fn find_plugin_registrar ( & mut self , span : Span , name : & str ) -> Option < ( PathBuf , Svh , DefIndex ) > { let ekrate = self . read_extension_crate ( span , & CrateInfo { name : name . to_string ( ) , ident : name . to_string ( ) , id : ast :: DUMMY_NODE_ID , should_link : false , } ) ; if ekrate . target_only { // Need to abort before syntax expansion. let message = format ! ( " \
 " name config host_triple ( ) self sess opts target_triple ) ; span_fatal ! ( self sess span E0456 " " message [ ] ) ; } let svh = decoder :: get_crate_hash ( ekrate . metadata . as_slice ( ) ) ; let registrar = decoder :: get_plugin_registrar_fn ( ekrate . metadata . as_slice ( ) ) ; match ( ekrate . dylib . as_ref ( ) , registrar ) { ( Some ( dylib ) , Some ( reg ) ) => { Some ( ( dylib . to_path_buf ( ) , svh , reg ) ) } ( None , Some ( _ ) ) => { span_err ! ( self sess span E0457 " \
 " name ) ; // No need to abort because the loading code will just ignore this // empty dylib. None } _ => None , } }
Look for a plugin registrar.
Look for a plugin registrar .
&mut self
span
Span
name
&str
&mut self
span
Span
name
&str