Skip to content

Commit

Permalink
Treat custom derive extern crates like empty modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Oct 15, 2016
1 parent 33e3da8 commit aac6dca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
6 changes: 6 additions & 0 deletions src/librustc_resolve/build_reduced_graph.rs
Expand Up @@ -250,6 +250,12 @@ impl<'b> Resolver<'b> {
self.define(parent, name, TypeNS, (module, sp, vis));

self.populate_module_if_necessary(module);
} else if custom_derive_crate {
// Define an empty module
let def = Def::Mod(self.definitions.local_def_id(item.id));
let module = ModuleS::new(Some(parent), ModuleKind::Def(def, name));
let module = self.arenas.alloc_module(module);
self.define(parent, name, TypeNS, (module, sp, vis));
}
}

Expand Down
25 changes: 0 additions & 25 deletions src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-2.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src/test/compile-fail-fulldeps/proc-macro/shadow.rs
Expand Up @@ -9,13 +9,12 @@
// except according to those terms.

// aux-build:derive-a.rs
// aux-build:derive-a-2.rs

#![feature(proc_macro)]

#[macro_use]
extern crate derive_a;
#[macro_use]
extern crate derive_a_2; //~ ERROR: cannot shadow existing derive mode `A`
extern crate derive_a; //~ ERROR `derive_a` has already been defined

fn main() {}

0 comments on commit aac6dca

Please sign in to comment.