Avoid loading needless proc-macro dependencies #38024

Merged
merged 1 commit into from Nov 28, 2016

Projects

None yet

5 participants

@jseyfried
Contributor

Fixes #37958 when no proc-macros are exported; in particular, without pub extern crate proc_macros;, #![feature(macro_reexport)], or #![feature(use_extern_macros)].

I opened rust-lang/cargo#3334 for exported proc macros.

r? @alexcrichton

@jseyfried
Contributor

cc @nrc

@nox
Contributor
nox commented Nov 27, 2016

Could this be reviewed and prioritised? This is blocking rustup in Servo.

@nrc
nrc approved these changes Nov 28, 2016 View changes

r = me with the comment expanded.

src/librustc/middle/cstore.rs
@@ -67,6 +67,8 @@ pub struct CrateSource {
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
pub enum DepKind {
+ /// A dependency that is only used for its macros, none of which are visible from other crates.
+ UnexportedMacrosOnly,
@nrc
nrc Nov 28, 2016 Contributor

Are these only used by monomorphised functions or is there some reason to include them. Would be good to comment in any case.

@jseyfried
jseyfried Nov 28, 2016 Contributor

UnexportedMacrosOnly are only included in the metadata as placeholders (the CrateNum of a dependency is computed from its position in the dependency list) -- I'll add a comment.

Does that answer your question? (not sure how monomorphised functions are relevant)

@jseyfried
jseyfried Nov 28, 2016 edited Contributor

Oh, I see -- monomorphised functions from extern crates might need to access non-visible functions. I don't think this is relevant to macros though, since expansion finishes before monomorphization.

@jseyfried jseyfried Avoid loading needless proc-macro dependencies.
1fd9041
@jseyfried
Contributor

@bors r=nrc

@bors
Contributor
bors commented Nov 28, 2016

📌 Commit 1fd9041 has been approved by nrc

@jseyfried
Contributor

@bors p=1

@bors
Contributor
bors commented Nov 28, 2016

⌛️ Testing commit 1fd9041 with merge 39c267a...

@bors bors added a commit that referenced this pull request Nov 28, 2016
@bors bors Auto merge of #38024 - jseyfried:avoid_needless_proc_macro_deps, r=nrc
Avoid loading needless proc-macro dependencies

Fixes #37958 when no proc-macros are exported; in particular, without `pub extern crate proc_macros;`, `#![feature(macro_reexport)]`, or `#![feature(use_extern_macros)]`.

I opened rust-lang/cargo#3334 for exported proc macros.

r? @alexcrichton
39c267a
@bors
Contributor
bors commented Nov 28, 2016

⛄️ The build was interrupted to prioritize another pull request.

@bors bors merged commit 1fd9041 into rust-lang:master Nov 28, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment