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

rustdoc: fix ICE from loading proc-macro stubs #57846

Merged
merged 2 commits into from Jan 25, 2019

Conversation

Projects
None yet
5 participants
@QuietMisdreavus
Copy link
Member

QuietMisdreavus commented Jan 22, 2019

Fixes #55399, fixes #54100

When trying to resolve a macro, rustdoc first tries to load it from the resolver to see whether it's a Macros 2.0 macro, so it can return that Def before looking for any other kind of macro. However, this becomes a problem when you try to load proc-macros: since you can't use a proc-macro inside its own crate, this lookup also fails when attempting to link to it.

However, we have a hint that this lookup will fail: Macros which are actually ProcMacroStubs will fail the lookup, so we can use that information to skip loading the macro. Rustdoc will then happily check resolve.all_macros, which will return a usable Def that we can link to.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 22, 2019

r? @steveklabnik

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

@QuietMisdreavus

This comment has been minimized.

Copy link
Member Author

QuietMisdreavus commented Jan 22, 2019

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Jan 23, 2019

Thanks!

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 23, 2019

📌 Commit b876694 has been approved by GuillaumeGomez

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 23, 2019

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

Centril added a commit to Centril/rust that referenced this pull request Jan 24, 2019

Rollup merge of rust-lang#57846 - QuietMisdreavus:proc-macro-links, r…
…=GuillaumeGomez

rustdoc: fix ICE from loading proc-macro stubs

Fixes rust-lang#55399

When trying to resolve a macro, rustdoc first tries to load it from the resolver to see whether it's a Macros 2.0 macro, so it can return that Def before looking for any other kind of macro. However, this becomes a problem when you try to load proc-macros: since you can't use a proc-macro inside its own crate, this lookup also fails when attempting to link to it.

However, we have a hint that this lookup will fail: Macros which are actually `ProcMacroStub`s will fail the lookup, so we can use that information to skip loading the macro. Rustdoc will then happily check `resolve.all_macros`, which will return a usable Def that we can link to.

bors added a commit that referenced this pull request Jan 24, 2019

Auto merge of #57874 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57066 (Fix race condition when emitting stored diagnostics)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57734 (Fix evaluating trivial drop glue in constants)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 24, 2019

Auto merge of #57874 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57066 (Fix race condition when emitting stored diagnostics)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57734 (Fix evaluating trivial drop glue in constants)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Jan 24, 2019

Rollup merge of rust-lang#57846 - QuietMisdreavus:proc-macro-links, r…
…=GuillaumeGomez

rustdoc: fix ICE from loading proc-macro stubs

Fixes rust-lang#55399

When trying to resolve a macro, rustdoc first tries to load it from the resolver to see whether it's a Macros 2.0 macro, so it can return that Def before looking for any other kind of macro. However, this becomes a problem when you try to load proc-macros: since you can't use a proc-macro inside its own crate, this lookup also fails when attempting to link to it.

However, we have a hint that this lookup will fail: Macros which are actually `ProcMacroStub`s will fail the lookup, so we can use that information to skip loading the macro. Rustdoc will then happily check `resolve.all_macros`, which will return a usable Def that we can link to.

bors added a commit that referenced this pull request Jan 24, 2019

Auto merge of #57879 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57380 (Fix Instant/Duration math precision & associativity on Windows)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57803 (Several changes to libunwind for SGX target)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 25, 2019

☔️ The latest upstream changes (presumably #57879) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors merged commit b876694 into rust-lang:master Jan 25, 2019

@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus:proc-macro-links branch Jan 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment