File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ impl<'a> PluginMetadataReader<'a> {
446446 should_match_name : true ,
447447 } ;
448448 let library = match load_ctxt. maybe_load_library_crate ( ) {
449- Some ( l) => l,
449+ Some ( l) => l,
450450 None if is_cross => {
451451 // try loading from target crates (only valid if there are
452452 // no syntax extensions)
@@ -473,6 +473,14 @@ impl<'a> PluginMetadataReader<'a> {
473473 let registrar = decoder:: get_plugin_registrar_fn ( library. metadata . as_slice ( ) ) . map ( |id| {
474474 decoder:: get_symbol ( library. metadata . as_slice ( ) , id)
475475 } ) ;
476+ if library. dylib . is_none ( ) && registrar. is_some ( ) {
477+ let message = format ! ( "plugin crate `{}` only found in rlib format, \
478+ but must be available in dylib format",
479+ info. ident) ;
480+ self . env . sess . span_err ( krate. span , message. as_slice ( ) ) ;
481+ // No need to abort because the loading code will just ignore this
482+ // empty dylib.
483+ }
476484 let pc = PluginMetadata {
477485 lib : library. dylib . clone ( ) ,
478486 macros : macros,
Original file line number Diff line number Diff line change 1+ // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ // no-prefer-dynamic
12+
13+ #![ crate_type = "rlib" ]
14+ #![ feature( plugin_registrar) ]
15+
16+ extern crate rustc;
17+
18+ use rustc:: plugin:: Registry ;
19+
20+ #[ plugin_registrar]
21+ pub fn plugin_registrar ( _: & mut Registry ) { }
Original file line number Diff line number Diff line change 1+ // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ // aux-build:rlib_crate_test.rs
12+ // ignore-stage1
13+ // ignore-tidy-linelength
14+ // ignore-android
15+
16+ #![ feature( phase) ]
17+ #[ phase( plugin) ] extern crate rlib_crate_test;
18+ //~^ ERROR: plugin crate `rlib_crate_test` only found in rlib format, but must be available in dylib format
19+
20+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments