Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop warning when doc testing proc macro crates #39136

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

keeperofdakeys
Copy link
Contributor

@keeperofdakeys keeperofdakeys commented Jan 17, 2017

Fixes #39064

Add the test option to the session struct that is passed
to phase_2_configure_and_expand function inside the
rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
--test is normally invoked.

This change makes the warning disappear, but I'm not sure what else it might change. So this early PR is mainly to run the test suite, and to get feedback.

@rust-highfive
Copy link
Collaborator

r? @steveklabnik

(rust_highfive has picked a reviewer for you, use r? to override)

@keeperofdakeys
Copy link
Contributor Author

Given the following error from the travis test, this PR definitely seems like the wrong approach.

error: macro undefined: 'assert!'

@keeperofdakeys
Copy link
Contributor Author

@alexcrichton Do you have any thoughts on where to go from here? Adding the test flag for rustdoc seems like the wrong approach. Somehow I need another piece of state to tell the proc macro parser to abort early, and not trigger the warning. I don't feel like adding another flag to session::config::Options is the right approach.

@alexcrichton
Copy link
Member

@keeperofdakeys I think we have a flag in options for "I am rustdoc please abort proc macro parsing early", could that be reused here?

Add the actually_rustdoc option to the session that
is passed  to phase_2_configure_and_expand function
inside the rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
`--test` is normally invoked.
@keeperofdakeys keeperofdakeys changed the title [WIP] Stop warning when doc testing proc macro crates Stop warning when doc testing proc macro crates Jan 18, 2017
@keeperofdakeys
Copy link
Contributor Author

I've changed from using the opts.test flag, to the opts.actually_rustdoc flag, and all tests are now passing. I've also added a test for doctesting in proc-macro crates. This means all proc_macro parsing is skipped for rustdoc --test, which I don't think will cause any breakage.

@keeperofdakeys
Copy link
Contributor Author

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 19, 2017

📌 Commit d492433 has been approved by alexcrichton

@alexcrichton
Copy link
Member

@bors: p=1

(fixing the regression here: #37480 (comment))

@bors
Copy link
Contributor

bors commented Jan 19, 2017

⌛ Testing commit d492433 with merge f0b4207...

bors added a commit that referenced this pull request Jan 19, 2017
…hton

Stop warning when doc testing proc macro crates

Fixes #39064

Add the test option to the session struct that is passed
to phase_2_configure_and_expand function inside the
rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
`--test` is normally invoked.

This change makes the warning disappear, but I'm not sure what else it might change. So this early PR is mainly to run the test suite, and to get feedback.
@bors
Copy link
Contributor

bors commented Jan 19, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing f0b4207 to master...

@bors bors merged commit d492433 into rust-lang:master Jan 19, 2017
@keeperofdakeys keeperofdakeys deleted the proc-macro-doc-test branch February 2, 2017 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants