about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-30 06:44:14 +0000
committerbors <bors@rust-lang.org>2018-11-30 06:44:14 +0000
commitd48ab693d1ce99f30c0cf9abdf45c209824fe825 (patch)
tree83dfb826fd7ff387e79c3e4c4c7ddd7d5317eba6 /src
parent3e90a12a8a95933604a8b609197fce61bb24a38c (diff)
parent3a04d448f935dcd8ed0e5ff98e776431196a4ece (diff)
downloadrust-d48ab693d1ce99f30c0cf9abdf45c209824fe825.tar.gz
rust-d48ab693d1ce99f30c0cf9abdf45c209824fe825.zip
Auto merge of #49219 - eddyb:proc-macro-decouple, r=alexcrichton
Decouple proc_macro from the rest of the compiler.

This PR removes all dependencies of `proc_macro` on compiler crates and allows multiple copies of `proc_macro`, built even by different compilers (but from the same source), to interoperate.

Practically, it allows:
* running proc macro tests at stage1 (I moved most from `-fulldeps` to the regular suites)
* using proc macros in the compiler itself (may require some rustbuild trickery)

On the server (i.e. compiler front-end) side:
* `server::*` traits are implemented to provide the concrete types and methods
  * the concrete types are completely separated from the `proc_macro` public API
  * the only use of the type implementing `Server` is to be passed to `Client::run`

On the client (i.e. proc macro) side (potentially using a different `proc_macro` instance!):
* `client::Client` wraps around client-side (expansion) function pointers
  * it encapsulates the `proc_macro` instance used by the client
  * its `run` method can be called by a server, to execute the client-side function
    * the client instance is bridged to the provided server, while it runs
    * ~~currently a thread is spawned, could use process isolation in the future~~
(not the case anymore, see #56058)
* proc macro crates get a generated `static` holding a `&[ProcMacro]`
  * this describes all derives/attr/bang proc macros, replacing the "registrar" function
  * each variant of `ProcMacro` contains an appropriately typed `Client<fn(...) -> ...>`

`proc_macro` public APIs call into the server via an internal "bridge":
* only a currently running proc macro `Client` can interact with those APIs
  * server code might not be able to (if it uses a different `proc_macro` instance)
    * however, it can always create and `run` its own `Client`, but that may be inefficient
* the `bridge` uses serialization, C ABI and integer handles to avoid Rust ABI instability
* each invocation of a proc macro results in disjoint integers in its `proc_macro` handles
  * this prevents using values of those types across invocations (if they even can be kept)

r? @alexcrichton cc @jseyfried @nikomatsakis @Zoxc @thepowersgang
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bin/rustc.rs10
-rw-r--r--src/bootstrap/builder.rs1
-rw-r--r--src/bootstrap/test.rs17
-rw-r--r--src/libproc_macro/Cargo.toml7
-rw-r--r--src/libproc_macro/bridge/buffer.rs170
-rw-r--r--src/libproc_macro/bridge/client.rs504
-rw-r--r--src/libproc_macro/bridge/closure.rs42
-rw-r--r--src/libproc_macro/bridge/handle.rs92
-rw-r--r--src/libproc_macro/bridge/mod.rs413
-rw-r--r--src/libproc_macro/bridge/rpc.rs319
-rw-r--r--src/libproc_macro/bridge/scoped_cell.rs90
-rw-r--r--src/libproc_macro/bridge/server.rs352
-rw-r--r--src/libproc_macro/diagnostic.rs30
-rw-r--r--src/libproc_macro/lib.rs539
-rw-r--r--src/libproc_macro/rustc.rs283
-rw-r--r--src/librustc/Cargo.toml1
-rw-r--r--src/librustc/dep_graph/dep_node.rs2
-rw-r--r--src/librustc/middle/dependency_format.rs5
-rw-r--r--src/librustc/session/mod.rs8
-rw-r--r--src/librustc/ty/query/config.rs2
-rw-r--r--src/librustc/ty/query/mod.rs2
-rw-r--r--src/librustc/ty/query/plumbing.rs2
-rw-r--r--src/librustc/util/common.rs13
-rw-r--r--src/librustc_codegen_ssa/back/symbol_export.rs2
-rw-r--r--src/librustc_codegen_utils/symbol_names.rs4
-rw-r--r--src/librustc_cratesio_shim/src/lib.rs1
-rw-r--r--src/librustc_driver/driver.rs8
-rw-r--r--src/librustc_driver/lib.rs2
-rw-r--r--src/librustc_driver/proc_macro_decls.rs (renamed from src/librustc_driver/derive_registrar.rs)10
-rw-r--r--src/librustc_metadata/Cargo.toml1
-rw-r--r--src/librustc_metadata/creader.rs86
-rw-r--r--src/librustc_metadata/cstore_impl.rs7
-rw-r--r--src/librustc_metadata/encoder.rs4
-rw-r--r--src/librustc_metadata/locator.rs2
-rw-r--r--src/librustc_metadata/schema.rs2
-rw-r--r--src/libsyntax/feature_gate.rs4
-rw-r--r--src/libsyntax_ext/Cargo.toml1
-rw-r--r--src/libsyntax_ext/deriving/custom.rs69
-rw-r--r--src/libsyntax_ext/lib.rs8
-rw-r--r--src/libsyntax_ext/proc_macro_decls.rs (renamed from src/libsyntax_ext/proc_macro_registrar.rs)142
-rw-r--r--src/libsyntax_ext/proc_macro_impl.rs46
-rw-r--r--src/libsyntax_ext/proc_macro_server.rs751
-rw-r--r--src/libtest/Cargo.toml3
-rw-r--r--src/test/compile-fail/proc-macro/attr-invalid-exprs.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/attr-stmt-expr.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/attribute-with-error.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/attribute.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/attribute.rs)3
-rw-r--r--src/test/compile-fail/proc-macro/attributes-included.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/attribute-with-error.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/attributes-included.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/bang_proc_macro2.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-b.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-a.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-b.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-b.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-bad.rs)2
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-clona.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-foo.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable-2.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue-41211.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_38586.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_50493.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/more-gates.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/more-gates.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs)2
-rw-r--r--src/test/compile-fail/proc-macro/auxiliary/test-macros.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/define-two.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/define-two.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/derive-bad.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/derive-still-gated.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/derive-still-gated.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/expand-to-unstable-2.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/expand-to-unstable.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/export-macro.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/export-macro.rs)3
-rw-r--r--src/test/compile-fail/proc-macro/exports.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/exports.rs)3
-rw-r--r--src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/import.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/import.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/issue-37788.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/issue-37788.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/issue-38586.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/issue-41211.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/issue-50493.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/item-error.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/item-error.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/lints_in_proc_macros.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/macros-in-extern.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/more-gates.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/more-gates.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/no-macro-use-attr.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/proc-macro-attributes.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs)1
-rw-r--r--src/test/compile-fail/proc-macro/proc-macro-gates.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/proc-macro-gates2.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/pub-at-crate-root.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/pub-at-crate-root.rs)3
-rw-r--r--src/test/compile-fail/proc-macro/shadow-builtin.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs)3
-rw-r--r--src/test/compile-fail/proc-macro/shadow.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/shadow.rs)0
-rw-r--r--src/test/compile-fail/proc-macro/two-crate-types-1.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/two-crate-types-1.rs)3
-rw-r--r--src/test/compile-fail/proc-macro/two-crate-types-2.rs (renamed from src/test/compile-fail-fulldeps/proc-macro/two-crate-types-2.rs)1
-rw-r--r--src/test/incremental/auxiliary/incremental_proc_macro_aux.rs (renamed from src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs)1
-rw-r--r--src/test/incremental/auxiliary/issue_49482_macro_def.rs (renamed from src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs)1
-rw-r--r--src/test/incremental/auxiliary/issue_49482_reexport.rs (renamed from src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs)0
-rw-r--r--src/test/incremental/auxiliary/issue_54059.rs (renamed from src/test/incremental-fulldeps/auxiliary/issue_54059.rs)1
-rw-r--r--src/test/incremental/incremental_proc_macro.rs (renamed from src/test/incremental-fulldeps/incremental_proc_macro.rs)1
-rw-r--r--src/test/incremental/issue-49482.rs (renamed from src/test/incremental-fulldeps/issue-49482.rs)1
-rw-r--r--src/test/incremental/issue-54059.rs (renamed from src/test/incremental-fulldeps/issue-54059.rs)1
-rw-r--r--src/test/pretty/attr-derive.rs1
-rw-r--r--src/test/pretty/auxiliary/derive-foo.rs1
-rw-r--r--src/test/run-make-fulldeps/issue-38237/Makefile6
-rw-r--r--src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile12
-rw-r--r--src/test/run-make/rustc-macro-dep-files/Makefile8
-rw-r--r--src/test/run-make/rustc-macro-dep-files/bar.rs (renamed from src/test/run-make-fulldeps/rustc-macro-dep-files/bar.rs)7
-rw-r--r--src/test/run-make/rustc-macro-dep-files/foo.rs (renamed from src/test/run-make-fulldeps/rustc-macro-dep-files/foo.rs)0
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs)0
-rw-r--r--src/test/run-pass-fulldeps/compiler-calls.rs1
-rw-r--r--src/test/run-pass-fulldeps/issue-40001.rs (renamed from src/test/run-pass-fulldeps/proc-macro/issue-40001.rs)0
-rw-r--r--src/test/run-pass/auxiliary/cond_plugin.rs (renamed from src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs)1
-rw-r--r--src/test/run-pass/auxiliary/hello_macro.rs (renamed from src/test/run-pass-fulldeps/auxiliary/hello_macro.rs)1
-rw-r--r--src/test/run-pass/auxiliary/proc_macro_def.rs (renamed from src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs)1
-rw-r--r--src/test/run-pass/macro-quote-cond.rs (renamed from src/test/run-pass-fulldeps/macro-quote-cond.rs)1
-rw-r--r--src/test/run-pass/macro-quote-test.rs (renamed from src/test/run-pass-fulldeps/macro-quote-test.rs)1
-rw-r--r--src/test/run-pass/proc-macro/add-impl.rs (renamed from src/test/run-pass-fulldeps/proc-macro/add-impl.rs)1
-rw-r--r--src/test/run-pass/proc-macro/append-impl.rs (renamed from src/test/run-pass-fulldeps/proc-macro/append-impl.rs)1
-rw-r--r--src/test/run-pass/proc-macro/attr-args.rs (renamed from src/test/run-pass-fulldeps/proc-macro/attr-args.rs)1
-rw-r--r--src/test/run-pass/proc-macro/attr-cfg.rs (renamed from src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs)1
-rw-r--r--src/test/run-pass/proc-macro/attr-on-trait.rs (renamed from src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs)1
-rw-r--r--src/test/run-pass/proc-macro/attr-stmt-expr.rs (renamed from src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/add-impl.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/add-impl.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/append-impl.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/append-impl.rs)0
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/attr-args.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/attr-cfg.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-cfg.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/attr-on-trait.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-on-trait.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/attr-stmt-expr.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/bang-macro.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/bang-macro.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/call-site.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/call-site.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/count_compound_ops.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/custom-attr-only-one-derive.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/custom-attr-only-one-derive.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-a.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-a.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-atob.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-atob.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-attr-cfg.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-attr-cfg.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-b.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-ctod.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-ctod.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-nothing.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-nothing.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-same-struct.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-same-struct.rs)4
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-two-attrs.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-two-attrs.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/derive-union.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-union.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/double.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/empty-crate.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/empty-crate.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/expand-with-a-macro.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/expand-with-a-macro.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/external-crate-var.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/external-crate-var.rs)0
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/gen-lifetime-token.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/hygiene_example.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs)0
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/hygiene_example_codegen.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/issue-39889.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-39889.rs)0
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/issue-42708.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/issue-50061.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-50061.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/lifetimes.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/lifetimes.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/modify-ast.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/modify-ast.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/negative-token.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/negative-token.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/not-joint.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/not-joint.rs)1
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/span-api-tests.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs)0
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/span-test-macros.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/span-test-macros.rs)0
-rw-r--r--src/test/run-pass/proc-macro/auxiliary/test-macros.rs (renamed from src/test/run-pass-fulldeps/proc-macro/auxiliary/test-macros.rs)1
-rw-r--r--src/test/run-pass/proc-macro/bang-macro.rs (renamed from src/test/run-pass-fulldeps/proc-macro/bang-macro.rs)1
-rw-r--r--src/test/run-pass/proc-macro/call-site.rs (renamed from src/test/run-pass-fulldeps/proc-macro/call-site.rs)1
-rw-r--r--src/test/run-pass/proc-macro/count_compound_ops.rs (renamed from src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs)1
-rw-r--r--src/test/run-pass/proc-macro/crate-var.rs (renamed from src/test/run-pass-fulldeps/proc-macro/crate-var.rs)1
-rw-r--r--src/test/run-pass/proc-macro/custom-attr-only-one-derive.rs (renamed from src/test/run-pass-fulldeps/proc-macro/custom-attr-only-one-derive.rs)0
-rw-r--r--src/test/run-pass/proc-macro/derive-attr-cfg.rs (renamed from src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs)1
-rw-r--r--src/test/run-pass/proc-macro/derive-b.rs (renamed from src/test/run-pass-fulldeps/proc-macro/derive-b.rs)1
-rw-r--r--src/test/run-pass/proc-macro/derive-same-struct.rs (renamed from src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs)1
-rw-r--r--src/test/run-pass/proc-macro/derive-same-struct.stdout (renamed from src/test/run-pass-fulldeps/proc-macro/derive-same-struct.stdout)0
-rw-r--r--src/test/run-pass/proc-macro/derive-test.rs (renamed from src/test/run-pass-fulldeps/proc-macro/derive-test.rs)0
-rw-r--r--src/test/run-pass/proc-macro/derive-two-attrs.rs (renamed from src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs)0
-rw-r--r--src/test/run-pass/proc-macro/derive-union.rs (renamed from src/test/run-pass-fulldeps/proc-macro/derive-union.rs)1
-rw-r--r--src/test/run-pass/proc-macro/empty-crate.rs (renamed from src/test/run-pass-fulldeps/proc-macro/empty-crate.rs)1
-rw-r--r--src/test/run-pass/proc-macro/expand-with-a-macro.rs (renamed from src/test/run-pass-fulldeps/proc-macro/expand-with-a-macro.rs)3
-rw-r--r--src/test/run-pass/proc-macro/gen-lifetime-token.rs (renamed from src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs)0
-rw-r--r--src/test/run-pass/proc-macro/hygiene_example.rs (renamed from src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs)1
-rw-r--r--src/test/run-pass/proc-macro/issue-39889.rs (renamed from src/test/run-pass-fulldeps/proc-macro/issue-39889.rs)1
-rw-r--r--src/test/run-pass/proc-macro/issue-42708.rs (renamed from src/test/run-pass-fulldeps/proc-macro/issue-42708.rs)1
-rw-r--r--src/test/run-pass/proc-macro/issue-50061.rs (renamed from src/test/run-pass-fulldeps/proc-macro/issue-50061.rs)1
-rw-r--r--src/test/run-pass/proc-macro/lifetimes.rs (renamed from src/test/run-pass-fulldeps/proc-macro/lifetimes.rs)1
-rw-r--r--src/test/run-pass/proc-macro/load-two.rs (renamed from src/test/run-pass-fulldeps/proc-macro/load-two.rs)1
-rw-r--r--src/test/run-pass/proc-macro/macros-in-extern.rs (renamed from src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs)1
-rw-r--r--src/test/run-pass/proc-macro/modify-ast.rs (renamed from src/test/run-pass-fulldeps/proc-macro/modify-ast.rs)0
-rw-r--r--src/test/run-pass/proc-macro/negative-token.rs (renamed from src/test/run-pass-fulldeps/proc-macro/negative-token.rs)1
-rw-r--r--src/test/run-pass/proc-macro/not-joint.rs (renamed from src/test/run-pass-fulldeps/proc-macro/not-joint.rs)0
-rw-r--r--src/test/run-pass/proc-macro/smoke.rs (renamed from src/test/run-pass-fulldeps/proc-macro/smoke.rs)1
-rw-r--r--src/test/run-pass/proc-macro/span-api-tests.rs (renamed from src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs)0
-rw-r--r--src/test/run-pass/proc-macro/struct-field-macro.rs (renamed from src/test/run-pass-fulldeps/proc-macro/struct-field-macro.rs)1
-rw-r--r--src/test/run-pass/proc_macro.rs (renamed from src/test/run-pass-fulldeps/proc_macro.rs)1
-rw-r--r--src/test/rustdoc/doc-proc-macro.rs2
-rw-r--r--src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs1
-rw-r--r--src/test/rustdoc/inline_cross/proc_macro.rs1
-rw-r--r--src/test/rustdoc/proc-macro.rs3
-rw-r--r--src/test/rustdoc/rustc-macro-crate.rs2
-rw-r--r--src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs23
-rw-r--r--src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs23
-rw-r--r--src/test/ui/custom-derive/auxiliary/plugin.rs (renamed from src/test/ui-fulldeps/custom-derive/auxiliary/plugin.rs)1
-rw-r--r--src/test/ui/custom-derive/derive-in-mod.rs (renamed from src/test/ui-fulldeps/custom-derive/derive-in-mod.rs)0
-rw-r--r--src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs (renamed from src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.rs)1
-rw-r--r--src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr (renamed from src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr)6
-rw-r--r--src/test/ui/custom-derive/helper-attr-blocked-by-import.rs (renamed from src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import.rs)1
-rw-r--r--src/test/ui/custom-derive/issue-36935.rs (renamed from src/test/ui-fulldeps/custom-derive/issue-36935.rs)2
-rw-r--r--src/test/ui/custom-derive/issue-36935.stderr (renamed from src/test/ui-fulldeps/custom-derive/issue-36935.stderr)0
-rw-r--r--src/test/ui/proc-macro/ambiguous-builtin-attrs-test.rs (renamed from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.rs)0
-rw-r--r--src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr (renamed from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.stderr)0
-rw-r--r--src/test/ui/proc-macro/ambiguous-builtin-attrs.rs (renamed from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.rs)0
-rw-r--r--src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr (renamed from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr)0
-rw-r--r--src/test/ui/proc-macro/attribute-order-restricted.rs (renamed from src/test/ui-fulldeps/attribute-order-restricted.rs)0
-rw-r--r--src/test/ui/proc-macro/attribute-order-restricted.stderr (renamed from src/test/ui-fulldeps/attribute-order-restricted.stderr)0
-rw-r--r--src/test/ui/proc-macro/attribute-spans-preserved.rs (renamed from src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs)0
-rw-r--r--src/test/ui/proc-macro/attribute-spans-preserved.stderr (renamed from src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr)0
-rw-r--r--src/test/ui/proc-macro/attribute-spans-preserved.stdout (renamed from src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs (renamed from src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/attribute-spans-preserved.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/attribute-spans-preserved.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs (renamed from src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/builtin-attrs.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/builtin-attrs.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-clona.rs (renamed from src/test/ui-fulldeps/auxiliary/derive-clona.rs)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-foo.rs (renamed from src/test/ui-fulldeps/auxiliary/derive-foo.rs)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed-2.rs)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowing.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-panic.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs)2
-rw-r--r--src/test/ui/proc-macro/auxiliary/generate-mod.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/invalid-punct-ident.rs (renamed from src/test/ui-fulldeps/auxiliary/invalid-punct-ident.rs)0
-rw-r--r--src/test/ui/proc-macro/auxiliary/issue-53481.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/issue-53481.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/lifetimes.rs (renamed from src/test/ui-fulldeps/auxiliary/lifetimes.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/macro-brackets.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/macro-brackets.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/multispan.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/nested-item-spans.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/nested-item-spans.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/parent-source-spans.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/parent-source-spans.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/span-preservation.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/subspan.rs (renamed from src/test/ui-fulldeps/auxiliary/subspan.rs)1
-rw-r--r--src/test/ui/proc-macro/auxiliary/three-equals.rs (renamed from src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs)1
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowed.rs (renamed from src/test/ui-fulldeps/proc-macro/derive-helper-shadowed.rs)0
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowing.rs (renamed from src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.rs)0
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowing.stderr (renamed from src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr)0
-rw-r--r--src/test/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs (renamed from src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs)0
-rw-r--r--src/test/ui/proc-macro/generate-mod.rs (renamed from src/test/ui-fulldeps/proc-macro/generate-mod.rs)0
-rw-r--r--src/test/ui/proc-macro/generate-mod.stderr (renamed from src/test/ui-fulldeps/proc-macro/generate-mod.stderr)0
-rw-r--r--src/test/ui/proc-macro/invalid-attributes.rs (renamed from src/test/ui-fulldeps/proc-macro/invalid-attributes.rs)1
-rw-r--r--src/test/ui/proc-macro/invalid-attributes.stderr (renamed from src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr)12
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-1.rs (renamed from src/test/ui-fulldeps/invalid-punct-ident-1.rs)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-1.stderr (renamed from src/test/ui-fulldeps/invalid-punct-ident-1.stderr)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-2.rs (renamed from src/test/ui-fulldeps/invalid-punct-ident-2.rs)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-2.stderr (renamed from src/test/ui-fulldeps/invalid-punct-ident-2.stderr)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-3.rs (renamed from src/test/ui-fulldeps/invalid-punct-ident-3.rs)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-3.stderr (renamed from src/test/ui-fulldeps/invalid-punct-ident-3.stderr)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-4.rs (renamed from src/test/ui-fulldeps/invalid-punct-ident-4.rs)0
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-4.stderr (renamed from src/test/ui-fulldeps/invalid-punct-ident-4.stderr)0
-rw-r--r--src/test/ui/proc-macro/issue-53481.rs (renamed from src/test/ui-fulldeps/proc-macro/issue-53481.rs)0
-rw-r--r--src/test/ui/proc-macro/lifetimes.rs (renamed from src/test/ui-fulldeps/lifetimes.rs)0
-rw-r--r--src/test/ui/proc-macro/lifetimes.stderr (renamed from src/test/ui-fulldeps/lifetimes.stderr)0
-rw-r--r--src/test/ui/proc-macro/load-panic.rs (renamed from src/test/ui-fulldeps/proc-macro/load-panic.rs)0
-rw-r--r--src/test/ui/proc-macro/load-panic.stderr (renamed from src/test/ui-fulldeps/proc-macro/load-panic.stderr)0
-rw-r--r--src/test/ui/proc-macro/macro-brackets.rs (renamed from src/test/ui-fulldeps/proc-macro/macro-brackets.rs)0
-rw-r--r--src/test/ui/proc-macro/macro-brackets.stderr (renamed from src/test/ui-fulldeps/proc-macro/macro-brackets.stderr)0
-rw-r--r--src/test/ui/proc-macro/macro-namespace-reserved-2.rs (renamed from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs)1
-rw-r--r--src/test/ui/proc-macro/macro-namespace-reserved-2.stderr (renamed from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr)18
-rw-r--r--src/test/ui/proc-macro/macro-namespace-reserved.rs (renamed from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs)1
-rw-r--r--src/test/ui/proc-macro/macro-namespace-reserved.stderr (renamed from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.stderr)8
-rw-r--r--src/test/ui/proc-macro/macro-use-attr.rs (renamed from src/test/ui-fulldeps/proc-macro/macro-use-attr.rs)0
-rw-r--r--src/test/ui/proc-macro/macro-use-bang.rs (renamed from src/test/ui-fulldeps/proc-macro/macro-use-bang.rs)0
-rw-r--r--src/test/ui/proc-macro/multispan.rs (renamed from src/test/ui-fulldeps/proc-macro/multispan.rs)1
-rw-r--r--src/test/ui/proc-macro/multispan.stderr (renamed from src/test/ui-fulldeps/proc-macro/multispan.stderr)28
-rw-r--r--src/test/ui/proc-macro/nested-item-spans.rs (renamed from src/test/ui-fulldeps/proc-macro/nested-item-spans.rs)0
-rw-r--r--src/test/ui/proc-macro/nested-item-spans.stderr (renamed from src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr)0
-rw-r--r--src/test/ui/proc-macro/non-root.rs (renamed from src/test/ui-fulldeps/proc-macro/non-root.rs)1
-rw-r--r--src/test/ui/proc-macro/non-root.stderr (renamed from src/test/ui-fulldeps/proc-macro/non-root.stderr)2
-rw-r--r--src/test/ui/proc-macro/parent-source-spans.rs (renamed from src/test/ui-fulldeps/proc-macro/parent-source-spans.rs)2
-rw-r--r--src/test/ui/proc-macro/parent-source-spans.stderr (renamed from src/test/ui-fulldeps/proc-macro/parent-source-spans.stderr)0
-rw-r--r--src/test/ui/proc-macro/reserved-macro-names.rs (renamed from src/test/ui-fulldeps/proc-macro/reserved-macro-names.rs)3
-rw-r--r--src/test/ui/proc-macro/reserved-macro-names.stderr (renamed from src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr)6
-rw-r--r--src/test/ui/proc-macro/resolve-error.rs (renamed from src/test/ui-fulldeps/resolve-error.rs)0
-rw-r--r--src/test/ui/proc-macro/resolve-error.stderr (renamed from src/test/ui-fulldeps/resolve-error.stderr)0
-rw-r--r--src/test/ui/proc-macro/signature.rs (renamed from src/test/ui-fulldeps/proc-macro/signature.rs)3
-rw-r--r--src/test/ui/proc-macro/signature.stderr (renamed from src/test/ui-fulldeps/proc-macro/signature.stderr)2
-rw-r--r--src/test/ui/proc-macro/span-preservation.rs (renamed from src/test/ui-fulldeps/proc-macro/span-preservation.rs)0
-rw-r--r--src/test/ui/proc-macro/span-preservation.stderr (renamed from src/test/ui-fulldeps/proc-macro/span-preservation.stderr)0
-rw-r--r--src/test/ui/proc-macro/subspan.rs (renamed from src/test/ui-fulldeps/subspan.rs)1
-rw-r--r--src/test/ui/proc-macro/subspan.stderr (renamed from src/test/ui-fulldeps/subspan.stderr)32
-rw-r--r--src/test/ui/proc-macro/three-equals.rs (renamed from src/test/ui-fulldeps/proc-macro/three-equals.rs)2
-rw-r--r--src/test/ui/proc-macro/three-equals.stderr (renamed from src/test/ui-fulldeps/proc-macro/three-equals.stderr)0
-rw-r--r--src/test/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs (renamed from src/test/ui-fulldeps/rust-2018/auxiliary/suggestions-not-always-applicable.rs)1
-rw-r--r--src/test/ui/rust-2018/proc-macro-crate-in-paths.rs (renamed from src/test/ui-fulldeps/rust-2018/proc-macro-crate-in-paths.rs)2
-rw-r--r--src/test/ui/rust-2018/suggestions-not-always-applicable.fixed (renamed from src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed)0
-rw-r--r--src/test/ui/rust-2018/suggestions-not-always-applicable.rs (renamed from src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs)0
-rw-r--r--src/test/ui/rust-2018/suggestions-not-always-applicable.stderr (renamed from src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.stderr)0
-rw-r--r--src/test/ui/unnecessary-extern-crate.rs (renamed from src/test/ui-fulldeps/unnecessary-extern-crate.rs)38
-rw-r--r--src/test/ui/unnecessary-extern-crate.stderr (renamed from src/test/ui-fulldeps/unnecessary-extern-crate.stderr)24
-rw-r--r--src/tools/compiletest/src/runtest.rs8
286 files changed, 3326 insertions, 1159 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index afe1b4c42ea..d18a48e5d22 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -129,10 +129,12 @@ fn main() {
         // Help the libc crate compile by assisting it in finding the MUSL
         // native libraries.
         if let Some(s) = env::var_os("MUSL_ROOT") {
-            let mut root = OsString::from("native=");
-            root.push(&s);
-            root.push("/lib");
-            cmd.arg("-L").arg(&root);
+            if target.contains("musl") {
+                let mut root = OsString::from("native=");
+                root.push(&s);
+                root.push("/lib");
+                cmd.arg("-L").arg(&root);
+            }
         }
 
         // Override linker if necessary.
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 900f336ef8c..079fdee7e86 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -390,7 +390,6 @@ impl<'a> Builder<'a> {
                 test::RunPassFullDeps,
                 test::RunFailFullDeps,
                 test::CompileFailFullDeps,
-                test::IncrementalFullDeps,
                 test::Rustdoc,
                 test::Pretty,
                 test::RunPassPretty,
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index e55773011df..e6c260a1426 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -839,12 +839,6 @@ host_test!(CompileFailFullDeps {
     suite: "compile-fail-fulldeps"
 });
 
-host_test!(IncrementalFullDeps {
-    path: "src/test/incremental-fulldeps",
-    mode: "incremental",
-    suite: "incremental-fulldeps"
-});
-
 host_test!(Rustdoc {
     path: "src/test/rustdoc",
     mode: "rustdoc",
@@ -982,6 +976,11 @@ impl Step for Compiletest {
             builder.ensure(compile::Std { compiler, target: compiler.host });
         }
 
+        // HACK(eddyb) ensure that `libproc_macro` is available on the host.
+        builder.ensure(compile::Test { compiler, target: compiler.host });
+        // Also provide `rust_test_helpers` for the host.
+        builder.ensure(native::TestHelpers { target: compiler.host });
+
         builder.ensure(native::TestHelpers { target });
         builder.ensure(RemoteCopyLibs { compiler, target });
 
@@ -1049,7 +1048,11 @@ impl Step for Compiletest {
             cmd.arg("--linker").arg(linker);
         }
 
-        let hostflags = flags.clone();
+        let mut hostflags = flags.clone();
+        hostflags.push(format!(
+            "-Lnative={}",
+            builder.test_helpers_out(compiler.host).display()
+        ));
         cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
 
         let mut targetflags = flags;
diff --git a/src/libproc_macro/Cargo.toml b/src/libproc_macro/Cargo.toml
index c1b2622520b..f903f79f9af 100644
--- a/src/libproc_macro/Cargo.toml
+++ b/src/libproc_macro/Cargo.toml
@@ -5,10 +5,3 @@ version = "0.0.0"
 
 [lib]
 path = "lib.rs"
-crate-type = ["dylib"]
-
-[dependencies]
-syntax = { path = "../libsyntax" }
-syntax_pos = { path = "../libsyntax_pos" }
-rustc_errors = { path = "../librustc_errors" }
-rustc_data_structures = { path = "../librustc_data_structures" }
diff --git a/src/libproc_macro/bridge/buffer.rs b/src/libproc_macro/bridge/buffer.rs
new file mode 100644
index 00000000000..f228841c1e8
--- /dev/null
+++ b/src/libproc_macro/bridge/buffer.rs
@@ -0,0 +1,170 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Buffer management for same-process client<->server communication.
+
+use std::io::{self, Write};
+use std::mem;
+use std::ops::{Deref, DerefMut};
+use std::slice;
+
+#[repr(C)]
+struct Slice<'a, T: 'a> {
+    data: &'a [T; 0],
+    len: usize,
+}
+
+unsafe impl<'a, T: Sync> Sync for Slice<'a, T> {}
+unsafe impl<'a, T: Sync> Send for Slice<'a, T> {}
+
+impl<T> Copy for Slice<'a, T> {}
+impl<T> Clone for Slice<'a, T> {
+    fn clone(&self) -> Self {
+        *self
+    }
+}
+
+impl<T> From<&'a [T]> for Slice<'a, T> {
+    fn from(xs: &'a [T]) -> Self {
+        Slice {
+            data: unsafe { &*(xs.as_ptr() as *const [T; 0]) },
+            len: xs.len(),
+        }
+    }
+}
+
+impl<T> Deref for Slice<'a, T> {
+    type Target = [T];
+    fn deref(&self) -> &[T] {
+        unsafe { slice::from_raw_parts(self.data.as_ptr(), self.len) }
+    }
+}
+
+#[repr(C)]
+pub struct Buffer<T: Copy> {
+    data: *mut T,
+    len: usize,
+    capacity: usize,
+    extend_from_slice: extern "C" fn(Buffer<T>, Slice<T>) -> Buffer<T>,
+    drop: extern "C" fn(Buffer<T>),
+}
+
+unsafe impl<T: Copy + Sync> Sync for Buffer<T> {}
+unsafe impl<T: Copy + Send> Send for Buffer<T> {}
+
+impl<T: Copy> Default for Buffer<T> {
+    fn default() -> Self {
+        Self::from(vec![])
+    }
+}
+
+impl<T: Copy> Deref for Buffer<T> {
+    type Target = [T];
+    fn deref(&self) -> &[T] {
+        unsafe { slice::from_raw_parts(self.data as *const T, self.len) }
+    }
+}
+
+impl<T: Copy> DerefMut for Buffer<T> {
+    fn deref_mut(&mut self) -> &mut [T] {
+        unsafe { slice::from_raw_parts_mut(self.data, self.len) }
+    }
+}
+
+impl<T: Copy> Buffer<T> {
+    pub(super) fn new() -> Self {
+        Self::default()
+    }
+
+    pub(super) fn clear(&mut self) {
+        self.len = 0;
+    }
+
+    pub(super) fn take(&mut self) -> Self {
+        mem::replace(self, Self::default())
+    }
+
+    pub(super) fn extend_from_slice(&mut self, xs: &[T]) {
+        // Fast path to avoid going through an FFI call.
+        if let Some(final_len) = self.len.checked_add(xs.len()) {
+            if final_len <= self.capacity {
+                let dst = unsafe { slice::from_raw_parts_mut(self.data, self.capacity) };
+                dst[self.len..][..xs.len()].copy_from_slice(xs);
+                self.len = final_len;
+                return;
+            }
+        }
+        let b = self.take();
+        *self = (b.extend_from_slice)(b, Slice::from(xs));
+    }
+}
+
+impl Write for Buffer<u8> {
+    fn write(&mut self, xs: &[u8]) -> io::Result<usize> {
+        self.extend_from_slice(xs);
+        Ok(xs.len())
+    }
+
+    fn write_all(&mut self, xs: &[u8]) -> io::Result<()> {
+        self.extend_from_slice(xs);
+        Ok(())
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        Ok(())
+    }
+}
+
+impl<T: Copy> Drop for Buffer<T> {
+    fn drop(&mut self) {
+        let b = self.take();
+        (b.drop)(b);
+    }
+}
+
+impl<T: Copy> From<Vec<T>> for Buffer<T> {
+    fn from(mut v: Vec<T>) -> Self {
+        let (data, len, capacity) = (v.as_mut_ptr(), v.len(), v.capacity());
+        mem::forget(v);
+
+        // This utility function is nested in here because it can *only*
+        // be safely called on `Buffer`s created by *this* `proc_macro`.
+        fn to_vec<T: Copy>(b: Buffer<T>) -> Vec<T> {
+            unsafe {
+                let Buffer {
+                    data,
+                    len,
+                    capacity,
+                    ..
+                } = b;
+                mem::forget(b);
+                Vec::from_raw_parts(data, len, capacity)
+            }
+        }
+
+        extern "C" fn extend_from_slice<T: Copy>(b: Buffer<T>, xs: Slice<T>) -> Buffer<T> {
+            let mut v = to_vec(b);
+            v.extend_from_slice(&xs);
+            Buffer::from(v)
+        }
+
+        extern "C" fn drop<T: Copy>(b: Buffer<T>) {
+            mem::drop(to_vec(b));
+        }
+
+        Buffer {
+            data,
+            len,
+            capacity,
+            extend_from_slice,
+            drop,
+        }
+    }
+}
diff --git a/src/libproc_macro/bridge/client.rs b/src/libproc_macro/bridge/client.rs
new file mode 100644
index 00000000000..ed27df44962
--- /dev/null
+++ b/src/libproc_macro/bridge/client.rs
@@ -0,0 +1,504 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Client-side types.
+
+use super::*;
+
+macro_rules! define_handles {
+    (
+        'owned: $($oty:ident,)*
+        'interned: $($ity:ident,)*
+    ) => {
+        #[repr(C)]
+        #[allow(non_snake_case)]
+        pub struct HandleCounters {
+            $($oty: AtomicUsize,)*
+            $($ity: AtomicUsize,)*
+        }
+
+        impl HandleCounters {
+            // FIXME(#53451) public to work around `Cannot create local mono-item` ICE.
+            pub extern "C" fn get() -> &'static Self {
+                static COUNTERS: HandleCounters = HandleCounters {
+                    $($oty: AtomicUsize::new(1),)*
+                    $($ity: AtomicUsize::new(1),)*
+                };
+                &COUNTERS
+            }
+        }
+
+        // FIXME(eddyb) generate the definition of `HandleStore` in `server.rs`.
+        #[repr(C)]
+        #[allow(non_snake_case)]
+        pub(super) struct HandleStore<S: server::Types> {
+            $($oty: handle::OwnedStore<S::$oty>,)*
+            $($ity: handle::InternedStore<S::$ity>,)*
+        }
+
+        impl<S: server::Types> HandleStore<S> {
+            pub(super) fn new(handle_counters: &'static HandleCounters) -> Self {
+                HandleStore {
+                    $($oty: handle::OwnedStore::new(&handle_counters.$oty),)*
+                    $($ity: handle::InternedStore::new(&handle_counters.$ity),)*
+                }
+            }
+        }
+
+        $(
+            #[repr(C)]
+            pub(crate) struct $oty(handle::Handle);
+            impl !Send for $oty {}
+            impl !Sync for $oty {}
+
+            // Forward `Drop::drop` to the inherent `drop` method.
+            impl Drop for $oty {
+                fn drop(&mut self) {
+                    $oty(self.0).drop();
+                }
+            }
+
+            impl<S> Encode<S> for $oty {
+                fn encode(self, w: &mut Writer, s: &mut S) {
+                    let handle = self.0;
+                    mem::forget(self);
+                    handle.encode(w, s);
+                }
+            }
+
+            impl<S: server::Types> DecodeMut<'_, '_, HandleStore<server::MarkedTypes<S>>>
+                for Marked<S::$oty, $oty>
+            {
+                fn decode(r: &mut Reader, s: &mut HandleStore<server::MarkedTypes<S>>) -> Self {
+                    s.$oty.take(handle::Handle::decode(r, &mut ()))
+                }
+            }
+
+            impl<S> Encode<S> for &$oty {
+                fn encode(self, w: &mut Writer, s: &mut S) {
+                    self.0.encode(w, s);
+                }
+            }
+
+            impl<S: server::Types> Decode<'_, 's, HandleStore<server::MarkedTypes<S>>>
+                for &'s Marked<S::$oty, $oty>
+            {
+                fn decode(r: &mut Reader, s: &'s HandleStore<server::MarkedTypes<S>>) -> Self {
+                    &s.$oty[handle::Handle::decode(r, &mut ())]
+                }
+            }
+
+            impl<S> Encode<S> for &mut $oty {
+                fn encode(self, w: &mut Writer, s: &mut S) {
+                    self.0.encode(w, s);
+                }
+            }
+
+            impl<S: server::Types> DecodeMut<'_, 's, HandleStore<server::MarkedTypes<S>>>
+                for &'s mut Marked<S::$oty, $oty>
+            {
+                fn decode(r: &mut Reader, s: &'s mut HandleStore<server::MarkedTypes<S>>) -> Self {
+                    &mut s.$oty[handle::Handle::decode(r, &mut ())]
+                }
+            }
+
+            impl<S: server::Types> Encode<HandleStore<server::MarkedTypes<S>>>
+                for Marked<S::$oty, $oty>
+            {
+                fn encode(self, w: &mut Writer, s: &mut HandleStore<server::MarkedTypes<S>>) {
+                    s.$oty.alloc(self).encode(w, s);
+                }
+            }
+
+            impl<S> DecodeMut<'_, '_, S> for $oty {
+                fn decode(r: &mut Reader, s: &mut S) -> Self {
+                    $oty(handle::Handle::decode(r, s))
+                }
+            }
+        )*
+
+        $(
+            #[repr(C)]
+            #[derive(Copy, Clone, PartialEq, Eq, Hash)]
+            pub(crate) struct $ity(handle::Handle);
+            impl !Send for $ity {}
+            impl !Sync for $ity {}
+
+            impl<S> Encode<S> for $ity {
+                fn encode(self, w: &mut Writer, s: &mut S) {
+                    self.0.encode(w, s);
+                }
+            }
+
+            impl<S: server::Types> DecodeMut<'_, '_, HandleStore<server::MarkedTypes<S>>>
+                for Marked<S::$ity, $ity>
+            {
+                fn decode(r: &mut Reader, s: &mut HandleStore<server::MarkedTypes<S>>) -> Self {
+                    s.$ity.copy(handle::Handle::decode(r, &mut ()))
+                }
+            }
+
+            impl<S: server::Types> Encode<HandleStore<server::MarkedTypes<S>>>
+                for Marked<S::$ity, $ity>
+            {
+                fn encode(self, w: &mut Writer, s: &mut HandleStore<server::MarkedTypes<S>>) {
+                    s.$ity.alloc(self).encode(w, s);
+                }
+            }
+
+            impl<S> DecodeMut<'_, '_, S> for $ity {
+                fn decode(r: &mut Reader, s: &mut S) -> Self {
+                    $ity(handle::Handle::decode(r, s))
+                }
+            }
+        )*
+    }
+}
+define_handles! {
+    'owned:
+    TokenStream,
+    TokenStreamBuilder,
+    TokenStreamIter,
+    Group,
+    Literal,
+    SourceFile,
+    MultiSpan,
+    Diagnostic,
+
+    'interned:
+    Punct,
+    Ident,
+    Span,
+}
+
+// FIXME(eddyb) generate these impls by pattern-matching on the
+// names of methods - also could use the presence of `fn drop`
+// to distinguish between 'owned and 'interned, above.
+// Alternatively, special 'modes" could be listed of types in with_api
+// instead of pattern matching on methods, here and in server decl.
+
+impl Clone for TokenStream {
+    fn clone(&self) -> Self {
+        self.clone()
+    }
+}
+
+impl Clone for TokenStreamIter {
+    fn clone(&self) -> Self {
+        self.clone()
+    }
+}
+
+impl Clone for Group {
+    fn clone(&self) -> Self {
+        self.clone()
+    }
+}
+
+impl Clone for Literal {
+    fn clone(&self) -> Self {
+        self.clone()
+    }
+}
+
+// FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
+impl fmt::Debug for Literal {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(&self.debug())
+    }
+}
+
+impl Clone for SourceFile {
+    fn clone(&self) -> Self {
+        self.clone()
+    }
+}
+
+impl fmt::Debug for Span {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(&self.debug())
+    }
+}
+
+macro_rules! define_client_side {
+    ($($name:ident {
+        $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
+    }),* $(,)*) => {
+        $(impl $name {
+            $(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)* {
+                Bridge::with(|bridge| {
+                    let mut b = bridge.cached_buffer.take();
+
+                    b.clear();
+                    api_tags::Method::$name(api_tags::$name::$method).encode(&mut b, &mut ());
+                    reverse_encode!(b; $($arg),*);
+
+                    b = bridge.dispatch.call(b);
+
+                    let r = Result::<_, PanicMessage>::decode(&mut &b[..], &mut ());
+
+                    bridge.cached_buffer = b;
+
+                    r.unwrap_or_else(|e| panic::resume_unwind(e.into()))
+                })
+            })*
+        })*
+    }
+}
+with_api!(self, self, define_client_side);
+
+enum BridgeState<'a> {
+    /// No server is currently connected to this client.
+    NotConnected,
+
+    /// A server is connected and available for requests.
+    Connected(Bridge<'a>),
+
+    /// Access to the bridge is being exclusively acquired
+    /// (e.g. during `BridgeState::with`).
+    InUse,
+}
+
+enum BridgeStateL {}
+
+impl<'a> scoped_cell::ApplyL<'a> for BridgeStateL {
+    type Out = BridgeState<'a>;
+}
+
+thread_local! {
+    static BRIDGE_STATE: scoped_cell::ScopedCell<BridgeStateL> =
+        scoped_cell::ScopedCell::new(BridgeState::NotConnected);
+}
+
+impl BridgeState<'_> {
+    /// Take exclusive control of the thread-local
+    /// `BridgeState`, and pass it to `f`, mutably.
+    /// The state will be restored after `f` exits, even
+    /// by panic, including modifications made to it by `f`.
+    ///
+    /// NB: while `f` is running, the thread-local state
+    /// is `BridgeState::InUse`.
+    fn with<R>(f: impl FnOnce(&mut BridgeState) -> R) -> R {
+        BRIDGE_STATE.with(|state| {
+            state.replace(BridgeState::InUse, |mut state| {
+                // FIXME(#52812) pass `f` directly to `replace` when `RefMutL` is gone
+                f(&mut *state)
+            })
+        })
+    }
+}
+
+impl Bridge<'_> {
+    fn enter<R>(self, f: impl FnOnce() -> R) -> R {
+        // Hide the default panic output within `proc_macro` expansions.
+        // NB. the server can't do this because it may use a different libstd.
+        static HIDE_PANICS_DURING_EXPANSION: Once = Once::new();
+        HIDE_PANICS_DURING_EXPANSION.call_once(|| {
+            let prev = panic::take_hook();
+            panic::set_hook(Box::new(move |info| {
+                let hide = BridgeState::with(|state| match state {
+                    BridgeState::NotConnected => false,
+                    BridgeState::Connected(_) | BridgeState::InUse => true,
+                });
+                if !hide {
+                    prev(info)
+                }
+            }));
+        });
+
+        BRIDGE_STATE.with(|state| state.set(BridgeState::Connected(self), f))
+    }
+
+    fn with<R>(f: impl FnOnce(&mut Bridge) -> R) -> R {
+        BridgeState::with(|state| match state {
+            BridgeState::NotConnected => {
+                panic!("procedural macro API is used outside of a procedural macro");
+            }
+            BridgeState::InUse => {
+                panic!("procedural macro API is used while it's already in use");
+            }
+            BridgeState::Connected(bridge) => f(bridge),
+        })
+    }
+}
+
+/// A client-side "global object" (usually a function pointer),
+/// which may be using a different `proc_macro` from the one
+/// used by the server, but can be interacted with compatibly.
+///
+/// NB: `F` must have FFI-friendly memory layout (e.g. a pointer).
+/// The call ABI of function pointers used for `F` doesn't
+/// need to match between server and client, since it's only
+/// passed between them and (eventually) called by the client.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct Client<F> {
+    pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters,
+    pub(super) run: extern "C" fn(Bridge, F) -> Buffer<u8>,
+    pub(super) f: F,
+}
+
+// FIXME(#53451) public to work around `Cannot create local mono-item` ICE,
+// affecting not only the function itself, but also the `BridgeState` `thread_local!`.
+pub extern "C" fn __run_expand1(
+    mut bridge: Bridge,
+    f: fn(::TokenStream) -> ::TokenStream,
+) -> Buffer<u8> {
+    // The initial `cached_buffer` contains the input.
+    let mut b = bridge.cached_buffer.take();
+
+    panic::catch_unwind(panic::AssertUnwindSafe(|| {
+        bridge.enter(|| {
+            let reader = &mut &b[..];
+            let input = TokenStream::decode(reader, &mut ());
+
+            // Put the `cached_buffer` back in the `Bridge`, for requests.
+            Bridge::with(|bridge| bridge.cached_buffer = b.take());
+
+            let output = f(::TokenStream(input)).0;
+
+            // Take the `cached_buffer` back out, for the output value.
+            b = Bridge::with(|bridge| bridge.cached_buffer.take());
+
+            // HACK(eddyb) Separate encoding a success value (`Ok(output)`)
+            // from encoding a panic (`Err(e: PanicMessage)`) to avoid
+            // having handles outside the `bridge.enter(|| ...)` scope, and
+            // to catch panics that could happen while encoding the success.
+            //
+            // Note that panics should be impossible beyond this point, but
+            // this is defensively trying to avoid any accidental panicking
+            // reaching the `extern "C"` (which should `abort` but may not
+            // at the moment, so this is also potentially preventing UB).
+            b.clear();
+            Ok::<_, ()>(output).encode(&mut b, &mut ());
+        })
+    }))
+    .map_err(PanicMessage::from)
+    .unwrap_or_else(|e| {
+        b.clear();
+        Err::<(), _>(e).encode(&mut b, &mut ());
+    });
+    b
+}
+
+impl Client<fn(::TokenStream) -> ::TokenStream> {
+    pub const fn expand1(f: fn(::TokenStream) -> ::TokenStream) -> Self {
+        Client {
+            get_handle_counters: HandleCounters::get,
+            run: __run_expand1,
+            f,
+        }
+    }
+}
+
+// FIXME(#53451) public to work around `Cannot create local mono-item` ICE,
+// affecting not only the function itself, but also the `BridgeState` `thread_local!`.
+pub extern "C" fn __run_expand2(
+    mut bridge: Bridge,
+    f: fn(::TokenStream, ::TokenStream) -> ::TokenStream,
+) -> Buffer<u8> {
+    // The initial `cached_buffer` contains the input.
+    let mut b = bridge.cached_buffer.take();
+
+    panic::catch_unwind(panic::AssertUnwindSafe(|| {
+        bridge.enter(|| {
+            let reader = &mut &b[..];
+            let input = TokenStream::decode(reader, &mut ());
+            let input2 = TokenStream::decode(reader, &mut ());
+
+            // Put the `cached_buffer` back in the `Bridge`, for requests.
+            Bridge::with(|bridge| bridge.cached_buffer = b.take());
+
+            let output = f(::TokenStream(input), ::TokenStream(input2)).0;
+
+            // Take the `cached_buffer` back out, for the output value.
+            b = Bridge::with(|bridge| bridge.cached_buffer.take());
+
+            // HACK(eddyb) Separate encoding a success value (`Ok(output)`)
+            // from encoding a panic (`Err(e: PanicMessage)`) to avoid
+            // having handles outside the `bridge.enter(|| ...)` scope, and
+            // to catch panics that could happen while encoding the success.
+            //
+            // Note that panics should be impossible beyond this point, but
+            // this is defensively trying to avoid any accidental panicking
+            // reaching the `extern "C"` (which should `abort` but may not
+            // at the moment, so this is also potentially preventing UB).
+            b.clear();
+            Ok::<_, ()>(output).encode(&mut b, &mut ());
+        })
+    }))
+    .map_err(PanicMessage::from)
+    .unwrap_or_else(|e| {
+        b.clear();
+        Err::<(), _>(e).encode(&mut b, &mut ());
+    });
+    b
+}
+
+impl Client<fn(::TokenStream, ::TokenStream) -> ::TokenStream> {
+    pub const fn expand2(f: fn(::TokenStream, ::TokenStream) -> ::TokenStream) -> Self {
+        Client {
+            get_handle_counters: HandleCounters::get,
+            run: __run_expand2,
+            f,
+        }
+    }
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub enum ProcMacro {
+    CustomDerive {
+        trait_name: &'static str,
+        attributes: &'static [&'static str],
+        client: Client<fn(::TokenStream) -> ::TokenStream>,
+    },
+
+    Attr {
+        name: &'static str,
+        client: Client<fn(::TokenStream, ::TokenStream) -> ::TokenStream>,
+    },
+
+    Bang {
+        name: &'static str,
+        client: Client<fn(::TokenStream) -> ::TokenStream>,
+    },
+}
+
+impl ProcMacro {
+    pub const fn custom_derive(
+        trait_name: &'static str,
+        attributes: &'static [&'static str],
+        expand: fn(::TokenStream) -> ::TokenStream,
+    ) -> Self {
+        ProcMacro::CustomDerive {
+            trait_name,
+            attributes,
+            client: Client::expand1(expand),
+        }
+    }
+
+    pub const fn attr(
+        name: &'static str,
+        expand: fn(::TokenStream, ::TokenStream) -> ::TokenStream,
+    ) -> Self {
+        ProcMacro::Attr {
+            name,
+            client: Client::expand2(expand),
+        }
+    }
+
+    pub const fn bang(name: &'static str, expand: fn(::TokenStream) -> ::TokenStream) -> Self {
+        ProcMacro::Bang {
+            name,
+            client: Client::expand1(expand),
+        }
+    }
+}
diff --git a/src/libproc_macro/bridge/closure.rs b/src/libproc_macro/bridge/closure.rs
new file mode 100644
index 00000000000..92fe7baae09
--- /dev/null
+++ b/src/libproc_macro/bridge/closure.rs
@@ -0,0 +1,42 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Closure type (equivalent to `&mut dyn FnMut(A) -> R`) that's `repr(C)`.
+
+#[repr(C)]
+pub struct Closure<'a, A, R> {
+    call: unsafe extern "C" fn(&mut Env, A) -> R,
+    env: &'a mut Env,
+}
+
+extern "C" {
+    type Env;
+}
+
+impl<'a, A, R> !Sync for Closure<'a, A, R> {}
+impl<'a, A, R> !Send for Closure<'a, A, R> {}
+
+impl<'a, A, R, F: FnMut(A) -> R> From<&'a mut F> for Closure<'a, A, R> {
+    fn from(f: &'a mut F) -> Self {
+        unsafe extern "C" fn call<A, R, F: FnMut(A) -> R>(env: &mut Env, arg: A) -> R {
+            (*(env as *mut _ as *mut F))(arg)
+        }
+        Closure {
+            call: call::<A, R, F>,
+            env: unsafe { &mut *(f as *mut _ as *mut Env) },
+        }
+    }
+}
+
+impl<'a, A, R> Closure<'a, A, R> {
+    pub fn call(&mut self, arg: A) -> R {
+        unsafe { (self.call)(self.env, arg) }
+    }
+}
diff --git a/src/libproc_macro/bridge/handle.rs b/src/libproc_macro/bridge/handle.rs
new file mode 100644
index 00000000000..5c91a1408a4
--- /dev/null
+++ b/src/libproc_macro/bridge/handle.rs
@@ -0,0 +1,92 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Server-side handles and storage for per-handle data.
+
+use std::collections::{BTreeMap, HashMap};
+use std::hash::Hash;
+use std::num::NonZeroU32;
+use std::ops::{Index, IndexMut};
+use std::sync::atomic::{AtomicUsize, Ordering};
+
+pub(super) type Handle = NonZeroU32;
+
+pub(super) struct OwnedStore<T: 'static> {
+    counter: &'static AtomicUsize,
+    data: BTreeMap<Handle, T>,
+}
+
+impl<T> OwnedStore<T> {
+    pub(super) fn new(counter: &'static AtomicUsize) -> Self {
+        // Ensure the handle counter isn't 0, which would panic later,
+        // when `NonZeroU32::new` (aka `Handle::new`) is called in `alloc`.
+        assert_ne!(counter.load(Ordering::SeqCst), 0);
+
+        OwnedStore {
+            counter,
+            data: BTreeMap::new(),
+        }
+    }
+}
+
+impl<T> OwnedStore<T> {
+    pub(super) fn alloc(&mut self, x: T) -> Handle {
+        let counter = self.counter.fetch_add(1, Ordering::SeqCst);
+        let handle = Handle::new(counter as u32).expect("`proc_macro` handle counter overflowed");
+        assert!(self.data.insert(handle, x).is_none());
+        handle
+    }
+
+    pub(super) fn take(&mut self, h: Handle) -> T {
+        self.data
+            .remove(&h)
+            .expect("use-after-free in `proc_macro` handle")
+    }
+}
+
+impl<T> Index<Handle> for OwnedStore<T> {
+    type Output = T;
+    fn index(&self, h: Handle) -> &T {
+        self.data
+            .get(&h)
+            .expect("use-after-free in `proc_macro` handle")
+    }
+}
+
+impl<T> IndexMut<Handle> for OwnedStore<T> {
+    fn index_mut(&mut self, h: Handle) -> &mut T {
+        self.data
+            .get_mut(&h)
+            .expect("use-after-free in `proc_macro` handle")
+    }
+}
+
+pub(super) struct InternedStore<T: 'static> {
+    owned: OwnedStore<T>,
+    interner: HashMap<T, Handle>,
+}
+
+impl<T: Copy + Eq + Hash> InternedStore<T> {
+    pub(super) fn new(counter: &'static AtomicUsize) -> Self {
+        InternedStore {
+            owned: OwnedStore::new(counter),
+            interner: HashMap::new(),
+        }
+    }
+
+    pub(super) fn alloc(&mut self, x: T) -> Handle {
+        let owned = &mut self.owned;
+        *self.interner.entry(x).or_insert_with(|| owned.alloc(x))
+    }
+
+    pub(super) fn copy(&mut self, h: Handle) -> T {
+        self.owned[h]
+    }
+}
diff --git a/src/libproc_macro/bridge/mod.rs b/src/libproc_macro/bridge/mod.rs
new file mode 100644
index 00000000000..f03c63fc04c
--- /dev/null
+++ b/src/libproc_macro/bridge/mod.rs
@@ -0,0 +1,413 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Internal interface for communicating between a `proc_macro` client
+//! (a proc macro crate) and a `proc_macro` server (a compiler front-end).
+//!
+//! Serialization (with C ABI buffers) and unique integer handles are employed
+//! to allow safely interfacing between two copies of `proc_macro` built
+//! (from the same source) by different compilers with potentially mismatching
+//! Rust ABIs (e.g. stage0/bin/rustc vs stage1/bin/rustc during bootstrap).
+
+#![deny(unsafe_code)]
+
+use std::fmt;
+use std::hash::Hash;
+use std::marker;
+use std::mem;
+use std::ops::Bound;
+use std::panic;
+use std::sync::atomic::AtomicUsize;
+use std::sync::Once;
+use std::thread;
+use {Delimiter, Level, LineColumn, Spacing};
+
+/// Higher-order macro describing the server RPC API, allowing automatic
+/// generation of type-safe Rust APIs, both client-side and server-side.
+///
+/// `with_api!(MySelf, my_self, my_macro)` expands to:
+/// ```rust,ignore (pseudo-code)
+/// my_macro! {
+///     // ...
+///     Literal {
+///         // ...
+///         fn character(ch: char) -> MySelf::Literal;
+///         // ...
+///         fn span(my_self: &MySelf::Literal) -> MySelf::Span;
+///         fn set_span(my_self: &mut MySelf::Literal, span: MySelf::Span);
+///     },
+///     // ...
+/// }
+/// ```
+///
+/// The first two arguments serve to customize the arguments names
+/// and argument/return types, to enable several different usecases:
+///
+/// If `my_self` is just `self`, then each `fn` signature can be used
+/// as-is for a method. If it's anything else (`self_` in practice),
+/// then the signatures don't have a special `self` argument, and
+/// can, therefore, have a different one introduced.
+///
+/// If `MySelf` is just `Self`, then the types are only valid inside
+/// a trait or a trait impl, where the trait has associated types
+/// for each of the API types. If non-associated types are desired,
+/// a module name (`self` in practice) can be used instead of `Self`.
+macro_rules! with_api {
+    ($S:ident, $self:ident, $m:ident) => {
+        $m! {
+            TokenStream {
+                fn drop($self: $S::TokenStream);
+                fn clone($self: &$S::TokenStream) -> $S::TokenStream;
+                fn new() -> $S::TokenStream;
+                fn is_empty($self: &$S::TokenStream) -> bool;
+                fn from_str(src: &str) -> $S::TokenStream;
+                fn to_string($self: &$S::TokenStream) -> String;
+                fn from_token_tree(
+                    tree: TokenTree<$S::Group, $S::Punct, $S::Ident, $S::Literal>,
+                ) -> $S::TokenStream;
+                fn into_iter($self: $S::TokenStream) -> $S::TokenStreamIter;
+            },
+            TokenStreamBuilder {
+                fn drop($self: $S::TokenStreamBuilder);
+                fn new() -> $S::TokenStreamBuilder;
+                fn push($self: &mut $S::TokenStreamBuilder, stream: $S::TokenStream);
+                fn build($self: $S::TokenStreamBuilder) -> $S::TokenStream;
+            },
+            TokenStreamIter {
+                fn drop($self: $S::TokenStreamIter);
+                fn clone($self: &$S::TokenStreamIter) -> $S::TokenStreamIter;
+                fn next(
+                    $self: &mut $S::TokenStreamIter,
+                ) -> Option<TokenTree<$S::Group, $S::Punct, $S::Ident, $S::Literal>>;
+            },
+            Group {
+                fn drop($self: $S::Group);
+                fn clone($self: &$S::Group) -> $S::Group;
+                fn new(delimiter: Delimiter, stream: $S::TokenStream) -> $S::Group;
+                fn delimiter($self: &$S::Group) -> Delimiter;
+                fn stream($self: &$S::Group) -> $S::TokenStream;
+                fn span($self: &$S::Group) -> $S::Span;
+                fn span_open($self: &$S::Group) -> $S::Span;
+                fn span_close($self: &$S::Group) -> $S::Span;
+                fn set_span($self: &mut $S::Group, span: $S::Span);
+            },
+            Punct {
+                fn new(ch: char, spacing: Spacing) -> $S::Punct;
+                fn as_char($self: $S::Punct) -> char;
+                fn spacing($self: $S::Punct) -> Spacing;
+                fn span($self: $S::Punct) -> $S::Span;
+                fn with_span($self: $S::Punct, span: $S::Span) -> $S::Punct;
+            },
+            Ident {
+                fn new(string: &str, span: $S::Span, is_raw: bool) -> $S::Ident;
+                fn span($self: $S::Ident) -> $S::Span;
+                fn with_span($self: $S::Ident, span: $S::Span) -> $S::Ident;
+            },
+            Literal {
+                fn drop($self: $S::Literal);
+                fn clone($self: &$S::Literal) -> $S::Literal;
+                // FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
+                fn debug($self: &$S::Literal) -> String;
+                fn integer(n: &str) -> $S::Literal;
+                fn typed_integer(n: &str, kind: &str) -> $S::Literal;
+                fn float(n: &str) -> $S::Literal;
+                fn f32(n: &str) -> $S::Literal;
+                fn f64(n: &str) -> $S::Literal;
+                fn string(string: &str) -> $S::Literal;
+                fn character(ch: char) -> $S::Literal;
+                fn byte_string(bytes: &[u8]) -> $S::Literal;
+                fn span($self: &$S::Literal) -> $S::Span;
+                fn set_span($self: &mut $S::Literal, span: $S::Span);
+                fn subspan(
+                    $self: &$S::Literal,
+                    start: Bound<usize>,
+                    end: Bound<usize>,
+                ) -> Option<$S::Span>;
+            },
+            SourceFile {
+                fn drop($self: $S::SourceFile);
+                fn clone($self: &$S::SourceFile) -> $S::SourceFile;
+                fn eq($self: &$S::SourceFile, other: &$S::SourceFile) -> bool;
+                fn path($self: &$S::SourceFile) -> String;
+                fn is_real($self: &$S::SourceFile) -> bool;
+            },
+            MultiSpan {
+                fn drop($self: $S::MultiSpan);
+                fn new() -> $S::MultiSpan;
+                fn push($self: &mut $S::MultiSpan, span: $S::Span);
+            },
+            Diagnostic {
+                fn drop($self: $S::Diagnostic);
+                fn new(level: Level, msg: &str, span: $S::MultiSpan) -> $S::Diagnostic;
+                fn sub(
+                    $self: &mut $S::Diagnostic,
+                    level: Level,
+                    msg: &str,
+                    span: $S::MultiSpan,
+                );
+                fn emit($self: $S::Diagnostic);
+            },
+            Span {
+                fn debug($self: $S::Span) -> String;
+                fn def_site() -> $S::Span;
+                fn call_site() -> $S::Span;
+                fn source_file($self: $S::Span) -> $S::SourceFile;
+                fn parent($self: $S::Span) -> Option<$S::Span>;
+                fn source($self: $S::Span) -> $S::Span;
+                fn start($self: $S::Span) -> LineColumn;
+                fn end($self: $S::Span) -> LineColumn;
+                fn join($self: $S::Span, other: $S::Span) -> Option<$S::Span>;
+                fn resolved_at($self: $S::Span, at: $S::Span) -> $S::Span;
+            },
+        }
+    };
+}
+
+// FIXME(eddyb) this calls `encode` for each argument, but in reverse,
+// to avoid borrow conflicts from borrows started by `&mut` arguments.
+macro_rules! reverse_encode {
+    ($writer:ident;) => {};
+    ($writer:ident; $first:ident $(, $rest:ident)*) => {
+        reverse_encode!($writer; $($rest),*);
+        $first.encode(&mut $writer, &mut ());
+    }
+}
+
+// FIXME(eddyb) this calls `decode` for each argument, but in reverse,
+// to avoid borrow conflicts from borrows started by `&mut` arguments.
+macro_rules! reverse_decode {
+    ($reader:ident, $s:ident;) => {};
+    ($reader:ident, $s:ident; $first:ident: $first_ty:ty $(, $rest:ident: $rest_ty:ty)*) => {
+        reverse_decode!($reader, $s; $($rest: $rest_ty),*);
+        let $first = <$first_ty>::decode(&mut $reader, $s);
+    }
+}
+
+#[allow(unsafe_code)]
+mod buffer;
+#[forbid(unsafe_code)]
+pub mod client;
+#[allow(unsafe_code)]
+mod closure;
+#[forbid(unsafe_code)]
+mod handle;
+#[macro_use]
+#[forbid(unsafe_code)]
+mod rpc;
+#[allow(unsafe_code)]
+mod scoped_cell;
+#[forbid(unsafe_code)]
+pub mod server;
+
+use self::buffer::Buffer;
+pub use self::rpc::PanicMessage;
+use self::rpc::{Decode, DecodeMut, Encode, Reader, Writer};
+
+/// An active connection between a server and a client.
+/// The server creates the bridge (`Bridge::run_server` in `server.rs`),
+/// then passes it to the client through the function pointer in the `run`
+/// field of `client::Client`. The client holds its copy of the `Bridge`
+/// in TLS during its execution (`Bridge::{enter, with}` in `client.rs`).
+#[repr(C)]
+pub struct Bridge<'a> {
+    /// Reusable buffer (only `clear`-ed, never shrunk), primarily
+    /// used for making requests, but also for passing input to client.
+    cached_buffer: Buffer<u8>,
+
+    /// Server-side function that the client uses to make requests.
+    dispatch: closure::Closure<'a, Buffer<u8>, Buffer<u8>>,
+}
+
+impl<'a> !Sync for Bridge<'a> {}
+impl<'a> !Send for Bridge<'a> {}
+
+#[forbid(unsafe_code)]
+#[allow(non_camel_case_types)]
+mod api_tags {
+    use super::rpc::{DecodeMut, Encode, Reader, Writer};
+
+    macro_rules! declare_tags {
+        ($($name:ident {
+            $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
+        }),* $(,)*) => {
+            $(
+                pub(super) enum $name {
+                    $($method),*
+                }
+                rpc_encode_decode!(enum $name { $($method),* });
+            )*
+
+
+            pub(super) enum Method {
+                $($name($name)),*
+            }
+            rpc_encode_decode!(enum Method { $($name(m)),* });
+        }
+    }
+    with_api!(self, self, declare_tags);
+}
+
+/// Helper to wrap associated types to allow trait impl dispatch.
+/// That is, normally a pair of impls for `T::Foo` and `T::Bar`
+/// can overlap, but if the impls are, instead, on types like
+/// `Marked<T::Foo, Foo>` and `Marked<T::Bar, Bar>`, they can't.
+trait Mark {
+    type Unmarked;
+    fn mark(unmarked: Self::Unmarked) -> Self;
+}
+
+/// Unwrap types wrapped by `Mark::mark` (see `Mark` for details).
+trait Unmark {
+    type Unmarked;
+    fn unmark(self) -> Self::Unmarked;
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
+struct Marked<T, M> {
+    value: T,
+    _marker: marker::PhantomData<M>,
+}
+
+impl<T, M> Mark for Marked<T, M> {
+    type Unmarked = T;
+    fn mark(unmarked: Self::Unmarked) -> Self {
+        Marked {
+            value: unmarked,
+            _marker: marker::PhantomData,
+        }
+    }
+}
+impl<T, M> Unmark for Marked<T, M> {
+    type Unmarked = T;
+    fn unmark(self) -> Self::Unmarked {
+        self.value
+    }
+}
+impl<T, M> Unmark for &'a Marked<T, M> {
+    type Unmarked = &'a T;
+    fn unmark(self) -> Self::Unmarked {
+        &self.value
+    }
+}
+impl<T, M> Unmark for &'a mut Marked<T, M> {
+    type Unmarked = &'a mut T;
+    fn unmark(self) -> Self::Unmarked {
+        &mut self.value
+    }
+}
+
+impl<T: Mark> Mark for Option<T> {
+    type Unmarked = Option<T::Unmarked>;
+    fn mark(unmarked: Self::Unmarked) -> Self {
+        unmarked.map(T::mark)
+    }
+}
+impl<T: Unmark> Unmark for Option<T> {
+    type Unmarked = Option<T::Unmarked>;
+    fn unmark(self) -> Self::Unmarked {
+        self.map(T::unmark)
+    }
+}
+
+macro_rules! mark_noop {
+    ($($ty:ty),* $(,)*) => {
+        $(
+            impl Mark for $ty {
+                type Unmarked = Self;
+                fn mark(unmarked: Self::Unmarked) -> Self {
+                    unmarked
+                }
+            }
+            impl Unmark for $ty {
+                type Unmarked = Self;
+                fn unmark(self) -> Self::Unmarked {
+                    self
+                }
+            }
+        )*
+    }
+}
+mark_noop! {
+    (),
+    bool,
+    char,
+    &'a [u8],
+    &'a str,
+    String,
+    Delimiter,
+    Level,
+    LineColumn,
+    Spacing,
+    Bound<usize>,
+}
+
+rpc_encode_decode!(
+    enum Delimiter {
+        Parenthesis,
+        Brace,
+        Bracket,
+        None,
+    }
+);
+rpc_encode_decode!(
+    enum Level {
+        Error,
+        Warning,
+        Note,
+        Help,
+    }
+);
+rpc_encode_decode!(struct LineColumn { line, column });
+rpc_encode_decode!(
+    enum Spacing {
+        Alone,
+        Joint,
+    }
+);
+
+#[derive(Clone)]
+pub enum TokenTree<G, P, I, L> {
+    Group(G),
+    Punct(P),
+    Ident(I),
+    Literal(L),
+}
+
+impl<G: Mark, P: Mark, I: Mark, L: Mark> Mark for TokenTree<G, P, I, L> {
+    type Unmarked = TokenTree<G::Unmarked, P::Unmarked, I::Unmarked, L::Unmarked>;
+    fn mark(unmarked: Self::Unmarked) -> Self {
+        match unmarked {
+            TokenTree::Group(tt) => TokenTree::Group(G::mark(tt)),
+            TokenTree::Punct(tt) => TokenTree::Punct(P::mark(tt)),
+            TokenTree::Ident(tt) => TokenTree::Ident(I::mark(tt)),
+            TokenTree::Literal(tt) => TokenTree::Literal(L::mark(tt)),
+        }
+    }
+}
+impl<G: Unmark, P: Unmark, I: Unmark, L: Unmark> Unmark for TokenTree<G, P, I, L> {
+    type Unmarked = TokenTree<G::Unmarked, P::Unmarked, I::Unmarked, L::Unmarked>;
+    fn unmark(self) -> Self::Unmarked {
+        match self {
+            TokenTree::Group(tt) => TokenTree::Group(tt.unmark()),
+            TokenTree::Punct(tt) => TokenTree::Punct(tt.unmark()),
+            TokenTree::Ident(tt) => TokenTree::Ident(tt.unmark()),
+            TokenTree::Literal(tt) => TokenTree::Literal(tt.unmark()),
+        }
+    }
+}
+
+rpc_encode_decode!(
+    enum TokenTree<G, P, I, L> {
+        Group(tt),
+        Punct(tt),
+        Ident(tt),
+        Literal(tt),
+    }
+);
diff --git a/src/libproc_macro/bridge/rpc.rs b/src/libproc_macro/bridge/rpc.rs
new file mode 100644
index 00000000000..fafc3d00740
--- /dev/null
+++ b/src/libproc_macro/bridge/rpc.rs
@@ -0,0 +1,319 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Serialization for client<->server communication.
+
+use std::any::Any;
+use std::char;
+use std::io::Write;
+use std::num::NonZeroU32;
+use std::ops::Bound;
+use std::str;
+
+pub(super) type Writer = super::buffer::Buffer<u8>;
+
+pub(super) trait Encode<S>: Sized {
+    fn encode(self, w: &mut Writer, s: &mut S);
+}
+
+pub(super) type Reader<'a> = &'a [u8];
+
+pub(super) trait Decode<'a, 's, S>: Sized {
+    fn decode(r: &mut Reader<'a>, s: &'s S) -> Self;
+}
+
+pub(super) trait DecodeMut<'a, 's, S>: Sized {
+    fn decode(r: &mut Reader<'a>, s: &'s mut S) -> Self;
+}
+
+macro_rules! rpc_encode_decode {
+    (uleb128 $ty:ty) => {
+        impl<S> Encode<S> for $ty {
+            fn encode(mut self, w: &mut Writer, s: &mut S) {
+                let mut byte = 0x80;
+                while byte & 0x80 != 0 {
+                    byte = (self & 0x7f) as u8;
+                    self >>= 7;
+                    if self != 0 {
+                        byte |= 0x80;
+                    }
+                    byte.encode(w, s);
+                }
+            }
+        }
+
+        impl<S> DecodeMut<'_, '_, S> for $ty {
+            fn decode(r: &mut Reader, s: &mut S) -> Self {
+                let mut byte = 0x80;
+                let mut v = 0;
+                let mut shift = 0;
+                while byte & 0x80 != 0 {
+                    byte = u8::decode(r, s);
+                    v |= ((byte & 0x7f) as Self) << shift;
+                    shift += 7;
+                }
+                v
+            }
+        }
+    };
+    (struct $name:ident { $($field:ident),* $(,)* }) => {
+        impl<S> Encode<S> for $name {
+            fn encode(self, w: &mut Writer, s: &mut S) {
+                $(self.$field.encode(w, s);)*
+            }
+        }
+
+        impl<S> DecodeMut<'_, '_, S> for $name {
+            fn decode(r: &mut Reader, s: &mut S) -> Self {
+                $name {
+                    $($field: DecodeMut::decode(r, s)),*
+                }
+            }
+        }
+    };
+    (enum $name:ident $(<$($T:ident),+>)* { $($variant:ident $(($field:ident))*),* $(,)* }) => {
+        impl<S, $($($T: Encode<S>),+)*> Encode<S> for $name $(<$($T),+>)* {
+            fn encode(self, w: &mut Writer, s: &mut S) {
+                // HACK(eddyb) `Tag` enum duplicated between the
+                // two impls as there's no other place to stash it.
+                #[repr(u8)] enum Tag { $($variant),* }
+                #[allow(non_upper_case_globals)]
+                impl Tag { $(const $variant: u8 = Tag::$variant as u8;)* }
+
+                match self {
+                    $($name::$variant $(($field))* => {
+                        <Tag>::$variant.encode(w, s);
+                        $($field.encode(w, s);)*
+                    })*
+                }
+            }
+        }
+
+        impl<S, $($($T: for<'s> DecodeMut<'a, 's, S>),+)*> DecodeMut<'a, '_, S>
+            for $name $(<$($T),+>)*
+        {
+            fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
+                // HACK(eddyb) `Tag` enum duplicated between the
+                // two impls as there's no other place to stash it.
+                #[repr(u8)] enum Tag { $($variant),* }
+                #[allow(non_upper_case_globals)]
+                impl Tag { $(const $variant: u8 = Tag::$variant as u8;)* }
+
+                match u8::decode(r, s) {
+                    $(<Tag>::$variant => {
+                        $(let $field = DecodeMut::decode(r, s);)*
+                        $name::$variant $(($field))*
+                    })*
+                    _ => unreachable!(),
+                }
+            }
+        }
+    }
+}
+
+impl<S> Encode<S> for () {
+    fn encode(self, _: &mut Writer, _: &mut S) {}
+}
+
+impl<S> DecodeMut<'_, '_, S> for () {
+    fn decode(_: &mut Reader, _: &mut S) -> Self {}
+}
+
+impl<S> Encode<S> for u8 {
+    fn encode(self, w: &mut Writer, _: &mut S) {
+        w.write_all(&[self]).unwrap();
+    }
+}
+
+impl<S> DecodeMut<'_, '_, S> for u8 {
+    fn decode(r: &mut Reader, _: &mut S) -> Self {
+        let x = r[0];
+        *r = &r[1..];
+        x
+    }
+}
+
+rpc_encode_decode!(uleb128 u32);
+rpc_encode_decode!(uleb128 usize);
+
+impl<S> Encode<S> for bool {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        (self as u8).encode(w, s);
+    }
+}
+
+impl<S> DecodeMut<'_, '_, S> for bool {
+    fn decode(r: &mut Reader, s: &mut S) -> Self {
+        match u8::decode(r, s) {
+            0 => false,
+            1 => true,
+            _ => unreachable!(),
+        }
+    }
+}
+
+impl<S> Encode<S> for char {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        (self as u32).encode(w, s);
+    }
+}
+
+impl<S> DecodeMut<'_, '_, S> for char {
+    fn decode(r: &mut Reader, s: &mut S) -> Self {
+        char::from_u32(u32::decode(r, s)).unwrap()
+    }
+}
+
+impl<S> Encode<S> for NonZeroU32 {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        self.get().encode(w, s);
+    }
+}
+
+impl<S> DecodeMut<'_, '_, S> for NonZeroU32 {
+    fn decode(r: &mut Reader, s: &mut S) -> Self {
+        Self::new(u32::decode(r, s)).unwrap()
+    }
+}
+
+impl<S, A: Encode<S>, B: Encode<S>> Encode<S> for (A, B) {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        self.0.encode(w, s);
+        self.1.encode(w, s);
+    }
+}
+
+impl<S, A: for<'s> DecodeMut<'a, 's, S>, B: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S>
+    for (A, B)
+{
+    fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
+        (DecodeMut::decode(r, s), DecodeMut::decode(r, s))
+    }
+}
+
+rpc_encode_decode!(
+    enum Bound<T> {
+        Included(x),
+        Excluded(x),
+        Unbounded,
+    }
+);
+
+rpc_encode_decode!(
+    enum Option<T> {
+        None,
+        Some(x),
+    }
+);
+
+rpc_encode_decode!(
+    enum Result<T, E> {
+        Ok(x),
+        Err(e),
+    }
+);
+
+impl<S> Encode<S> for &[u8] {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        self.len().encode(w, s);
+        w.write_all(self).unwrap();
+    }
+}
+
+impl<S> DecodeMut<'a, '_, S> for &'a [u8] {
+    fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
+        let len = usize::decode(r, s);
+        let xs = &r[..len];
+        *r = &r[len..];
+        xs
+    }
+}
+
+impl<S> Encode<S> for &str {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        self.as_bytes().encode(w, s);
+    }
+}
+
+impl<S> DecodeMut<'a, '_, S> for &'a str {
+    fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
+        str::from_utf8(<&[u8]>::decode(r, s)).unwrap()
+    }
+}
+
+impl<S> Encode<S> for String {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        self[..].encode(w, s);
+    }
+}
+
+impl<S> DecodeMut<'_, '_, S> for String {
+    fn decode(r: &mut Reader, s: &mut S) -> Self {
+        <&str>::decode(r, s).to_string()
+    }
+}
+
+/// Simplied version of panic payloads, ignoring
+/// types other than `&'static str` and `String`.
+pub enum PanicMessage {
+    StaticStr(&'static str),
+    String(String),
+    Unknown,
+}
+
+impl From<Box<dyn Any + Send>> for PanicMessage {
+    fn from(payload: Box<dyn Any + Send + 'static>) -> Self {
+        if let Some(s) = payload.downcast_ref::<&'static str>() {
+            return PanicMessage::StaticStr(s);
+        }
+        if let Ok(s) = payload.downcast::<String>() {
+            return PanicMessage::String(*s);
+        }
+        PanicMessage::Unknown
+    }
+}
+
+impl Into<Box<dyn Any + Send>> for PanicMessage {
+    fn into(self) -> Box<dyn Any + Send> {
+        match self {
+            PanicMessage::StaticStr(s) => Box::new(s),
+            PanicMessage::String(s) => Box::new(s),
+            PanicMessage::Unknown => {
+                struct UnknownPanicMessage;
+                Box::new(UnknownPanicMessage)
+            }
+        }
+    }
+}
+
+impl PanicMessage {
+    pub fn as_str(&self) -> Option<&str> {
+        match self {
+            PanicMessage::StaticStr(s) => Some(s),
+            PanicMessage::String(s) => Some(s),
+            PanicMessage::Unknown => None,
+        }
+    }
+}
+
+impl<S> Encode<S> for PanicMessage {
+    fn encode(self, w: &mut Writer, s: &mut S) {
+        self.as_str().encode(w, s);
+    }
+}
+
+impl<S> DecodeMut<'_, '_, S> for PanicMessage {
+    fn decode(r: &mut Reader, s: &mut S) -> Self {
+        match Option::<String>::decode(r, s) {
+            Some(s) => PanicMessage::String(s),
+            None => PanicMessage::Unknown,
+        }
+    }
+}
diff --git a/src/libproc_macro/bridge/scoped_cell.rs b/src/libproc_macro/bridge/scoped_cell.rs
new file mode 100644
index 00000000000..51d1fece79b
--- /dev/null
+++ b/src/libproc_macro/bridge/scoped_cell.rs
@@ -0,0 +1,90 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! `Cell` variant for (scoped) existential lifetimes.
+
+use std::cell::Cell;
+use std::mem;
+use std::ops::{Deref, DerefMut};
+
+/// Type lambda application, with a lifetime.
+pub trait ApplyL<'a> {
+    type Out;
+}
+
+/// Type lambda taking a lifetime, i.e. `Lifetime -> Type`.
+pub trait LambdaL: for<'a> ApplyL<'a> {}
+
+impl<T: for<'a> ApplyL<'a>> LambdaL for T {}
+
+// HACK(eddyb) work around projection limitations with a newtype
+// FIXME(#52812) replace with `&'a mut <T as ApplyL<'b>>::Out`
+pub struct RefMutL<'a, 'b, T: LambdaL>(&'a mut <T as ApplyL<'b>>::Out);
+
+impl<'a, 'b, T: LambdaL> Deref for RefMutL<'a, 'b, T> {
+    type Target = <T as ApplyL<'b>>::Out;
+    fn deref(&self) -> &Self::Target {
+        self.0
+    }
+}
+
+impl<'a, 'b, T: LambdaL> DerefMut for RefMutL<'a, 'b, T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        self.0
+    }
+}
+
+pub struct ScopedCell<T: LambdaL>(Cell<<T as ApplyL<'static>>::Out>);
+
+impl<T: LambdaL> ScopedCell<T> {
+    pub const fn new(value: <T as ApplyL<'static>>::Out) -> Self {
+        ScopedCell(Cell::new(value))
+    }
+
+    /// Set the value in `self` to `replacement` while
+    /// running `f`, which gets the old value, mutably.
+    /// The old value will be restored after `f` exits, even
+    /// by panic, including modifications made to it by `f`.
+    pub fn replace<'a, R>(
+        &self,
+        replacement: <T as ApplyL<'a>>::Out,
+        f: impl for<'b, 'c> FnOnce(RefMutL<'b, 'c, T>) -> R,
+    ) -> R {
+        /// Wrapper that ensures that the cell always gets filled
+        /// (with the original state, optionally changed by `f`),
+        /// even if `f` had panicked.
+        struct PutBackOnDrop<'a, T: LambdaL> {
+            cell: &'a ScopedCell<T>,
+            value: Option<<T as ApplyL<'static>>::Out>,
+        }
+
+        impl<'a, T: LambdaL> Drop for PutBackOnDrop<'a, T> {
+            fn drop(&mut self) {
+                self.cell.0.set(self.value.take().unwrap());
+            }
+        }
+
+        let mut put_back_on_drop = PutBackOnDrop {
+            cell: self,
+            value: Some(self.0.replace(unsafe {
+                let erased = mem::transmute_copy(&replacement);
+                mem::forget(replacement);
+                erased
+            })),
+        };
+
+        f(RefMutL(put_back_on_drop.value.as_mut().unwrap()))
+    }
+
+    /// Set the value in `self` to `value` while running `f`.
+    pub fn set<'a, R>(&self, value: <T as ApplyL<'a>>::Out, f: impl FnOnce() -> R) -> R {
+        self.replace(value, |_| f())
+    }
+}
diff --git a/src/libproc_macro/bridge/server.rs b/src/libproc_macro/bridge/server.rs
new file mode 100644
index 00000000000..f500b17d1ca
--- /dev/null
+++ b/src/libproc_macro/bridge/server.rs
@@ -0,0 +1,352 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Server-side traits.
+
+use super::*;
+
+// FIXME(eddyb) generate the definition of `HandleStore` in `server.rs`.
+use super::client::HandleStore;
+
+/// Declare an associated item of one of the traits below, optionally
+/// adjusting it (i.e. adding bounds to types and default bodies to methods).
+macro_rules! associated_item {
+    (type TokenStream) =>
+        (type TokenStream: 'static + Clone;);
+    (type TokenStreamBuilder) =>
+        (type TokenStreamBuilder: 'static;);
+    (type TokenStreamIter) =>
+        (type TokenStreamIter: 'static + Clone;);
+    (type Group) =>
+        (type Group: 'static + Clone;);
+    (type Punct) =>
+        (type Punct: 'static + Copy + Eq + Hash;);
+    (type Ident) =>
+        (type Ident: 'static + Copy + Eq + Hash;);
+    (type Literal) =>
+        (type Literal: 'static + Clone;);
+    (type SourceFile) =>
+        (type SourceFile: 'static + Clone;);
+    (type MultiSpan) =>
+        (type MultiSpan: 'static;);
+    (type Diagnostic) =>
+        (type Diagnostic: 'static;);
+    (type Span) =>
+        (type Span: 'static + Copy + Eq + Hash;);
+    (fn drop(&mut self, $arg:ident: $arg_ty:ty)) =>
+        (fn drop(&mut self, $arg: $arg_ty) { mem::drop($arg) });
+    (fn clone(&mut self, $arg:ident: $arg_ty:ty) -> $ret_ty:ty) =>
+        (fn clone(&mut self, $arg: $arg_ty) -> $ret_ty { $arg.clone() });
+    ($($item:tt)*) => ($($item)*;)
+}
+
+macro_rules! declare_server_traits {
+    ($($name:ident {
+        $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
+    }),* $(,)*) => {
+        pub trait Types {
+            $(associated_item!(type $name);)*
+        }
+
+        $(pub trait $name: Types {
+            $(associated_item!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)*);)*
+        })*
+
+        pub trait Server: Types $(+ $name)* {}
+        impl<S: Types $(+ $name)*> Server for S {}
+    }
+}
+with_api!(Self, self_, declare_server_traits);
+
+pub(super) struct MarkedTypes<S: Types>(S);
+
+macro_rules! define_mark_types_impls {
+    ($($name:ident {
+        $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
+    }),* $(,)*) => {
+        impl<S: Types> Types for MarkedTypes<S> {
+            $(type $name = Marked<S::$name, client::$name>;)*
+        }
+
+        $(impl<S: $name> $name for MarkedTypes<S> {
+            $(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)* {
+                <_>::mark($name::$method(&mut self.0, $($arg.unmark()),*))
+            })*
+        })*
+    }
+}
+with_api!(Self, self_, define_mark_types_impls);
+
+struct Dispatcher<S: Types> {
+    handle_store: HandleStore<S>,
+    server: S,
+}
+
+macro_rules! define_dispatcher_impl {
+    ($($name:ident {
+        $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
+    }),* $(,)*) => {
+        // FIXME(eddyb) `pub` only for `ExecutionStrategy` below.
+        pub trait DispatcherTrait {
+            // HACK(eddyb) these are here to allow `Self::$name` to work below.
+            $(type $name;)*
+            fn dispatch(&mut self, b: Buffer<u8>) -> Buffer<u8>;
+        }
+
+        impl<S: Server> DispatcherTrait for Dispatcher<MarkedTypes<S>> {
+            $(type $name = <MarkedTypes<S> as Types>::$name;)*
+            fn dispatch(&mut self, mut b: Buffer<u8>) -> Buffer<u8> {
+                let Dispatcher { handle_store, server } = self;
+
+                let mut reader = &b[..];
+                match api_tags::Method::decode(&mut reader, &mut ()) {
+                    $(api_tags::Method::$name(m) => match m {
+                        $(api_tags::$name::$method => {
+                            let mut call_method = || {
+                                reverse_decode!(reader, handle_store; $($arg: $arg_ty),*);
+                                $name::$method(server, $($arg),*)
+                            };
+                            // HACK(eddyb) don't use `panic::catch_unwind` in a panic.
+                            // If client and server happen to use the same `libstd`,
+                            // `catch_unwind` asserts that the panic counter was 0,
+                            // even when the closure passed to it didn't panic.
+                            let r = if thread::panicking() {
+                                Ok(call_method())
+                            } else {
+                                panic::catch_unwind(panic::AssertUnwindSafe(call_method))
+                                    .map_err(PanicMessage::from)
+                            };
+
+                            b.clear();
+                            r.encode(&mut b, handle_store);
+                        })*
+                    }),*
+                }
+                b
+            }
+        }
+    }
+}
+with_api!(Self, self_, define_dispatcher_impl);
+
+pub trait ExecutionStrategy {
+    fn run_bridge_and_client<D: Copy + Send + 'static>(
+        &self,
+        dispatcher: &mut impl DispatcherTrait,
+        input: Buffer<u8>,
+        run_client: extern "C" fn(Bridge, D) -> Buffer<u8>,
+        client_data: D,
+    ) -> Buffer<u8>;
+}
+
+pub struct SameThread;
+
+impl ExecutionStrategy for SameThread {
+    fn run_bridge_and_client<D: Copy + Send + 'static>(
+        &self,
+        dispatcher: &mut impl DispatcherTrait,
+        input: Buffer<u8>,
+        run_client: extern "C" fn(Bridge, D) -> Buffer<u8>,
+        client_data: D,
+    ) -> Buffer<u8> {
+        let mut dispatch = |b| dispatcher.dispatch(b);
+
+        run_client(
+            Bridge {
+                cached_buffer: input,
+                dispatch: (&mut dispatch).into(),
+            },
+            client_data,
+        )
+    }
+}
+
+// NOTE(eddyb) Two implementations are provided, the second one is a bit
+// faster but neither is anywhere near as fast as same-thread execution.
+
+pub struct CrossThread1;
+
+impl ExecutionStrategy for CrossThread1 {
+    fn run_bridge_and_client<D: Copy + Send + 'static>(
+        &self,
+        dispatcher: &mut impl DispatcherTrait,
+        input: Buffer<u8>,
+        run_client: extern "C" fn(Bridge, D) -> Buffer<u8>,
+        client_data: D,
+    ) -> Buffer<u8> {
+        use std::sync::mpsc::channel;
+
+        let (req_tx, req_rx) = channel();
+        let (res_tx, res_rx) = channel();
+
+        let join_handle = thread::spawn(move || {
+            let mut dispatch = |b| {
+                req_tx.send(b).unwrap();
+                res_rx.recv().unwrap()
+            };
+
+            run_client(
+                Bridge {
+                    cached_buffer: input,
+                    dispatch: (&mut dispatch).into(),
+                },
+                client_data,
+            )
+        });
+
+        for b in req_rx {
+            res_tx.send(dispatcher.dispatch(b)).unwrap();
+        }
+
+        join_handle.join().unwrap()
+    }
+}
+
+pub struct CrossThread2;
+
+impl ExecutionStrategy for CrossThread2 {
+    fn run_bridge_and_client<D: Copy + Send + 'static>(
+        &self,
+        dispatcher: &mut impl DispatcherTrait,
+        input: Buffer<u8>,
+        run_client: extern "C" fn(Bridge, D) -> Buffer<u8>,
+        client_data: D,
+    ) -> Buffer<u8> {
+        use std::sync::{Arc, Mutex};
+
+        enum State<T> {
+            Req(T),
+            Res(T),
+        }
+
+        let mut state = Arc::new(Mutex::new(State::Res(Buffer::new())));
+
+        let server_thread = thread::current();
+        let state2 = state.clone();
+        let join_handle = thread::spawn(move || {
+            let mut dispatch = |b| {
+                *state2.lock().unwrap() = State::Req(b);
+                server_thread.unpark();
+                loop {
+                    thread::park();
+                    if let State::Res(b) = &mut *state2.lock().unwrap() {
+                        break b.take();
+                    }
+                }
+            };
+
+            let r = run_client(
+                Bridge {
+                    cached_buffer: input,
+                    dispatch: (&mut dispatch).into(),
+                },
+                client_data,
+            );
+
+            // Wake up the server so it can exit the dispatch loop.
+            drop(state2);
+            server_thread.unpark();
+
+            r
+        });
+
+        // Check whether `state2` was dropped, to know when to stop.
+        while Arc::get_mut(&mut state).is_none() {
+            thread::park();
+            let mut b = match &mut *state.lock().unwrap() {
+                State::Req(b) => b.take(),
+                _ => continue,
+            };
+            b = dispatcher.dispatch(b.take());
+            *state.lock().unwrap() = State::Res(b);
+            join_handle.thread().unpark();
+        }
+
+        join_handle.join().unwrap()
+    }
+}
+
+fn run_server<
+    S: Server,
+    I: Encode<HandleStore<MarkedTypes<S>>>,
+    O: for<'a, 's> DecodeMut<'a, 's, HandleStore<MarkedTypes<S>>>,
+    D: Copy + Send + 'static,
+>(
+    strategy: &impl ExecutionStrategy,
+    handle_counters: &'static client::HandleCounters,
+    server: S,
+    input: I,
+    run_client: extern "C" fn(Bridge, D) -> Buffer<u8>,
+    client_data: D,
+) -> Result<O, PanicMessage> {
+    let mut dispatcher = Dispatcher {
+        handle_store: HandleStore::new(handle_counters),
+        server: MarkedTypes(server),
+    };
+
+    let mut b = Buffer::new();
+    input.encode(&mut b, &mut dispatcher.handle_store);
+
+    b = strategy.run_bridge_and_client(&mut dispatcher, b, run_client, client_data);
+
+    Result::decode(&mut &b[..], &mut dispatcher.handle_store)
+}
+
+impl client::Client<fn(::TokenStream) -> ::TokenStream> {
+    pub fn run<S: Server>(
+        &self,
+        strategy: &impl ExecutionStrategy,
+        server: S,
+        input: S::TokenStream,
+    ) -> Result<S::TokenStream, PanicMessage> {
+        let client::Client {
+            get_handle_counters,
+            run,
+            f,
+        } = *self;
+        run_server(
+            strategy,
+            get_handle_counters(),
+            server,
+            <MarkedTypes<S> as Types>::TokenStream::mark(input),
+            run,
+            f,
+        )
+        .map(<MarkedTypes<S> as Types>::TokenStream::unmark)
+    }
+}
+
+impl client::Client<fn(::TokenStream, ::TokenStream) -> ::TokenStream> {
+    pub fn run<S: Server>(
+        &self,
+        strategy: &impl ExecutionStrategy,
+        server: S,
+        input: S::TokenStream,
+        input2: S::TokenStream,
+    ) -> Result<S::TokenStream, PanicMessage> {
+        let client::Client {
+            get_handle_counters,
+            run,
+            f,
+        } = *self;
+        run_server(
+            strategy,
+            get_handle_counters(),
+            server,
+            (
+                <MarkedTypes<S> as Types>::TokenStream::mark(input),
+                <MarkedTypes<S> as Types>::TokenStream::mark(input2),
+            ),
+            run,
+            f,
+        )
+        .map(<MarkedTypes<S> as Types>::TokenStream::unmark)
+    }
+}
diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs
index bf23de39437..4234f0bcd21 100644
--- a/src/libproc_macro/diagnostic.rs
+++ b/src/libproc_macro/diagnostic.rs
@@ -10,8 +10,6 @@
 
 use Span;
 
-use rustc_errors as errors;
-
 /// An enum representing a diagnostic level.
 #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
 #[derive(Copy, Clone, Debug)]
@@ -180,22 +178,22 @@ impl Diagnostic {
     /// Emit the diagnostic.
     #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
     pub fn emit(self) {
-        fn to_internal(spans: Vec<Span>) -> ::syntax_pos::MultiSpan {
-            let spans: Vec<_> = spans.into_iter().map(|s| s.0).collect();
-            ::syntax_pos::MultiSpan::from_spans(spans)
+        fn to_internal(spans: Vec<Span>) -> ::bridge::client::MultiSpan {
+            let mut multi_span = ::bridge::client::MultiSpan::new();
+            for span in spans {
+                multi_span.push(span.0);
+            }
+            multi_span
         }
 
-        let level = self.level.to_internal();
-        let mut diag = errors::Diagnostic::new(level, &*self.message);
-        diag.set_span(to_internal(self.spans));
-
-        for child in self.children {
-            let level = child.level.to_internal();
-            diag.sub(level, &*child.message, to_internal(child.spans), None);
+        let mut diag = ::bridge::client::Diagnostic::new(
+            self.level,
+            &self.message[..],
+            to_internal(self.spans),
+        );
+        for c in self.children {
+            diag.sub(c.level, &c.message[..], to_internal(c.spans));
         }
-
-        ::__internal::with_sess(move |sess, _| {
-            errors::DiagnosticBuilder::new_diagnostic(&sess.span_diagnostic, diag).emit();
-        });
+        diag.emit();
     }
 }
diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs
index e9d2d97e364..32c81302931 100644
--- a/src/libproc_macro/lib.rs
+++ b/src/libproc_macro/lib.rs
@@ -28,40 +28,30 @@
        test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
 
 #![feature(nll)]
-#![feature(rustc_private)]
 #![feature(staged_api)]
-#![feature(lang_items)]
+#![feature(const_fn)]
+#![feature(extern_types)]
+#![feature(in_band_lifetimes)]
 #![feature(optin_builtin_traits)]
 #![feature(non_exhaustive)]
+#![feature(specialization)]
 
 #![recursion_limit="256"]
 
-extern crate syntax;
-extern crate syntax_pos;
-extern crate rustc_errors;
-extern crate rustc_data_structures;
-
 #[unstable(feature = "proc_macro_internals", issue = "27812")]
 #[doc(hidden)]
-pub mod rustc;
+pub mod bridge;
 
 mod diagnostic;
 
 #[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
 pub use diagnostic::{Diagnostic, Level, MultiSpan};
 
+use std::{fmt, iter, mem};
 use std::ops::{Bound, RangeBounds};
-use std::{ascii, fmt, iter};
 use std::path::PathBuf;
-use rustc_data_structures::sync::Lrc;
 use std::str::FromStr;
 
-use syntax::errors::DiagnosticBuilder;
-use syntax::parse::{self, token};
-use syntax::symbol::Symbol;
-use syntax::tokenstream::{self, DelimSpan};
-use syntax_pos::{Pos, FileName, BytePos};
-
 /// The main type provided by this crate, representing an abstract stream of
 /// tokens, or, more specifically, a sequence of token trees.
 /// The type provide interfaces for iterating over those token trees and, conversely,
@@ -71,7 +61,7 @@ use syntax_pos::{Pos, FileName, BytePos};
 /// and `#[proc_macro_derive]` definitions.
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 #[derive(Clone)]
-pub struct TokenStream(tokenstream::TokenStream);
+pub struct TokenStream(bridge::client::TokenStream);
 
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl !Send for TokenStream {}
@@ -94,7 +84,7 @@ impl TokenStream {
     /// Returns an empty `TokenStream` containing no token trees.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn new() -> TokenStream {
-        TokenStream(tokenstream::TokenStream::empty())
+        TokenStream(bridge::client::TokenStream::new())
     }
 
     /// Checks if this `TokenStream` is empty.
@@ -116,11 +106,16 @@ impl FromStr for TokenStream {
     type Err = LexError;
 
     fn from_str(src: &str) -> Result<TokenStream, LexError> {
-        __internal::with_sess(|sess, data| {
-            Ok(__internal::token_stream_wrap(parse::parse_stream_from_source_str(
-                FileName::ProcMacroSourceCode, src.to_string(), sess, Some(data.call_site.0)
-            )))
-        })
+        Ok(TokenStream(bridge::client::TokenStream::from_str(src)))
+    }
+}
+
+// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// based on it (the reverse of the usual relationship between the two).
+#[stable(feature = "proc_macro_lib", since = "1.15.0")]
+impl ToString for TokenStream {
+    fn to_string(&self) -> String {
+        self.0.to_string()
     }
 }
 
@@ -130,7 +125,7 @@ impl FromStr for TokenStream {
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl fmt::Display for TokenStream {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.0.fmt(f)
+        f.write_str(&self.to_string())
     }
 }
 
@@ -150,7 +145,12 @@ pub use quote::{quote, quote_span};
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl From<TokenTree> for TokenStream {
     fn from(tree: TokenTree) -> TokenStream {
-        TokenStream(tree.to_internal())
+        TokenStream(bridge::client::TokenStream::from_token_tree(match tree {
+            TokenTree::Group(tt) => bridge::TokenTree::Group(tt.0),
+            TokenTree::Punct(tt) => bridge::TokenTree::Punct(tt.0),
+            TokenTree::Ident(tt) => bridge::TokenTree::Ident(tt.0),
+            TokenTree::Literal(tt) => bridge::TokenTree::Literal(tt.0)
+        }))
     }
 }
 
@@ -167,7 +167,7 @@ impl iter::FromIterator<TokenTree> for TokenStream {
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl iter::FromIterator<TokenStream> for TokenStream {
     fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
-        let mut builder = tokenstream::TokenStreamBuilder::new();
+        let mut builder = bridge::client::TokenStreamBuilder::new();
         for stream in streams {
             builder.push(stream.0);
         }
@@ -185,52 +185,34 @@ impl Extend<TokenTree> for TokenStream {
 #[stable(feature = "token_stream_extend", since = "1.30.0")]
 impl Extend<TokenStream> for TokenStream {
     fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
-        self.0.extend(streams.into_iter().map(|stream| stream.0));
+        // FIXME(eddyb) Use an optimized implementation if/when possible.
+        *self = iter::once(mem::replace(self, Self::new())).chain(streams).collect();
     }
 }
 
 /// Public implementation details for the `TokenStream` type, such as iterators.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 pub mod token_stream {
-    use syntax::tokenstream;
-    use {TokenTree, TokenStream, Delimiter};
+    use {bridge, Group, Ident, Literal, Punct, TokenTree, TokenStream};
 
     /// An iterator over `TokenStream`'s `TokenTree`s.
     /// The iteration is "shallow", e.g. the iterator doesn't recurse into delimited groups,
     /// and returns whole groups as token trees.
     #[derive(Clone)]
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-    pub struct IntoIter {
-        cursor: tokenstream::Cursor,
-        stack: Vec<TokenTree>,
-    }
+    pub struct IntoIter(bridge::client::TokenStreamIter);
 
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     impl Iterator for IntoIter {
         type Item = TokenTree;
 
         fn next(&mut self) -> Option<TokenTree> {
-            loop {
-                let tree = self.stack.pop().or_else(|| {
-                    let next = self.cursor.next_as_stream()?;
-                    Some(TokenTree::from_internal(next, &mut self.stack))
-                })?;
-                // HACK: The condition "dummy span + group with empty delimiter" represents an AST
-                // fragment approximately converted into a token stream. This may happen, for
-                // example, with inputs to proc macro attributes, including derives. Such "groups"
-                // need to flattened during iteration over stream's token trees.
-                // Eventually this needs to be removed in favor of keeping original token trees
-                // and not doing the roundtrip through AST.
-                if tree.span().0.is_dummy() {
-                    if let TokenTree::Group(ref group) = tree {
-                        if group.delimiter() == Delimiter::None {
-                            self.cursor.insert(group.stream.clone().0);
-                            continue
-                        }
-                    }
-                }
-                return Some(tree);
-            }
+            self.0.next().map(|tree| match tree {
+                bridge::TokenTree::Group(tt) => TokenTree::Group(Group(tt)),
+                bridge::TokenTree::Punct(tt) => TokenTree::Punct(Punct(tt)),
+                bridge::TokenTree::Ident(tt) => TokenTree::Ident(Ident(tt)),
+                bridge::TokenTree::Literal(tt) => TokenTree::Literal(Literal(tt)),
+            })
         }
     }
 
@@ -240,7 +222,7 @@ pub mod token_stream {
         type IntoIter = IntoIter;
 
         fn into_iter(self) -> IntoIter {
-            IntoIter { cursor: self.0.trees(), stack: Vec::new() }
+            IntoIter(self.0.into_iter())
         }
     }
 }
@@ -264,7 +246,7 @@ mod quote;
 /// A region of source code, along with macro expansion information.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 #[derive(Copy, Clone)]
-pub struct Span(syntax_pos::Span);
+pub struct Span(bridge::client::Span);
 
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl !Send for Span {}
@@ -286,7 +268,7 @@ impl Span {
     /// A span that resolves at the macro definition site.
     #[unstable(feature = "proc_macro_def_site", issue = "54724")]
     pub fn def_site() -> Span {
-        ::__internal::with_sess(|_, data| data.def_site)
+        Span(bridge::client::Span::def_site())
     }
 
     /// The span of the invocation of the current procedural macro.
@@ -295,15 +277,13 @@ impl Span {
     /// at the macro call site will be able to refer to them as well.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn call_site() -> Span {
-        ::__internal::with_sess(|_, data| data.call_site)
+        Span(bridge::client::Span::call_site())
     }
 
     /// The original source file into which this span points.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn source_file(&self) -> SourceFile {
-        SourceFile {
-            source_file: __internal::lookup_char_pos(self.0.lo()).file,
-        }
+        SourceFile(self.0.source_file())
     }
 
     /// The `Span` for the tokens in the previous macro expansion from which
@@ -318,27 +298,19 @@ impl Span {
     /// value is the same as `*self`.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn source(&self) -> Span {
-        Span(self.0.source_callsite())
+        Span(self.0.source())
     }
 
     /// Get the starting line/column in the source file for this span.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn start(&self) -> LineColumn {
-        let loc = __internal::lookup_char_pos(self.0.lo());
-        LineColumn {
-            line: loc.line,
-            column: loc.col.to_usize()
-        }
+        self.0.start()
     }
 
     /// Get the ending line/column in the source file for this span.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn end(&self) -> LineColumn {
-        let loc = __internal::lookup_char_pos(self.0.hi());
-        LineColumn {
-            line: loc.line,
-            column: loc.col.to_usize()
-        }
+        self.0.end()
     }
 
     /// Create a new span encompassing `self` and `other`.
@@ -346,19 +318,14 @@ impl Span {
     /// Returns `None` if `self` and `other` are from different files.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn join(&self, other: Span) -> Option<Span> {
-        let self_loc = __internal::lookup_char_pos(self.0.lo());
-        let other_loc = __internal::lookup_char_pos(other.0.lo());
-
-        if self_loc.file.name != other_loc.file.name { return None }
-
-        Some(Span(self.0.to(other.0)))
+        self.0.join(other.0).map(Span)
     }
 
     /// Creates a new span with the same line/column information as `self` but
     /// that resolves symbols as though it were at `other`.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn resolved_at(&self, other: Span) -> Span {
-        Span(self.0.with_ctxt(other.0.ctxt()))
+        Span(self.0.resolved_at(other.0))
     }
 
     /// Creates a new span with the same name resolution behavior as `self` but
@@ -384,10 +351,7 @@ impl Span {
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Debug for Span {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{:?} bytes({}..{})",
-               self.0.ctxt(),
-               self.0.lo().0,
-               self.0.hi().0)
+        self.0.fmt(f)
     }
 }
 
@@ -412,14 +376,7 @@ impl !Sync for LineColumn {}
 /// The source file of a given `Span`.
 #[unstable(feature = "proc_macro_span", issue = "54725")]
 #[derive(Clone)]
-pub struct SourceFile {
-    source_file: Lrc<syntax_pos::SourceFile>,
-}
-
-#[unstable(feature = "proc_macro_span", issue = "54725")]
-impl !Send for SourceFile {}
-#[unstable(feature = "proc_macro_span", issue = "54725")]
-impl !Sync for SourceFile {}
+pub struct SourceFile(bridge::client::SourceFile);
 
 impl SourceFile {
     /// Get the path to this source file.
@@ -434,10 +391,7 @@ impl SourceFile {
     /// [`is_real`]: #method.is_real
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn path(&self) -> PathBuf {
-        match self.source_file.name {
-            FileName::Real(ref path) => path.clone(),
-            _ => PathBuf::from(self.source_file.name.to_string())
-        }
+        PathBuf::from(self.0.path())
     }
 
     /// Returns `true` if this source file is a real source file, and not generated by an external
@@ -447,7 +401,7 @@ impl SourceFile {
         // This is a hack until intercrate spans are implemented and we can have real source files
         // for spans generated in external macros.
         // https://github.com/rust-lang/rust/pull/43604#issuecomment-333334368
-        self.source_file.is_real_file()
+        self.0.is_real()
     }
 }
 
@@ -465,7 +419,7 @@ impl fmt::Debug for SourceFile {
 #[unstable(feature = "proc_macro_span", issue = "54725")]
 impl PartialEq for SourceFile {
     fn eq(&self, other: &Self) -> bool {
-        Lrc::ptr_eq(&self.source_file, &other.source_file)
+        self.0.eq(&other.0)
     }
 }
 
@@ -579,18 +533,27 @@ impl From<Literal> for TokenTree {
     }
 }
 
+// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// based on it (the reverse of the usual relationship between the two).
+#[stable(feature = "proc_macro_lib", since = "1.15.0")]
+impl ToString for TokenTree {
+    fn to_string(&self) -> String {
+        match *self {
+            TokenTree::Group(ref t) => t.to_string(),
+            TokenTree::Ident(ref t) => t.to_string(),
+            TokenTree::Punct(ref t) => t.to_string(),
+            TokenTree::Literal(ref t) => t.to_string(),
+        }
+    }
+}
+
 /// Prints the token tree as a string that is supposed to be losslessly convertible back
 /// into the same token tree (modulo spans), except for possibly `TokenTree::Group`s
 /// with `Delimiter::None` delimiters and negative numeric literals.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for TokenTree {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match *self {
-            TokenTree::Group(ref t) => t.fmt(f),
-            TokenTree::Ident(ref t) => t.fmt(f),
-            TokenTree::Punct(ref t) => t.fmt(f),
-            TokenTree::Literal(ref t) => t.fmt(f),
-        }
+        f.write_str(&self.to_string())
     }
 }
 
@@ -599,11 +562,7 @@ impl fmt::Display for TokenTree {
 /// A `Group` internally contains a `TokenStream` which is surrounded by `Delimiter`s.
 #[derive(Clone)]
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-pub struct Group {
-    delimiter: Delimiter,
-    stream: TokenStream,
-    span: DelimSpan,
-}
+pub struct Group(bridge::client::Group);
 
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl !Send for Group {}
@@ -640,17 +599,13 @@ impl Group {
     /// method below.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn new(delimiter: Delimiter, stream: TokenStream) -> Group {
-        Group {
-            delimiter: delimiter,
-            stream: stream,
-            span: DelimSpan::from_single(Span::call_site().0),
-        }
+        Group(bridge::client::Group::new(delimiter, stream.0))
     }
 
     /// Returns the delimiter of this `Group`
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn delimiter(&self) -> Delimiter {
-        self.delimiter
+        self.0.delimiter()
     }
 
     /// Returns the `TokenStream` of tokens that are delimited in this `Group`.
@@ -659,7 +614,7 @@ impl Group {
     /// returned above.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn stream(&self) -> TokenStream {
-        self.stream.clone()
+        TokenStream(self.0.stream())
     }
 
     /// Returns the span for the delimiters of this token stream, spanning the
@@ -671,7 +626,7 @@ impl Group {
     /// ```
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn span(&self) -> Span {
-        Span(self.span.entire())
+        Span(self.0.span())
     }
 
     /// Returns the span pointing to the opening delimiter of this group.
@@ -682,7 +637,7 @@ impl Group {
     /// ```
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn span_open(&self) -> Span {
-        Span(self.span.open)
+        Span(self.0.span_open())
     }
 
     /// Returns the span pointing to the closing delimiter of this group.
@@ -693,7 +648,7 @@ impl Group {
     /// ```
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn span_close(&self) -> Span {
-        Span(self.span.close)
+        Span(self.0.span_close())
     }
 
     /// Configures the span for this `Group`'s delimiters, but not its internal
@@ -704,7 +659,16 @@ impl Group {
     /// tokens at the level of the `Group`.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn set_span(&mut self, span: Span) {
-        self.span = DelimSpan::from_single(span.0);
+        self.0.set_span(span.0);
+    }
+}
+
+// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// based on it (the reverse of the usual relationship between the two).
+#[stable(feature = "proc_macro_lib", since = "1.15.0")]
+impl ToString for Group {
+    fn to_string(&self) -> String {
+        TokenStream::from(TokenTree::from(self.clone())).to_string()
     }
 }
 
@@ -714,7 +678,7 @@ impl Group {
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for Group {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        TokenStream::from(TokenTree::from(self.clone())).fmt(f)
+        f.write_str(&self.to_string())
     }
 }
 
@@ -735,11 +699,7 @@ impl fmt::Debug for Group {
 /// forms of `Spacing` returned.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 #[derive(Clone)]
-pub struct Punct {
-    ch: char,
-    spacing: Spacing,
-    span: Span,
-}
+pub struct Punct(bridge::client::Punct);
 
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl !Send for Punct {}
@@ -774,17 +734,13 @@ impl Punct {
         if !LEGAL_CHARS.contains(&ch) {
             panic!("unsupported character `{:?}`", ch)
         }
-        Punct {
-            ch: ch,
-            spacing: spacing,
-            span: Span::call_site(),
-        }
+        Punct(bridge::client::Punct::new(ch, spacing))
     }
 
     /// Returns the value of this punctuation character as `char`.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn as_char(&self) -> char {
-        self.ch
+        self.0.as_char()
     }
 
     /// Returns the spacing of this punctuation character, indicating whether it's immediately
@@ -793,19 +749,28 @@ impl Punct {
     /// (`Alone`) so the operator has certainly ended.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn spacing(&self) -> Spacing {
-        self.spacing
+        self.0.spacing()
     }
 
     /// Returns the span for this punctuation character.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn span(&self) -> Span {
-        self.span
+        Span(self.0.span())
     }
 
     /// Configure the span for this punctuation character.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn set_span(&mut self, span: Span) {
-        self.span = span;
+        self.0 = self.0.with_span(span.0);
+    }
+}
+
+// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// based on it (the reverse of the usual relationship between the two).
+#[stable(feature = "proc_macro_lib", since = "1.15.0")]
+impl ToString for Punct {
+    fn to_string(&self) -> String {
+        TokenStream::from(TokenTree::from(self.clone())).to_string()
     }
 }
 
@@ -814,7 +779,7 @@ impl Punct {
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for Punct {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        TokenStream::from(TokenTree::from(self.clone())).fmt(f)
+        f.write_str(&self.to_string())
     }
 }
 
@@ -832,16 +797,7 @@ impl fmt::Debug for Punct {
 /// An identifier (`ident`).
 #[derive(Clone)]
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-pub struct Ident {
-    sym: Symbol,
-    span: Span,
-    is_raw: bool,
-}
-
-#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-impl !Send for Ident {}
-#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-impl !Sync for Ident {}
+pub struct Ident(bridge::client::Ident);
 
 impl Ident {
     fn is_valid(string: &str) -> bool {
@@ -878,7 +834,7 @@ impl Ident {
         if !Ident::is_valid(string) {
             panic!("`{:?}` is not a valid identifier", string)
         }
-        Ident::new_maybe_raw(string, span, false)
+        Ident(bridge::client::Ident::new(string, span.0, false))
     }
 
     /// Same as `Ident::new`, but creates a raw identifier (`r#ident`).
@@ -887,20 +843,29 @@ impl Ident {
         if !Ident::is_valid(string) {
             panic!("`{:?}` is not a valid identifier", string)
         }
-        Ident::new_maybe_raw(string, span, true)
+        Ident(bridge::client::Ident::new(string, span.0, true))
     }
 
     /// Returns the span of this `Ident`, encompassing the entire string returned
     /// by `as_str`.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn span(&self) -> Span {
-        self.span
+        Span(self.0.span())
     }
 
     /// Configures the span of this `Ident`, possibly changing its hygiene context.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn set_span(&mut self, span: Span) {
-        self.span = span;
+        self.0 = self.0.with_span(span.0);
+    }
+}
+
+// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// based on it (the reverse of the usual relationship between the two).
+#[stable(feature = "proc_macro_lib", since = "1.15.0")]
+impl ToString for Ident {
+    fn to_string(&self) -> String {
+        TokenStream::from(TokenTree::from(self.clone())).to_string()
     }
 }
 
@@ -909,7 +874,7 @@ impl Ident {
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for Ident {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        TokenStream::from(TokenTree::from(self.clone())).fmt(f)
+        f.write_str(&self.to_string())
     }
 }
 
@@ -927,19 +892,9 @@ impl fmt::Debug for Ident {
 /// character (`'a'`), byte character (`b'a'`), an integer or floating point number
 /// with or without a suffix (`1`, `1u8`, `2.3`, `2.3f32`).
 /// Boolean literals like `true` and `false` do not belong here, they are `Ident`s.
-// FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
-#[derive(Clone, Debug)]
-#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-pub struct Literal {
-    lit: token::Lit,
-    suffix: Option<Symbol>,
-    span: Span,
-}
-
-#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-impl !Send for Literal {}
+#[derive(Clone)]
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
-impl !Sync for Literal {}
+pub struct Literal(bridge::client::Literal);
 
 macro_rules! suffixed_int_literals {
     ($($name:ident => $kind:ident,)*) => ($(
@@ -956,11 +911,7 @@ macro_rules! suffixed_int_literals {
         /// below.
         #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
         pub fn $name(n: $kind) -> Literal {
-            Literal {
-                lit: token::Lit::Integer(Symbol::intern(&n.to_string())),
-                suffix: Some(Symbol::intern(stringify!($kind))),
-                span: Span::call_site(),
-            }
+            Literal(bridge::client::Literal::typed_integer(&n.to_string(), stringify!($kind)))
         }
     )*)
 }
@@ -982,11 +933,7 @@ macro_rules! unsuffixed_int_literals {
         /// below.
         #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
         pub fn $name(n: $kind) -> Literal {
-            Literal {
-                lit: token::Lit::Integer(Symbol::intern(&n.to_string())),
-                suffix: None,
-                span: Span::call_site(),
-            }
+            Literal(bridge::client::Literal::integer(&n.to_string()))
         }
     )*)
 }
@@ -1039,11 +986,7 @@ impl Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        Literal {
-            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
-            suffix: None,
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::float(&n.to_string()))
     }
 
     /// Creates a new suffixed floating-point literal.
@@ -1064,11 +1007,7 @@ impl Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        Literal {
-            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
-            suffix: Some(Symbol::intern("f32")),
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::f32(&n.to_string()))
     }
 
     /// Creates a new unsuffixed floating-point literal.
@@ -1088,11 +1027,7 @@ impl Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        Literal {
-            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
-            suffix: None,
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::float(&n.to_string()))
     }
 
     /// Creates a new suffixed floating-point literal.
@@ -1113,61 +1048,37 @@ impl Literal {
         if !n.is_finite() {
             panic!("Invalid float literal {}", n);
         }
-        Literal {
-            lit: token::Lit::Float(Symbol::intern(&n.to_string())),
-            suffix: Some(Symbol::intern("f64")),
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::f64(&n.to_string()))
     }
 
     /// String literal.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn string(string: &str) -> Literal {
-        let mut escaped = String::new();
-        for ch in string.chars() {
-            escaped.extend(ch.escape_debug());
-        }
-        Literal {
-            lit: token::Lit::Str_(Symbol::intern(&escaped)),
-            suffix: None,
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::string(string))
     }
 
     /// Character literal.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn character(ch: char) -> Literal {
-        let mut escaped = String::new();
-        escaped.extend(ch.escape_unicode());
-        Literal {
-            lit: token::Lit::Char(Symbol::intern(&escaped)),
-            suffix: None,
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::character(ch))
     }
 
     /// Byte string literal.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn byte_string(bytes: &[u8]) -> Literal {
-        let string = bytes.iter().cloned().flat_map(ascii::escape_default)
-            .map(Into::<char>::into).collect::<String>();
-        Literal {
-            lit: token::Lit::ByteStr(Symbol::intern(&string)),
-            suffix: None,
-            span: Span::call_site(),
-        }
+        Literal(bridge::client::Literal::byte_string(bytes))
     }
 
     /// Returns the span encompassing this literal.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn span(&self) -> Span {
-        self.span
+        Span(self.0.span())
     }
 
     /// Configures the span associated for this literal.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     pub fn set_span(&mut self, span: Span) {
-        self.span = span;
+        self.0.set_span(span.0);
     }
 
     /// Returns a `Span` that is a subset of `self.span()` containing only the
@@ -1183,35 +1094,28 @@ impl Literal {
     // was 'c' or whether it was '\u{63}'.
     #[unstable(feature = "proc_macro_span", issue = "54725")]
     pub fn subspan<R: RangeBounds<usize>>(&self, range: R) -> Option<Span> {
-        let inner = self.span().0;
-        let length = inner.hi().to_usize() - inner.lo().to_usize();
-
-        let start = match range.start_bound() {
-            Bound::Included(&lo) => lo,
-            Bound::Excluded(&lo) => lo + 1,
-            Bound::Unbounded => 0,
-        };
-
-        let end = match range.end_bound() {
-            Bound::Included(&hi) => hi + 1,
-            Bound::Excluded(&hi) => hi,
-            Bound::Unbounded => length,
-        };
-
-        // Bounds check the values, preventing addition overflow and OOB spans.
-        if start > u32::max_value() as usize
-            || end > u32::max_value() as usize
-            || (u32::max_value() - start as u32) < inner.lo().to_u32()
-            || (u32::max_value() - end as u32) < inner.lo().to_u32()
-            || start >= end
-            || end > length
-        {
-            return None;
+        // HACK(eddyb) something akin to `Option::cloned`, but for `Bound<&T>`.
+        fn cloned_bound<T: Clone>(bound: Bound<&T>) -> Bound<T> {
+            match bound {
+                Bound::Included(x) => Bound::Included(x.clone()),
+                Bound::Excluded(x) => Bound::Excluded(x.clone()),
+                Bound::Unbounded => Bound::Unbounded,
+            }
         }
 
-        let new_lo = inner.lo() + BytePos::from_usize(start);
-        let new_hi = inner.lo() + BytePos::from_usize(end);
-        Some(Span(inner.with_lo(new_lo).with_hi(new_hi)))
+        self.0.subspan(
+            cloned_bound(range.start_bound()),
+            cloned_bound(range.end_bound()),
+        ).map(Span)
+    }
+}
+
+// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// based on it (the reverse of the usual relationship between the two).
+#[stable(feature = "proc_macro_lib", since = "1.15.0")]
+impl ToString for Literal {
+    fn to_string(&self) -> String {
+        TokenStream::from(TokenTree::from(self.clone())).to_string()
     }
 }
 
@@ -1220,149 +1124,14 @@ impl Literal {
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 impl fmt::Display for Literal {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        TokenStream::from(TokenTree::from(self.clone())).fmt(f)
+        f.write_str(&self.to_string())
     }
 }
 
-/// Permanently unstable internal implementation details of this crate. This
-/// should not be used.
-///
-/// These methods are used by the rest of the compiler to generate instances of
-/// `TokenStream` to hand to macro definitions, as well as consume the output.
-///
-/// Note that this module is also intentionally separate from the rest of the
-/// crate. This allows the `#[unstable]` directive below to naturally apply to
-/// all of the contents.
-#[unstable(feature = "proc_macro_internals", issue = "27812")]
-#[doc(hidden)]
-pub mod __internal {
-    use std::cell::Cell;
-    use std::ptr;
-
-    use syntax::ast;
-    use syntax::ext::base::ExtCtxt;
-    use syntax::ptr::P;
-    use syntax::parse::{self, ParseSess};
-    use syntax::parse::token::{self, Token};
-    use syntax::tokenstream;
-    use syntax_pos::{BytePos, Loc, DUMMY_SP};
-    use syntax_pos::hygiene::{SyntaxContext, Transparency};
-
-    use super::{TokenStream, LexError, Span};
-
-    pub fn lookup_char_pos(pos: BytePos) -> Loc {
-        with_sess(|sess, _| sess.source_map().lookup_char_pos(pos))
-    }
-
-    pub fn new_token_stream(item: P<ast::Item>) -> TokenStream {
-        let token = Token::interpolated(token::NtItem(item));
-        TokenStream(tokenstream::TokenTree::Token(DUMMY_SP, token).into())
-    }
-
-    pub fn token_stream_wrap(inner: tokenstream::TokenStream) -> TokenStream {
-        TokenStream(inner)
-    }
-
-    pub fn token_stream_parse_items(stream: TokenStream) -> Result<Vec<P<ast::Item>>, LexError> {
-        with_sess(move |sess, _| {
-            let mut parser = parse::stream_to_parser(sess, stream.0);
-            let mut items = Vec::new();
-
-            while let Some(item) = try!(parser.parse_item().map_err(super::parse_to_lex_err)) {
-                items.push(item)
-            }
-
-            Ok(items)
-        })
-    }
-
-    pub fn token_stream_inner(stream: TokenStream) -> tokenstream::TokenStream {
-        stream.0
-    }
-
-    pub trait Registry {
-        fn register_custom_derive(&mut self,
-                                  trait_name: &str,
-                                  expand: fn(TokenStream) -> TokenStream,
-                                  attributes: &[&'static str]);
-
-        fn register_attr_proc_macro(&mut self,
-                                    name: &str,
-                                    expand: fn(TokenStream, TokenStream) -> TokenStream);
-
-        fn register_bang_proc_macro(&mut self,
-                                    name: &str,
-                                    expand: fn(TokenStream) -> TokenStream);
-    }
-
-    #[derive(Clone, Copy)]
-    pub struct ProcMacroData {
-        pub def_site: Span,
-        pub call_site: Span,
-    }
-
-    #[derive(Clone, Copy)]
-    struct ProcMacroSess {
-        parse_sess: *const ParseSess,
-        data: ProcMacroData,
-    }
-
-    // Emulate scoped_thread_local!() here essentially
-    thread_local! {
-        static CURRENT_SESS: Cell<ProcMacroSess> = Cell::new(ProcMacroSess {
-            parse_sess: ptr::null(),
-            data: ProcMacroData { def_site: Span(DUMMY_SP), call_site: Span(DUMMY_SP) },
-        });
-    }
-
-    pub fn set_sess<F, R>(cx: &ExtCtxt, f: F) -> R
-        where F: FnOnce() -> R
-    {
-        struct Reset { prev: ProcMacroSess }
-
-        impl Drop for Reset {
-            fn drop(&mut self) {
-                CURRENT_SESS.with(|p| p.set(self.prev));
-            }
-        }
-
-        CURRENT_SESS.with(|p| {
-            let _reset = Reset { prev: p.get() };
-
-            // No way to determine def location for a proc macro right now, so use call location.
-            let location = cx.current_expansion.mark.expn_info().unwrap().call_site;
-            let to_span = |transparency| Span(location.with_ctxt(
-                SyntaxContext::empty().apply_mark_with_transparency(cx.current_expansion.mark,
-                                                                    transparency))
-            );
-            p.set(ProcMacroSess {
-                parse_sess: cx.parse_sess,
-                data: ProcMacroData {
-                    def_site: to_span(Transparency::Opaque),
-                    call_site: to_span(Transparency::Transparent),
-                },
-            });
-            f()
-        })
-    }
-
-    pub fn in_sess() -> bool
-    {
-        !CURRENT_SESS.with(|sess| sess.get()).parse_sess.is_null()
-    }
-
-    pub fn with_sess<F, R>(f: F) -> R
-        where F: FnOnce(&ParseSess, &ProcMacroData) -> R
-    {
-        let sess = CURRENT_SESS.with(|sess| sess.get());
-        if sess.parse_sess.is_null() {
-            panic!("procedural macro API is used outside of a procedural macro");
-        }
-        f(unsafe { &*sess.parse_sess }, &sess.data)
+#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
+impl fmt::Debug for Literal {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
+        self.0.fmt(f)
     }
 }
-
-fn parse_to_lex_err(mut err: DiagnosticBuilder) -> LexError {
-    err.cancel();
-    LexError { _inner: () }
-}
diff --git a/src/libproc_macro/rustc.rs b/src/libproc_macro/rustc.rs
deleted file mode 100644
index 3ce02d1afb1..00000000000
--- a/src/libproc_macro/rustc.rs
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use {Delimiter, Level, Spacing, Span, __internal};
-use {Group, Ident, Literal, Punct, TokenTree};
-
-use rustc_errors as errors;
-use syntax::ast;
-use syntax::parse::lexer::comments;
-use syntax::parse::token;
-use syntax::tokenstream;
-use syntax_pos::symbol::{keywords, Symbol};
-
-impl Ident {
-    pub(crate) fn new_maybe_raw(string: &str, span: Span, is_raw: bool) -> Ident {
-        let sym = Symbol::intern(string);
-        if is_raw
-            && (sym == keywords::Underscore.name()
-                || ast::Ident::with_empty_ctxt(sym).is_path_segment_keyword())
-        {
-            panic!("`{:?}` is not a valid raw identifier", string)
-        }
-        Ident { sym, span, is_raw }
-    }
-}
-
-impl Delimiter {
-    pub(crate) fn from_internal(delim: token::DelimToken) -> Delimiter {
-        match delim {
-            token::Paren => Delimiter::Parenthesis,
-            token::Brace => Delimiter::Brace,
-            token::Bracket => Delimiter::Bracket,
-            token::NoDelim => Delimiter::None,
-        }
-    }
-
-    pub(crate) fn to_internal(self) -> token::DelimToken {
-        match self {
-            Delimiter::Parenthesis => token::Paren,
-            Delimiter::Brace => token::Brace,
-            Delimiter::Bracket => token::Bracket,
-            Delimiter::None => token::NoDelim,
-        }
-    }
-}
-
-impl TokenTree {
-    pub(crate) fn from_internal(
-        stream: tokenstream::TokenStream,
-        stack: &mut Vec<TokenTree>,
-    ) -> TokenTree {
-        use syntax::parse::token::*;
-
-        let (tree, is_joint) = stream.as_tree();
-        let (span, token) = match tree {
-            tokenstream::TokenTree::Token(span, token) => (span, token),
-            tokenstream::TokenTree::Delimited(span, delimed) => {
-                let delimiter = Delimiter::from_internal(delimed.delim);
-                let mut g = Group::new(delimiter, ::TokenStream(delimed.tts.into()));
-                g.span = span;
-                return g.into();
-            }
-        };
-
-        let op_kind = if is_joint {
-            Spacing::Joint
-        } else {
-            Spacing::Alone
-        };
-        macro_rules! tt {
-            ($e:expr) => {{
-                let mut x = TokenTree::from($e);
-                x.set_span(Span(span));
-                x
-            }};
-        }
-        macro_rules! op {
-            ($a:expr) => {
-                tt!(Punct::new($a, op_kind))
-            };
-            ($a:expr, $b:expr) => {{
-                stack.push(tt!(Punct::new($b, op_kind)));
-                tt!(Punct::new($a, Spacing::Joint))
-            }};
-            ($a:expr, $b:expr, $c:expr) => {{
-                stack.push(tt!(Punct::new($c, op_kind)));
-                stack.push(tt!(Punct::new($b, Spacing::Joint)));
-                tt!(Punct::new($a, Spacing::Joint))
-            }};
-        }
-
-        match token {
-            Eq => op!('='),
-            Lt => op!('<'),
-            Le => op!('<', '='),
-            EqEq => op!('=', '='),
-            Ne => op!('!', '='),
-            Ge => op!('>', '='),
-            Gt => op!('>'),
-            AndAnd => op!('&', '&'),
-            OrOr => op!('|', '|'),
-            Not => op!('!'),
-            Tilde => op!('~'),
-            BinOp(Plus) => op!('+'),
-            BinOp(Minus) => op!('-'),
-            BinOp(Star) => op!('*'),
-            BinOp(Slash) => op!('/'),
-            BinOp(Percent) => op!('%'),
-            BinOp(Caret) => op!('^'),
-            BinOp(And) => op!('&'),
-            BinOp(Or) => op!('|'),
-            BinOp(Shl) => op!('<', '<'),
-            BinOp(Shr) => op!('>', '>'),
-            BinOpEq(Plus) => op!('+', '='),
-            BinOpEq(Minus) => op!('-', '='),
-            BinOpEq(Star) => op!('*', '='),
-            BinOpEq(Slash) => op!('/', '='),
-            BinOpEq(Percent) => op!('%', '='),
-            BinOpEq(Caret) => op!('^', '='),
-            BinOpEq(And) => op!('&', '='),
-            BinOpEq(Or) => op!('|', '='),
-            BinOpEq(Shl) => op!('<', '<', '='),
-            BinOpEq(Shr) => op!('>', '>', '='),
-            At => op!('@'),
-            Dot => op!('.'),
-            DotDot => op!('.', '.'),
-            DotDotDot => op!('.', '.', '.'),
-            DotDotEq => op!('.', '.', '='),
-            Comma => op!(','),
-            Semi => op!(';'),
-            Colon => op!(':'),
-            ModSep => op!(':', ':'),
-            RArrow => op!('-', '>'),
-            LArrow => op!('<', '-'),
-            FatArrow => op!('=', '>'),
-            Pound => op!('#'),
-            Dollar => op!('$'),
-            Question => op!('?'),
-            SingleQuote => op!('\''),
-
-            Ident(ident, false) => tt!(self::Ident::new(&ident.as_str(), Span(span))),
-            Ident(ident, true) => tt!(self::Ident::new_raw(&ident.as_str(), Span(span))),
-            Lifetime(ident) => {
-                let ident = ident.without_first_quote();
-                stack.push(tt!(self::Ident::new(&ident.as_str(), Span(span))));
-                tt!(Punct::new('\'', Spacing::Joint))
-            }
-            Literal(lit, suffix) => tt!(self::Literal {
-                lit,
-                suffix,
-                span: Span(span)
-            }),
-            DocComment(c) => {
-                let style = comments::doc_comment_style(&c.as_str());
-                let stripped = comments::strip_doc_comment_decoration(&c.as_str());
-                let stream = vec![
-                    tt!(self::Ident::new("doc", Span(span))),
-                    tt!(Punct::new('=', Spacing::Alone)),
-                    tt!(self::Literal::string(&stripped)),
-                ].into_iter()
-                    .collect();
-                stack.push(tt!(Group::new(Delimiter::Bracket, stream)));
-                if style == ast::AttrStyle::Inner {
-                    stack.push(tt!(Punct::new('!', Spacing::Alone)));
-                }
-                tt!(Punct::new('#', Spacing::Alone))
-            }
-
-            Interpolated(_) => __internal::with_sess(|sess, _| {
-                let tts = token.interpolated_to_tokenstream(sess, span);
-                tt!(Group::new(Delimiter::None, ::TokenStream(tts)))
-            }),
-
-            DotEq => op!('.', '='),
-            OpenDelim(..) | CloseDelim(..) => unreachable!(),
-            Whitespace | Comment | Shebang(..) | Eof => unreachable!(),
-        }
-    }
-
-    pub(crate) fn to_internal(self) -> tokenstream::TokenStream {
-        use syntax::parse::token::*;
-        use syntax::tokenstream::{Delimited, TokenTree};
-
-        let (ch, kind, span) = match self {
-            self::TokenTree::Punct(tt) => (tt.as_char(), tt.spacing(), tt.span()),
-            self::TokenTree::Group(tt) => {
-                return TokenTree::Delimited(
-                    tt.span,
-                    Delimited {
-                        delim: tt.delimiter.to_internal(),
-                        tts: tt.stream.0.into(),
-                    },
-                ).into();
-            }
-            self::TokenTree::Ident(tt) => {
-                let token = Ident(ast::Ident::new(tt.sym, tt.span.0), tt.is_raw);
-                return TokenTree::Token(tt.span.0, token).into();
-            }
-            self::TokenTree::Literal(self::Literal {
-                lit: Lit::Integer(ref a),
-                suffix,
-                span,
-            })
-                if a.as_str().starts_with("-") =>
-            {
-                let minus = BinOp(BinOpToken::Minus);
-                let integer = Symbol::intern(&a.as_str()[1..]);
-                let integer = Literal(Lit::Integer(integer), suffix);
-                let a = TokenTree::Token(span.0, minus);
-                let b = TokenTree::Token(span.0, integer);
-                return vec![a, b].into_iter().collect();
-            }
-            self::TokenTree::Literal(self::Literal {
-                lit: Lit::Float(ref a),
-                suffix,
-                span,
-            })
-                if a.as_str().starts_with("-") =>
-            {
-                let minus = BinOp(BinOpToken::Minus);
-                let float = Symbol::intern(&a.as_str()[1..]);
-                let float = Literal(Lit::Float(float), suffix);
-                let a = TokenTree::Token(span.0, minus);
-                let b = TokenTree::Token(span.0, float);
-                return vec![a, b].into_iter().collect();
-            }
-            self::TokenTree::Literal(tt) => {
-                let token = Literal(tt.lit, tt.suffix);
-                return TokenTree::Token(tt.span.0, token).into();
-            }
-        };
-
-        let token = match ch {
-            '=' => Eq,
-            '<' => Lt,
-            '>' => Gt,
-            '!' => Not,
-            '~' => Tilde,
-            '+' => BinOp(Plus),
-            '-' => BinOp(Minus),
-            '*' => BinOp(Star),
-            '/' => BinOp(Slash),
-            '%' => BinOp(Percent),
-            '^' => BinOp(Caret),
-            '&' => BinOp(And),
-            '|' => BinOp(Or),
-            '@' => At,
-            '.' => Dot,
-            ',' => Comma,
-            ';' => Semi,
-            ':' => Colon,
-            '#' => Pound,
-            '$' => Dollar,
-            '?' => Question,
-            '\'' => SingleQuote,
-            _ => unreachable!(),
-        };
-
-        let tree = TokenTree::Token(span.0, token);
-        match kind {
-            Spacing::Alone => tree.into(),
-            Spacing::Joint => tree.joint(),
-        }
-    }
-}
-
-impl Level {
-    pub(crate) fn to_internal(self) -> errors::Level {
-        match self {
-            Level::Error => errors::Level::Error,
-            Level::Warning => errors::Level::Warning,
-            Level::Note => errors::Level::Note,
-            Level::Help => errors::Level::Help,
-        }
-    }
-}
diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml
index d0ec8640ce9..3316735de66 100644
--- a/src/librustc/Cargo.toml
+++ b/src/librustc/Cargo.toml
@@ -18,7 +18,6 @@ lazy_static = "1.0.0"
 scoped-tls = { version = "0.1.1", features = ["nightly"] }
 log = { version = "0.4", features = ["release_max_level_info", "std"] }
 polonius-engine = "0.5.0"
-proc_macro = { path = "../libproc_macro" }
 rustc-rayon = "0.1.1"
 rustc-rayon-core = "0.1.1"
 rustc_apfloat = { path = "../librustc_apfloat" }
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 3ff2545f78d..388bbc52c3b 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -596,7 +596,7 @@ define_dep_nodes!( <'tcx>
     [] ReachableNonGenerics(CrateNum),
     [] NativeLibraries(CrateNum),
     [] PluginRegistrarFn(CrateNum),
-    [] DeriveRegistrarFn(CrateNum),
+    [] ProcMacroDeclsStatic(CrateNum),
     [input] CrateDisambiguator(CrateNum),
     [input] CrateHash(CrateNum),
     [input] OriginalCrateName(CrateNum),
diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs
index 671f513d5b9..549a848a39d 100644
--- a/src/librustc/middle/dependency_format.rs
+++ b/src/librustc/middle/dependency_format.rs
@@ -127,9 +127,8 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             sess.crt_static() => Linkage::Static,
         config::CrateType::Executable => Linkage::Dynamic,
 
-        // proc-macro crates are required to be dylibs, and they're currently
-        // required to link to libsyntax as well.
-        config::CrateType::ProcMacro => Linkage::Dynamic,
+        // proc-macro crates are mostly cdylibs, but we also need metadata.
+        config::CrateType::ProcMacro => Linkage::Static,
 
         // No linkage happens with rlibs, we just needed the metadata (which we
         // got long ago), so don't bother with anything.
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 1187c53305d..d1c3acc57b7 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -68,7 +68,7 @@ pub struct Session {
     /// For a library crate, this is always none
     pub entry_fn: Once<Option<(NodeId, Span, config::EntryFnType)>>,
     pub plugin_registrar_fn: Once<Option<ast::NodeId>>,
-    pub derive_registrar_fn: Once<Option<ast::NodeId>>,
+    pub proc_macro_decls_static: Once<Option<ast::NodeId>>,
     pub default_sysroot: Option<PathBuf>,
     /// The name of the root source file of the crate, in the local file system.
     /// `None` means that there is no source file.
@@ -687,9 +687,9 @@ impl Session {
         )
     }
 
-    pub fn generate_derive_registrar_symbol(&self, disambiguator: CrateDisambiguator) -> String {
+    pub fn generate_proc_macro_decls_symbol(&self, disambiguator: CrateDisambiguator) -> String {
         format!(
-            "__rustc_derive_registrar_{}__",
+            "__rustc_proc_macro_decls_{}__",
             disambiguator.to_fingerprint().to_hex()
         )
     }
@@ -1146,7 +1146,7 @@ pub fn build_session_(
         // For a library crate, this is always none
         entry_fn: Once::new(),
         plugin_registrar_fn: Once::new(),
-        derive_registrar_fn: Once::new(),
+        proc_macro_decls_static: Once::new(),
         default_sysroot,
         local_crate_source_file,
         working_dir,
diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs
index bb33def51cc..5d12aaeed5f 100644
--- a/src/librustc/ty/query/config.rs
+++ b/src/librustc/ty/query/config.rs
@@ -591,7 +591,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::plugin_registrar_fn<'tcx> {
     }
 }
 
-impl<'tcx> QueryDescription<'tcx> for queries::derive_registrar_fn<'tcx> {
+impl<'tcx> QueryDescription<'tcx> for queries::proc_macro_decls_static<'tcx> {
     fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
         "looking up the derive registrar for a crate".into()
     }
diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs
index 22bd1e26ba3..699c2d111c6 100644
--- a/src/librustc/ty/query/mod.rs
+++ b/src/librustc/ty/query/mod.rs
@@ -470,7 +470,7 @@ define_queries! { <'tcx>
         [] fn foreign_modules: ForeignModules(CrateNum) -> Lrc<Vec<ForeignModule>>,
 
         [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option<DefId>,
-        [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option<DefId>,
+        [] fn proc_macro_decls_static: ProcMacroDeclsStatic(CrateNum) -> Option<DefId>,
         [] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> CrateDisambiguator,
         [] fn crate_hash: CrateHash(CrateNum) -> Svh,
         [] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol,
diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs
index efee39a1d63..5f33d466c4a 100644
--- a/src/librustc/ty/query/plumbing.rs
+++ b/src/librustc/ty/query/plumbing.rs
@@ -1200,7 +1200,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
         DepKind::ReachableNonGenerics => { force!(reachable_non_generics, krate!()); }
         DepKind::NativeLibraries => { force!(native_libraries, krate!()); }
         DepKind::PluginRegistrarFn => { force!(plugin_registrar_fn, krate!()); }
-        DepKind::DeriveRegistrarFn => { force!(derive_registrar_fn, krate!()); }
+        DepKind::ProcMacroDeclsStatic => { force!(proc_macro_decls_static, krate!()); }
         DepKind::CrateDisambiguator => { force!(crate_disambiguator, krate!()); }
         DepKind::CrateHash => { force!(crate_hash, krate!()); }
         DepKind::OriginalCrateName => { force!(original_crate_name, krate!()); }
diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs
index bcc0b8047ef..7a246af82e5 100644
--- a/src/librustc/util/common.rs
+++ b/src/librustc/util/common.rs
@@ -24,7 +24,6 @@ use std::sync::mpsc::{Sender};
 use syntax_pos::{SpanData};
 use ty::TyCtxt;
 use dep_graph::{DepNode};
-use proc_macro;
 use lazy_static;
 use session::Session;
 
@@ -47,14 +46,13 @@ lazy_static! {
 }
 
 fn panic_hook(info: &panic::PanicInfo<'_>) {
-    if !proc_macro::__internal::in_sess() {
-        (*DEFAULT_HOOK)(info);
+    (*DEFAULT_HOOK)(info);
 
-        let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false);
+    let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false);
 
-        if backtrace {
-            TyCtxt::try_print_query_stack();
-        }
+    if backtrace {
+        TyCtxt::try_print_query_stack();
+    }
 
         #[cfg(windows)]
         unsafe {
@@ -66,7 +64,6 @@ fn panic_hook(info: &panic::PanicInfo<'_>) {
                 DebugBreak();
             }
         }
-    }
 }
 
 pub fn install_panic_hook() {
diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs
index 0463da00c89..0fb2641a4f8 100644
--- a/src/librustc_codegen_ssa/back/symbol_export.rs
+++ b/src/librustc_codegen_ssa/back/symbol_export.rs
@@ -157,7 +157,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         })
         .collect();
 
-    if let Some(id) = *tcx.sess.derive_registrar_fn.get() {
+    if let Some(id) = *tcx.sess.proc_macro_decls_static.get() {
         let def_id = tcx.hir.local_def_id(id);
         reachable_non_generics.insert(def_id, SymbolExportLevel::C);
     }
diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs
index f8593363bb1..344a2525784 100644
--- a/src/librustc_codegen_utils/symbol_names.rs
+++ b/src/librustc_codegen_utils/symbol_names.rs
@@ -257,9 +257,9 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
             let disambiguator = tcx.sess.local_crate_disambiguator();
             return tcx.sess.generate_plugin_registrar_symbol(disambiguator);
         }
-        if *tcx.sess.derive_registrar_fn.get() == Some(id) {
+        if *tcx.sess.proc_macro_decls_static.get() == Some(id) {
             let disambiguator = tcx.sess.local_crate_disambiguator();
-            return tcx.sess.generate_derive_registrar_symbol(disambiguator);
+            return tcx.sess.generate_proc_macro_decls_symbol(disambiguator);
         }
     }
 
diff --git a/src/librustc_cratesio_shim/src/lib.rs b/src/librustc_cratesio_shim/src/lib.rs
index 1fe70fa23b7..56e480208e1 100644
--- a/src/librustc_cratesio_shim/src/lib.rs
+++ b/src/librustc_cratesio_shim/src/lib.rs
@@ -15,4 +15,5 @@
 
 extern crate bitflags;
 extern crate log;
+extern crate proc_macro;
 extern crate unicode_width;
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 7ad012409b5..c1705ad2d58 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -62,7 +62,7 @@ use syntax::symbol::Symbol;
 use syntax_pos::{FileName, hygiene};
 use syntax_ext;
 
-use derive_registrar;
+use proc_macro_decls;
 use pretty::ReplaceBodyWithLoop;
 
 use profile;
@@ -1066,7 +1066,7 @@ where
             let num_crate_types = crate_types.len();
             let is_proc_macro_crate = crate_types.contains(&config::CrateType::ProcMacro);
             let is_test_crate = sess.opts.test;
-            syntax_ext::proc_macro_registrar::modify(
+            syntax_ext::proc_macro_decls::modify(
                 &sess.parse_sess,
                 &mut resolver,
                 krate,
@@ -1243,8 +1243,8 @@ where
         .set(time(sess, "looking for plugin registrar", || {
             plugin::build::find_plugin_registrar(sess.diagnostic(), &hir_map)
         }));
-    sess.derive_registrar_fn
-        .set(derive_registrar::find(&hir_map));
+    sess.proc_macro_decls_static
+        .set(proc_macro_decls::find(&hir_map));
 
     time(sess, "loop checking", || loops::check_crate(sess, &hir_map));
 
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index ec3cb95db88..b063176d3ca 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -127,7 +127,7 @@ mod test;
 pub mod profile;
 pub mod driver;
 pub mod pretty;
-mod derive_registrar;
+mod proc_macro_decls;
 
 pub mod target_features {
     use syntax::ast;
diff --git a/src/librustc_driver/derive_registrar.rs b/src/librustc_driver/proc_macro_decls.rs
index 9983efce6af..136a27b1ced 100644
--- a/src/librustc_driver/derive_registrar.rs
+++ b/src/librustc_driver/proc_macro_decls.rs
@@ -17,19 +17,19 @@ use syntax::attr;
 pub fn find(hir_map: &Map) -> Option<ast::NodeId> {
     let krate = hir_map.krate();
 
-    let mut finder = Finder { registrar: None };
+    let mut finder = Finder { decls: None };
     krate.visit_all_item_likes(&mut finder);
-    finder.registrar
+    finder.decls
 }
 
 struct Finder {
-    registrar: Option<ast::NodeId>,
+    decls: Option<ast::NodeId>,
 }
 
 impl<'v> ItemLikeVisitor<'v> for Finder {
     fn visit_item(&mut self, item: &hir::Item) {
-        if attr::contains_name(&item.attrs, "rustc_derive_registrar") {
-            self.registrar = Some(item.id);
+        if attr::contains_name(&item.attrs, "rustc_proc_macro_decls") {
+            self.decls = Some(item.id);
         }
     }
 
diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml
index 276e2a911e6..337c87c24ba 100644
--- a/src/librustc_metadata/Cargo.toml
+++ b/src/librustc_metadata/Cargo.toml
@@ -12,7 +12,6 @@ crate-type = ["dylib"]
 flate2 = "1.0"
 log = "0.4"
 memmap = "0.6"
-proc_macro = { path = "../libproc_macro" }
 rustc = { path = "../librustc" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_errors = { path = "../librustc_errors" }
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index a14dd99eeb3..4ff29f5c04d 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -36,7 +36,6 @@ use std::{cmp, fs};
 
 use syntax::ast;
 use syntax::attr;
-use syntax::edition::Edition;
 use syntax::ext::base::SyntaxExtension;
 use syntax::symbol::Symbol;
 use syntax::visit;
@@ -231,7 +230,7 @@ impl<'a> CrateLoader<'a> {
 
         let dependencies: Vec<CrateNum> = cnum_map.iter().cloned().collect();
 
-        let proc_macros = crate_root.macro_derive_registrar.map(|_| {
+        let proc_macros = crate_root.proc_macro_decls_static.map(|_| {
             self.load_derive_macros(&crate_root, dylib.clone().map(|p| p.0), span)
         });
 
@@ -339,7 +338,7 @@ impl<'a> CrateLoader<'a> {
         match result {
             LoadResult::Previous(cnum) => {
                 let data = self.cstore.get_crate_data(cnum);
-                if data.root.macro_derive_registrar.is_some() {
+                if data.root.proc_macro_decls_static.is_some() {
                     dep_kind = DepKind::UnexportedMacrosOnly;
                 }
                 data.dep_kind.with_lock(|data_dep_kind| {
@@ -431,7 +430,7 @@ impl<'a> CrateLoader<'a> {
                           dep_kind: DepKind)
                           -> cstore::CrateNumMap {
         debug!("resolving deps of external crate");
-        if crate_root.macro_derive_registrar.is_some() {
+        if crate_root.proc_macro_decls_static.is_some() {
             return cstore::CrateNumMap::new();
         }
 
@@ -533,9 +532,8 @@ impl<'a> CrateLoader<'a> {
     fn load_derive_macros(&mut self, root: &CrateRoot, dylib: Option<PathBuf>, span: Span)
                           -> Vec<(ast::Name, Lrc<SyntaxExtension>)> {
         use std::{env, mem};
-        use proc_macro::TokenStream;
-        use proc_macro::__internal::Registry;
         use dynamic_lib::DynamicLibrary;
+        use proc_macro::bridge::client::ProcMacro;
         use syntax_ext::deriving::custom::ProcMacroDerive;
         use syntax_ext::proc_macro_impl::{AttrProcMacro, BangProcMacro};
 
@@ -550,61 +548,49 @@ impl<'a> CrateLoader<'a> {
             Err(err) => self.sess.span_fatal(span, &err),
         };
 
-        let sym = self.sess.generate_derive_registrar_symbol(root.disambiguator);
-        let registrar = unsafe {
+        let sym = self.sess.generate_proc_macro_decls_symbol(root.disambiguator);
+        let decls = unsafe {
             let sym = match lib.symbol(&sym) {
                 Ok(f) => f,
                 Err(err) => self.sess.span_fatal(span, &err),
             };
-            mem::transmute::<*mut u8, fn(&mut dyn Registry)>(sym)
+            *(sym as *const &[ProcMacro])
         };
 
-        struct MyRegistrar {
-            extensions: Vec<(ast::Name, Lrc<SyntaxExtension>)>,
-            edition: Edition,
-        }
-
-        impl Registry for MyRegistrar {
-            fn register_custom_derive(&mut self,
-                                      trait_name: &str,
-                                      expand: fn(TokenStream) -> TokenStream,
-                                      attributes: &[&'static str]) {
-                let attrs = attributes.iter().cloned().map(Symbol::intern).collect::<Vec<_>>();
-                let derive = ProcMacroDerive::new(expand, attrs.clone());
-                let derive = SyntaxExtension::ProcMacroDerive(
-                    Box::new(derive), attrs, self.edition
-                );
-                self.extensions.push((Symbol::intern(trait_name), Lrc::new(derive)));
-            }
-
-            fn register_attr_proc_macro(&mut self,
-                                        name: &str,
-                                        expand: fn(TokenStream, TokenStream) -> TokenStream) {
-                let expand = SyntaxExtension::AttrProcMacro(
-                    Box::new(AttrProcMacro { inner: expand }), self.edition
-                );
-                self.extensions.push((Symbol::intern(name), Lrc::new(expand)));
-            }
-
-            fn register_bang_proc_macro(&mut self,
-                                        name: &str,
-                                        expand: fn(TokenStream) -> TokenStream) {
-                let expand = SyntaxExtension::ProcMacro {
-                    expander: Box::new(BangProcMacro { inner: expand }),
-                    allow_internal_unstable: false,
-                    edition: self.edition,
-                };
-                self.extensions.push((Symbol::intern(name), Lrc::new(expand)));
+        let extensions = decls.iter().map(|&decl| {
+            match decl {
+                ProcMacro::CustomDerive { trait_name, attributes, client } => {
+                    let attrs = attributes.iter().cloned().map(Symbol::intern).collect::<Vec<_>>();
+                    (trait_name, SyntaxExtension::ProcMacroDerive(
+                        Box::new(ProcMacroDerive {
+                            client,
+                            attrs: attrs.clone(),
+                        }),
+                        attrs,
+                        root.edition,
+                    ))
+                }
+                ProcMacro::Attr { name, client } => {
+                    (name, SyntaxExtension::AttrProcMacro(
+                        Box::new(AttrProcMacro { client }),
+                        root.edition,
+                    ))
+                }
+                ProcMacro::Bang { name, client } => {
+                    (name, SyntaxExtension::ProcMacro {
+                        expander: Box::new(BangProcMacro { client }),
+                        allow_internal_unstable: false,
+                        edition: root.edition,
+                    })
+                }
             }
-        }
-
-        let mut my_registrar = MyRegistrar { extensions: Vec::new(), edition: root.edition };
-        registrar(&mut my_registrar);
+        }).map(|(name, ext)| (Symbol::intern(name), Lrc::new(ext))).collect();
 
         // Intentionally leak the dynamic library. We can't ever unload it
         // since the library can make things that will live arbitrarily long.
         mem::forget(lib);
-        my_registrar.extensions
+
+        extensions
     }
 
     /// Look for a plugin registrar. Returns library path, crate
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs
index c7bd1744a3d..d0fa63a6163 100644
--- a/src/librustc_metadata/cstore_impl.rs
+++ b/src/librustc_metadata/cstore_impl.rs
@@ -203,8 +203,8 @@ provide! { <'tcx> tcx, def_id, other, cdata,
             DefId { krate: def_id.krate, index }
         })
     }
-    derive_registrar_fn => {
-        cdata.root.macro_derive_registrar.map(|index| {
+    proc_macro_decls_static => {
+        cdata.root.proc_macro_decls_static.map(|index| {
             DefId { krate: def_id.krate, index }
         })
     }
@@ -431,8 +431,9 @@ impl cstore::CStore {
             use syntax::ext::base::SyntaxExtension;
             use syntax_ext::proc_macro_impl::BangProcMacro;
 
+            let client = ::proc_macro::bridge::client::Client::expand1(::proc_macro::quote);
             let ext = SyntaxExtension::ProcMacro {
-                expander: Box::new(BangProcMacro { inner: ::proc_macro::quote }),
+                expander: Box::new(BangProcMacro { client }),
                 allow_internal_unstable: true,
                 edition: data.root.edition,
             };
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 5421972a4ad..2736c60ffb6 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -496,8 +496,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
                 .plugin_registrar_fn
                 .get()
                 .map(|id| tcx.hir.local_def_id(id).index),
-            macro_derive_registrar: if is_proc_macro {
-                let id = tcx.sess.derive_registrar_fn.get().unwrap();
+            proc_macro_decls_static: if is_proc_macro {
+                let id = tcx.sess.proc_macro_decls_static.get().unwrap();
                 Some(tcx.hir.local_def_id(id).index)
             } else {
                 None
diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs
index 528c96f240d..d4e51693d7e 100644
--- a/src/librustc_metadata/locator.rs
+++ b/src/librustc_metadata/locator.rs
@@ -713,7 +713,7 @@ impl<'a> Context<'a> {
 
         let root = metadata.get_root();
         if let Some(is_proc_macro) = self.is_proc_macro {
-            if root.macro_derive_registrar.is_some() != is_proc_macro {
+            if root.proc_macro_decls_static.is_some() != is_proc_macro {
                 return None;
             }
         }
diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs
index da2a8ae714b..e91d15b78c0 100644
--- a/src/librustc_metadata/schema.rs
+++ b/src/librustc_metadata/schema.rs
@@ -196,7 +196,7 @@ pub struct CrateRoot {
     pub has_panic_handler: bool,
     pub has_default_lib_allocator: bool,
     pub plugin_registrar_fn: Option<DefIndex>,
-    pub macro_derive_registrar: Option<DefIndex>,
+    pub proc_macro_decls_static: Option<DefIndex>,
 
     pub crate_deps: LazySeq<CrateDep>,
     pub dylib_dependency_formats: LazySeq<Option<LinkagePreference>>,
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 3bc34917051..c93abc39ff3 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -1122,8 +1122,8 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
     ("proc_macro_attribute", Normal, Ungated),
     ("proc_macro", Normal, Ungated),
 
-    ("rustc_derive_registrar", Normal, Gated(Stability::Unstable,
-                                             "rustc_derive_registrar",
+    ("rustc_proc_macro_decls", Normal, Gated(Stability::Unstable,
+                                             "rustc_proc_macro_decls",
                                              "used internally by rustc",
                                              cfg_fn!(rustc_attrs))),
 
diff --git a/src/libsyntax_ext/Cargo.toml b/src/libsyntax_ext/Cargo.toml
index 5a691bde3ec..4979d0b3e92 100644
--- a/src/libsyntax_ext/Cargo.toml
+++ b/src/libsyntax_ext/Cargo.toml
@@ -10,7 +10,6 @@ crate-type = ["dylib"]
 
 [dependencies]
 fmt_macros = { path = "../libfmt_macros" }
-proc_macro = { path = "../libproc_macro" }
 rustc_errors = { path = "../librustc_errors" }
 syntax = { path = "../libsyntax" }
 syntax_pos = { path = "../libsyntax_pos" }
diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs
index 55b3928d68e..5c82d191138 100644
--- a/src/libsyntax_ext/deriving/custom.rs
+++ b/src/libsyntax_ext/deriving/custom.rs
@@ -8,15 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::panic;
-
 use errors::FatalError;
-use proc_macro::{TokenStream, __internal};
 use syntax::ast::{self, ItemKind, Attribute, Mac};
 use syntax::attr::{mark_used, mark_known};
 use syntax::source_map::Span;
 use syntax::ext::base::*;
+use syntax::parse;
+use syntax::parse::token::{self, Token};
+use syntax::tokenstream;
 use syntax::visit::Visitor;
+use syntax_pos::DUMMY_SP;
+
+use proc_macro_impl::EXEC_STRATEGY;
 
 struct MarkAttrs<'a>(&'a [ast::Name]);
 
@@ -32,14 +35,10 @@ impl<'a> Visitor<'a> for MarkAttrs<'a> {
 }
 
 pub struct ProcMacroDerive {
-    inner: fn(TokenStream) -> TokenStream,
-    attrs: Vec<ast::Name>,
-}
-
-impl ProcMacroDerive {
-    pub fn new(inner: fn(TokenStream) -> TokenStream, attrs: Vec<ast::Name>) -> ProcMacroDerive {
-        ProcMacroDerive { inner: inner, attrs: attrs }
-    }
+    pub client: ::proc_macro::bridge::client::Client<
+        fn(::proc_macro::TokenStream) -> ::proc_macro::TokenStream,
+    >,
+    pub attrs: Vec<ast::Name>,
 }
 
 impl MultiItemModifier for ProcMacroDerive {
@@ -75,21 +74,17 @@ impl MultiItemModifier for ProcMacroDerive {
         // Mark attributes as known, and used.
         MarkAttrs(&self.attrs).visit_item(&item);
 
-        let input = __internal::new_token_stream(ecx.resolver.eliminate_crate_var(item));
-        let res = __internal::set_sess(ecx, || {
-            let inner = self.inner;
-            panic::catch_unwind(panic::AssertUnwindSafe(|| inner(input)))
-        });
+        let item = ecx.resolver.eliminate_crate_var(item);
+        let token = Token::interpolated(token::NtItem(item));
+        let input = tokenstream::TokenTree::Token(DUMMY_SP, token).into();
 
-        let stream = match res {
+        let server = ::proc_macro_server::Rustc::new(ecx);
+        let stream = match self.client.run(&EXEC_STRATEGY, server, input) {
             Ok(stream) => stream,
             Err(e) => {
                 let msg = "proc-macro derive panicked";
                 let mut err = ecx.struct_span_fatal(span, msg);
-                if let Some(s) = e.downcast_ref::<String>() {
-                    err.help(&format!("message: {}", s));
-                }
-                if let Some(s) = e.downcast_ref::<&'static str>() {
+                if let Some(s) = e.as_str() {
                     err.help(&format!("message: {}", s));
                 }
 
@@ -99,21 +94,33 @@ impl MultiItemModifier for ProcMacroDerive {
         };
 
         let error_count_before = ecx.parse_sess.span_diagnostic.err_count();
-        __internal::set_sess(ecx, || {
-            let msg = "proc-macro derive produced unparseable tokens";
-            match __internal::token_stream_parse_items(stream) {
-                // fail if there have been errors emitted
-                Ok(_) if ecx.parse_sess.span_diagnostic.err_count() > error_count_before => {
-                    ecx.struct_span_fatal(span, msg).emit();
-                    FatalError.raise();
+        let msg = "proc-macro derive produced unparseable tokens";
+
+        let mut parser = parse::stream_to_parser(ecx.parse_sess, stream);
+        let mut items = vec![];
+
+        loop {
+            match parser.parse_item() {
+                Ok(None) => break,
+                Ok(Some(item)) => {
+                    items.push(Annotatable::Item(item))
                 }
-                Ok(new_items) => new_items.into_iter().map(Annotatable::Item).collect(),
-                Err(_) => {
+                Err(mut err) => {
                     // FIXME: handle this better
+                    err.cancel();
                     ecx.struct_span_fatal(span, msg).emit();
                     FatalError.raise();
                 }
             }
-        })
+        }
+
+
+        // fail if there have been errors emitted
+        if ecx.parse_sess.span_diagnostic.err_count() > error_count_before {
+            ecx.struct_span_fatal(span, msg).emit();
+            FatalError.raise();
+        }
+
+        items
     }
 }
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs
index 7c023fc5c9c..1d814a67876 100644
--- a/src/libsyntax_ext/lib.rs
+++ b/src/libsyntax_ext/lib.rs
@@ -14,7 +14,10 @@
        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
        html_root_url = "https://doc.rust-lang.org/nightly/")]
 
+#![feature(in_band_lifetimes)]
+#![feature(proc_macro_diagnostic)]
 #![feature(proc_macro_internals)]
+#![feature(proc_macro_span)]
 #![feature(decl_macro)]
 #![feature(nll)]
 #![feature(str_escape)]
@@ -55,10 +58,9 @@ mod trace_macros;
 mod test;
 mod test_case;
 
-pub mod proc_macro_registrar;
-
-
+pub mod proc_macro_decls;
 pub mod proc_macro_impl;
+mod proc_macro_server;
 
 use rustc_data_structures::sync::Lrc;
 use syntax::ast;
diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_decls.rs
index 65e175f95df..c859275ed02 100644
--- a/src/libsyntax_ext/proc_macro_registrar.rs
+++ b/src/libsyntax_ext/proc_macro_decls.rs
@@ -91,7 +91,7 @@ pub fn modify(sess: &ParseSess,
         return krate;
     }
 
-    krate.module.items.push(mk_registrar(&mut cx, &derives, &attr_macros, &bang_macros));
+    krate.module.items.push(mk_decls(&mut cx, &derives, &attr_macros, &bang_macros));
 
     krate
 }
@@ -339,19 +339,21 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
 //      mod $gensym {
 //          extern crate proc_macro;
 //
-//          use proc_macro::__internal::Registry;
+//          use proc_macro::bridge::client::ProcMacro;
 //
-//          #[plugin_registrar]
-//          fn registrar(registrar: &mut Registry) {
-//              registrar.register_custom_derive($name_trait1, ::$name1, &[]);
-//              registrar.register_custom_derive($name_trait2, ::$name2, &["attribute_name"]);
+//          #[rustc_proc_macro_decls]
+//          static DECLS: &[ProcMacro] = &[
+//              ProcMacro::custom_derive($name_trait1, &[], ::$name1);
+//              ProcMacro::custom_derive($name_trait2, &["attribute_name"], ::$name2);
 //              // ...
-//          }
+//          ];
 //      }
-fn mk_registrar(cx: &mut ExtCtxt,
-                custom_derives: &[ProcMacroDerive],
-                custom_attrs: &[ProcMacroDef],
-                custom_macros: &[ProcMacroDef]) -> P<ast::Item> {
+fn mk_decls(
+    cx: &mut ExtCtxt,
+    custom_derives: &[ProcMacroDerive],
+    custom_attrs: &[ProcMacroDef],
+    custom_macros: &[ProcMacroDef],
+) -> P<ast::Item> {
     let mark = Mark::fresh(Mark::root());
     mark.set_expn_info(ExpnInfo {
         call_site: DUMMY_SP,
@@ -370,75 +372,67 @@ fn mk_registrar(cx: &mut ExtCtxt,
                         Vec::new(),
                         ast::ItemKind::ExternCrate(None));
 
-    let __internal = Ident::from_str("__internal");
-    let registry = Ident::from_str("Registry");
-    let registrar = Ident::from_str("_registrar");
-    let register_custom_derive = Ident::from_str("register_custom_derive");
-    let register_attr_proc_macro = Ident::from_str("register_attr_proc_macro");
-    let register_bang_proc_macro = Ident::from_str("register_bang_proc_macro");
+    let bridge = Ident::from_str("bridge");
+    let client = Ident::from_str("client");
+    let proc_macro_ty = Ident::from_str("ProcMacro");
+    let custom_derive = Ident::from_str("custom_derive");
+    let attr = Ident::from_str("attr");
+    let bang = Ident::from_str("bang");
     let crate_kw = Ident::with_empty_ctxt(keywords::Crate.name());
-    let local_path = |cx: &mut ExtCtxt, sp: Span, name: Ident| {
-        cx.path(sp.with_ctxt(span.ctxt()), vec![crate_kw, name])
+
+    let decls = {
+        let local_path = |sp: Span, name| {
+            cx.expr_path(cx.path(sp.with_ctxt(span.ctxt()), vec![crate_kw, name]))
+        };
+        let proc_macro_ty_method_path = |method| cx.expr_path(cx.path(span, vec![
+            proc_macro, bridge, client, proc_macro_ty, method,
+        ]));
+        custom_derives.iter().map(|cd| {
+            cx.expr_call(span, proc_macro_ty_method_path(custom_derive), vec![
+                cx.expr_str(cd.span, cd.trait_name),
+                cx.expr_vec_slice(
+                    span,
+                    cd.attrs.iter().map(|&s| cx.expr_str(cd.span, s)).collect::<Vec<_>>()
+                ),
+                local_path(cd.span, cd.function_name),
+            ])
+        }).chain(custom_attrs.iter().map(|ca| {
+            cx.expr_call(span, proc_macro_ty_method_path(attr), vec![
+                cx.expr_str(ca.span, ca.function_name.name),
+                local_path(ca.span, ca.function_name),
+            ])
+        })).chain(custom_macros.iter().map(|cm| {
+            cx.expr_call(span, proc_macro_ty_method_path(bang), vec![
+                cx.expr_str(cm.span, cm.function_name.name),
+                local_path(cm.span, cm.function_name),
+            ])
+        })).collect()
     };
 
-    let mut stmts = custom_derives.iter().map(|cd| {
-        let path = local_path(cx, cd.span, cd.function_name);
-        let trait_name = cx.expr_str(cd.span, cd.trait_name);
-        let attrs = cx.expr_vec_slice(
-            span,
-            cd.attrs.iter().map(|&s| cx.expr_str(cd.span, s)).collect::<Vec<_>>()
-        );
-        let registrar = cx.expr_ident(span, registrar);
-        let ufcs_path = cx.path(span, vec![proc_macro, __internal, registry,
-                                           register_custom_derive]);
-
-        cx.stmt_expr(cx.expr_call(span, cx.expr_path(ufcs_path),
-                                  vec![registrar, trait_name, cx.expr_path(path), attrs]))
-
-    }).collect::<Vec<_>>();
-
-    stmts.extend(custom_attrs.iter().map(|ca| {
-        let name = cx.expr_str(ca.span, ca.function_name.name);
-        let path = local_path(cx, ca.span, ca.function_name);
-        let registrar = cx.expr_ident(ca.span, registrar);
-
-        let ufcs_path = cx.path(span,
-                                vec![proc_macro, __internal, registry, register_attr_proc_macro]);
-
-        cx.stmt_expr(cx.expr_call(span, cx.expr_path(ufcs_path),
-                                  vec![registrar, name, cx.expr_path(path)]))
-    }));
-
-    stmts.extend(custom_macros.iter().map(|cm| {
-        let name = cx.expr_str(cm.span, cm.function_name.name);
-        let path = local_path(cx, cm.span, cm.function_name);
-        let registrar = cx.expr_ident(cm.span, registrar);
-
-        let ufcs_path = cx.path(span,
-                                vec![proc_macro, __internal, registry, register_bang_proc_macro]);
-
-        cx.stmt_expr(cx.expr_call(span, cx.expr_path(ufcs_path),
-                                  vec![registrar, name, cx.expr_path(path)]))
-    }));
-
-    let path = cx.path(span, vec![proc_macro, __internal, registry]);
-    let registrar_path = cx.ty_path(path);
-    let arg_ty = cx.ty_rptr(span, registrar_path, None, ast::Mutability::Mutable);
-    let func = cx.item_fn(span,
-                          registrar,
-                          vec![cx.arg(span, registrar, arg_ty)],
-                          cx.ty(span, ast::TyKind::Tup(Vec::new())),
-                          cx.block(span, stmts));
-
-    let derive_registrar = cx.meta_word(span, Symbol::intern("rustc_derive_registrar"));
-    let derive_registrar = cx.attribute(span, derive_registrar);
-    let func = func.map(|mut i| {
-        i.attrs.push(derive_registrar);
+    let decls_static = cx.item_static(
+        span,
+        Ident::from_str("_DECLS"),
+        cx.ty_rptr(span,
+            cx.ty(span, ast::TyKind::Slice(
+                cx.ty_path(cx.path(span,
+                    vec![proc_macro, bridge, client, proc_macro_ty])))),
+            None, ast::Mutability::Immutable),
+        ast::Mutability::Immutable,
+        cx.expr_vec_slice(span, decls),
+    ).map(|mut i| {
+        let attr = cx.meta_word(span, Symbol::intern("rustc_proc_macro_decls"));
+        i.attrs.push(cx.attribute(span, attr));
         i.vis = respan(span, ast::VisibilityKind::Public);
         i
     });
-    let ident = ast::Ident::with_empty_ctxt(Symbol::gensym("registrar"));
-    let module = cx.item_mod(span, span, ident, Vec::new(), vec![krate, func]).map(|mut i| {
+
+    let module = cx.item_mod(
+        span,
+        span,
+        ast::Ident::with_empty_ctxt(Symbol::gensym("decls")),
+        vec![],
+        vec![krate, decls_static],
+    ).map(|mut i| {
         i.vis = respan(span, ast::VisibilityKind::Public);
         i
     });
diff --git a/src/libsyntax_ext/proc_macro_impl.rs b/src/libsyntax_ext/proc_macro_impl.rs
index ff60262055b..43ef31a00ba 100644
--- a/src/libsyntax_ext/proc_macro_impl.rs
+++ b/src/libsyntax_ext/proc_macro_impl.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::panic;
 
 use errors::FatalError;
 
@@ -17,11 +16,13 @@ use syntax::ext::base::*;
 use syntax::tokenstream::TokenStream;
 use syntax::ext::base;
 
-use proc_macro::TokenStream as TsShim;
-use proc_macro::__internal;
+pub const EXEC_STRATEGY: ::proc_macro::bridge::server::SameThread =
+    ::proc_macro::bridge::server::SameThread;
 
 pub struct AttrProcMacro {
-    pub inner: fn(TsShim, TsShim) -> TsShim,
+    pub client: ::proc_macro::bridge::client::Client<
+        fn(::proc_macro::TokenStream, ::proc_macro::TokenStream) -> ::proc_macro::TokenStream,
+    >,
 }
 
 impl base::AttrProcMacro for AttrProcMacro {
@@ -31,22 +32,13 @@ impl base::AttrProcMacro for AttrProcMacro {
                    annotation: TokenStream,
                    annotated: TokenStream)
                    -> TokenStream {
-        let annotation = __internal::token_stream_wrap(annotation);
-        let annotated = __internal::token_stream_wrap(annotated);
-
-        let res = __internal::set_sess(ecx, || {
-            panic::catch_unwind(panic::AssertUnwindSafe(|| (self.inner)(annotation, annotated)))
-        });
-
-        match res {
-            Ok(stream) => __internal::token_stream_inner(stream),
+        let server = ::proc_macro_server::Rustc::new(ecx);
+        match self.client.run(&EXEC_STRATEGY, server, annotation, annotated) {
+            Ok(stream) => stream,
             Err(e) => {
                 let msg = "custom attribute panicked";
                 let mut err = ecx.struct_span_fatal(span, msg);
-                if let Some(s) = e.downcast_ref::<String>() {
-                    err.help(&format!("message: {}", s));
-                }
-                if let Some(s) = e.downcast_ref::<&'static str>() {
+                if let Some(s) = e.as_str() {
                     err.help(&format!("message: {}", s));
                 }
 
@@ -58,7 +50,9 @@ impl base::AttrProcMacro for AttrProcMacro {
 }
 
 pub struct BangProcMacro {
-    pub inner: fn(TsShim) -> TsShim,
+    pub client: ::proc_macro::bridge::client::Client<
+        fn(::proc_macro::TokenStream) -> ::proc_macro::TokenStream,
+    >,
 }
 
 impl base::ProcMacro for BangProcMacro {
@@ -67,21 +61,13 @@ impl base::ProcMacro for BangProcMacro {
                    span: Span,
                    input: TokenStream)
                    -> TokenStream {
-        let input = __internal::token_stream_wrap(input);
-
-        let res = __internal::set_sess(ecx, || {
-            panic::catch_unwind(panic::AssertUnwindSafe(|| (self.inner)(input)))
-        });
-
-        match res {
-            Ok(stream) => __internal::token_stream_inner(stream),
+        let server = ::proc_macro_server::Rustc::new(ecx);
+        match self.client.run(&EXEC_STRATEGY, server, input) {
+            Ok(stream) => stream,
             Err(e) => {
                 let msg = "proc macro panicked";
                 let mut err = ecx.struct_span_fatal(span, msg);
-                if let Some(s) = e.downcast_ref::<String>() {
-                    err.help(&format!("message: {}", s));
-                }
-                if let Some(s) = e.downcast_ref::<&'static str>() {
+                if let Some(s) = e.as_str() {
                     err.help(&format!("message: {}", s));
                 }
 
diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs
new file mode 100644
index 00000000000..56bd58b28a6
--- /dev/null
+++ b/src/libsyntax_ext/proc_macro_server.rs
@@ -0,0 +1,751 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use errors::{self, Diagnostic, DiagnosticBuilder};
+use std::panic;
+
+use proc_macro::bridge::{server, TokenTree};
+use proc_macro::{Delimiter, Level, LineColumn, Spacing};
+
+use rustc_data_structures::sync::Lrc;
+use std::ascii;
+use std::ops::Bound;
+use syntax::ast;
+use syntax::ext::base::ExtCtxt;
+use syntax::parse::lexer::comments;
+use syntax::parse::{self, token, ParseSess};
+use syntax::tokenstream::{self, DelimSpan, TokenStream};
+use syntax_pos::hygiene::{SyntaxContext, Transparency};
+use syntax_pos::symbol::{keywords, Symbol};
+use syntax_pos::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span};
+
+trait FromInternal<T> {
+    fn from_internal(x: T) -> Self;
+}
+
+trait ToInternal<T> {
+    fn to_internal(self) -> T;
+}
+
+impl FromInternal<token::DelimToken> for Delimiter {
+    fn from_internal(delim: token::DelimToken) -> Delimiter {
+        match delim {
+            token::Paren => Delimiter::Parenthesis,
+            token::Brace => Delimiter::Brace,
+            token::Bracket => Delimiter::Bracket,
+            token::NoDelim => Delimiter::None,
+        }
+    }
+}
+
+impl ToInternal<token::DelimToken> for Delimiter {
+    fn to_internal(self) -> token::DelimToken {
+        match self {
+            Delimiter::Parenthesis => token::Paren,
+            Delimiter::Brace => token::Brace,
+            Delimiter::Bracket => token::Bracket,
+            Delimiter::None => token::NoDelim,
+        }
+    }
+}
+
+impl FromInternal<(TokenStream, &'_ ParseSess, &'_ mut Vec<Self>)>
+    for TokenTree<Group, Punct, Ident, Literal>
+{
+    fn from_internal((stream, sess, stack): (TokenStream, &ParseSess, &mut Vec<Self>)) -> Self {
+        use syntax::parse::token::*;
+
+        let (tree, joint) = stream.as_tree();
+        let (span, token) = match tree {
+            tokenstream::TokenTree::Delimited(span, delimed) => {
+                let delimiter = Delimiter::from_internal(delimed.delim);
+                return TokenTree::Group(Group {
+                    delimiter,
+                    stream: delimed.tts.into(),
+                    span,
+                });
+            }
+            tokenstream::TokenTree::Token(span, token) => (span, token),
+        };
+
+        macro_rules! tt {
+            ($ty:ident { $($field:ident $(: $value:expr)*),+ $(,)* }) => (
+                TokenTree::$ty(self::$ty {
+                    $($field $(: $value)*,)*
+                    span,
+                })
+            )
+        }
+        macro_rules! op {
+            ($a:expr) => {
+                tt!(Punct { ch: $a, joint })
+            };
+            ($a:expr, $b:expr) => {{
+                stack.push(tt!(Punct { ch: $b, joint }));
+                tt!(Punct {
+                    ch: $a,
+                    joint: true
+                })
+            }};
+            ($a:expr, $b:expr, $c:expr) => {{
+                stack.push(tt!(Punct { ch: $c, joint }));
+                stack.push(tt!(Punct {
+                    ch: $b,
+                    joint: true
+                }));
+                tt!(Punct {
+                    ch: $a,
+                    joint: true
+                })
+            }};
+        }
+
+        match token {
+            Eq => op!('='),
+            Lt => op!('<'),
+            Le => op!('<', '='),
+            EqEq => op!('=', '='),
+            Ne => op!('!', '='),
+            Ge => op!('>', '='),
+            Gt => op!('>'),
+            AndAnd => op!('&', '&'),
+            OrOr => op!('|', '|'),
+            Not => op!('!'),
+            Tilde => op!('~'),
+            BinOp(Plus) => op!('+'),
+            BinOp(Minus) => op!('-'),
+            BinOp(Star) => op!('*'),
+            BinOp(Slash) => op!('/'),
+            BinOp(Percent) => op!('%'),
+            BinOp(Caret) => op!('^'),
+            BinOp(And) => op!('&'),
+            BinOp(Or) => op!('|'),
+            BinOp(Shl) => op!('<', '<'),
+            BinOp(Shr) => op!('>', '>'),
+            BinOpEq(Plus) => op!('+', '='),
+            BinOpEq(Minus) => op!('-', '='),
+            BinOpEq(Star) => op!('*', '='),
+            BinOpEq(Slash) => op!('/', '='),
+            BinOpEq(Percent) => op!('%', '='),
+            BinOpEq(Caret) => op!('^', '='),
+            BinOpEq(And) => op!('&', '='),
+            BinOpEq(Or) => op!('|', '='),
+            BinOpEq(Shl) => op!('<', '<', '='),
+            BinOpEq(Shr) => op!('>', '>', '='),
+            At => op!('@'),
+            Dot => op!('.'),
+            DotDot => op!('.', '.'),
+            DotDotDot => op!('.', '.', '.'),
+            DotDotEq => op!('.', '.', '='),
+            Comma => op!(','),
+            Semi => op!(';'),
+            Colon => op!(':'),
+            ModSep => op!(':', ':'),
+            RArrow => op!('-', '>'),
+            LArrow => op!('<', '-'),
+            FatArrow => op!('=', '>'),
+            Pound => op!('#'),
+            Dollar => op!('$'),
+            Question => op!('?'),
+            SingleQuote => op!('\''),
+
+            Ident(ident, is_raw) => tt!(Ident {
+                sym: ident.name,
+                is_raw
+            }),
+            Lifetime(ident) => {
+                let ident = ident.without_first_quote();
+                stack.push(tt!(Ident {
+                    sym: ident.name,
+                    is_raw: false
+                }));
+                tt!(Punct {
+                    ch: '\'',
+                    joint: true
+                })
+            }
+            Literal(lit, suffix) => tt!(Literal { lit, suffix }),
+            DocComment(c) => {
+                let style = comments::doc_comment_style(&c.as_str());
+                let stripped = comments::strip_doc_comment_decoration(&c.as_str());
+                let mut escaped = String::new();
+                for ch in stripped.chars() {
+                    escaped.extend(ch.escape_debug());
+                }
+                let stream = vec![
+                    Ident(ast::Ident::new(Symbol::intern("doc"), span), false),
+                    Eq,
+                    Literal(Lit::Str_(Symbol::intern(&escaped)), None),
+                ]
+                .into_iter()
+                .map(|token| tokenstream::TokenTree::Token(span, token))
+                .collect();
+                stack.push(TokenTree::Group(Group {
+                    delimiter: Delimiter::Bracket,
+                    stream,
+                    span: DelimSpan::from_single(span),
+                }));
+                if style == ast::AttrStyle::Inner {
+                    stack.push(tt!(Punct {
+                        ch: '!',
+                        joint: false
+                    }));
+                }
+                tt!(Punct {
+                    ch: '#',
+                    joint: false
+                })
+            }
+
+            Interpolated(_) => {
+                let stream = token.interpolated_to_tokenstream(sess, span);
+                TokenTree::Group(Group {
+                    delimiter: Delimiter::None,
+                    stream,
+                    span: DelimSpan::from_single(span),
+                })
+            }
+
+            DotEq => op!('.', '='),
+            OpenDelim(..) | CloseDelim(..) => unreachable!(),
+            Whitespace | Comment | Shebang(..) | Eof => unreachable!(),
+        }
+    }
+}
+
+impl ToInternal<TokenStream> for TokenTree<Group, Punct, Ident, Literal> {
+    fn to_internal(self) -> TokenStream {
+        use syntax::parse::token::*;
+
+        let (ch, joint, span) = match self {
+            TokenTree::Punct(Punct { ch, joint, span }) => (ch, joint, span),
+            TokenTree::Group(Group {
+                delimiter,
+                stream,
+                span,
+            }) => {
+                return tokenstream::TokenTree::Delimited(
+                    span,
+                    tokenstream::Delimited {
+                        delim: delimiter.to_internal(),
+                        tts: stream.into(),
+                    },
+                )
+                .into();
+            }
+            TokenTree::Ident(self::Ident { sym, span, is_raw }) => {
+                let token = Ident(ast::Ident::new(sym, span), is_raw);
+                return tokenstream::TokenTree::Token(span, token).into();
+            }
+            TokenTree::Literal(self::Literal {
+                lit: Lit::Integer(ref a),
+                suffix,
+                span,
+            }) if a.as_str().starts_with("-") => {
+                let minus = BinOp(BinOpToken::Minus);
+                let integer = Symbol::intern(&a.as_str()[1..]);
+                let integer = Literal(Lit::Integer(integer), suffix);
+                let a = tokenstream::TokenTree::Token(span, minus);
+                let b = tokenstream::TokenTree::Token(span, integer);
+                return vec![a, b].into_iter().collect();
+            }
+            TokenTree::Literal(self::Literal {
+                lit: Lit::Float(ref a),
+                suffix,
+                span,
+            }) if a.as_str().starts_with("-") => {
+                let minus = BinOp(BinOpToken::Minus);
+                let float = Symbol::intern(&a.as_str()[1..]);
+                let float = Literal(Lit::Float(float), suffix);
+                let a = tokenstream::TokenTree::Token(span, minus);
+                let b = tokenstream::TokenTree::Token(span, float);
+                return vec![a, b].into_iter().collect();
+            }
+            TokenTree::Literal(self::Literal { lit, suffix, span }) => {
+                return tokenstream::TokenTree::Token(span, Literal(lit, suffix)).into()
+            }
+        };
+
+        let token = match ch {
+            '=' => Eq,
+            '<' => Lt,
+            '>' => Gt,
+            '!' => Not,
+            '~' => Tilde,
+            '+' => BinOp(Plus),
+            '-' => BinOp(Minus),
+            '*' => BinOp(Star),
+            '/' => BinOp(Slash),
+            '%' => BinOp(Percent),
+            '^' => BinOp(Caret),
+            '&' => BinOp(And),
+            '|' => BinOp(Or),
+            '@' => At,
+            '.' => Dot,
+            ',' => Comma,
+            ';' => Semi,
+            ':' => Colon,
+            '#' => Pound,
+            '$' => Dollar,
+            '?' => Question,
+            '\'' => SingleQuote,
+            _ => unreachable!(),
+        };
+
+        let tree = tokenstream::TokenTree::Token(span, token);
+        if joint {
+            tree.joint()
+        } else {
+            tree.into()
+        }
+    }
+}
+
+impl ToInternal<errors::Level> for Level {
+    fn to_internal(self) -> errors::Level {
+        match self {
+            Level::Error => errors::Level::Error,
+            Level::Warning => errors::Level::Warning,
+            Level::Note => errors::Level::Note,
+            Level::Help => errors::Level::Help,
+            _ => unreachable!("unknown proc_macro::Level variant: {:?}", self),
+        }
+    }
+}
+
+#[derive(Clone)]
+pub struct TokenStreamIter {
+    cursor: tokenstream::Cursor,
+    stack: Vec<TokenTree<Group, Punct, Ident, Literal>>,
+}
+
+#[derive(Clone)]
+pub struct Group {
+    delimiter: Delimiter,
+    stream: TokenStream,
+    span: DelimSpan,
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Punct {
+    ch: char,
+    // NB. not using `Spacing` here because it doesn't implement `Hash`.
+    joint: bool,
+    span: Span,
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Ident {
+    sym: Symbol,
+    span: Span,
+    is_raw: bool,
+}
+
+// FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
+#[derive(Clone, Debug)]
+pub struct Literal {
+    lit: token::Lit,
+    suffix: Option<Symbol>,
+    span: Span,
+}
+
+pub(crate) struct Rustc<'a> {
+    sess: &'a ParseSess,
+    def_site: Span,
+    call_site: Span,
+}
+
+impl<'a> Rustc<'a> {
+    pub fn new(cx: &'a ExtCtxt) -> Self {
+        // No way to determine def location for a proc macro right now, so use call location.
+        let location = cx.current_expansion.mark.expn_info().unwrap().call_site;
+        let to_span = |transparency| {
+            location.with_ctxt(
+                SyntaxContext::empty()
+                    .apply_mark_with_transparency(cx.current_expansion.mark, transparency),
+            )
+        };
+        Rustc {
+            sess: cx.parse_sess,
+            def_site: to_span(Transparency::Opaque),
+            call_site: to_span(Transparency::Transparent),
+        }
+    }
+}
+
+impl server::Types for Rustc<'_> {
+    type TokenStream = TokenStream;
+    type TokenStreamBuilder = tokenstream::TokenStreamBuilder;
+    type TokenStreamIter = TokenStreamIter;
+    type Group = Group;
+    type Punct = Punct;
+    type Ident = Ident;
+    type Literal = Literal;
+    type SourceFile = Lrc<SourceFile>;
+    type MultiSpan = Vec<Span>;
+    type Diagnostic = Diagnostic;
+    type Span = Span;
+}
+
+impl server::TokenStream for Rustc<'_> {
+    fn new(&mut self) -> Self::TokenStream {
+        TokenStream::empty()
+    }
+    fn is_empty(&mut self, stream: &Self::TokenStream) -> bool {
+        stream.is_empty()
+    }
+    fn from_str(&mut self, src: &str) -> Self::TokenStream {
+        parse::parse_stream_from_source_str(
+            FileName::ProcMacroSourceCode,
+            src.to_string(),
+            self.sess,
+            Some(self.call_site),
+        )
+    }
+    fn to_string(&mut self, stream: &Self::TokenStream) -> String {
+        stream.to_string()
+    }
+    fn from_token_tree(
+        &mut self,
+        tree: TokenTree<Self::Group, Self::Punct, Self::Ident, Self::Literal>,
+    ) -> Self::TokenStream {
+        tree.to_internal()
+    }
+    fn into_iter(&mut self, stream: Self::TokenStream) -> Self::TokenStreamIter {
+        TokenStreamIter {
+            cursor: stream.trees(),
+            stack: vec![],
+        }
+    }
+}
+
+impl server::TokenStreamBuilder for Rustc<'_> {
+    fn new(&mut self) -> Self::TokenStreamBuilder {
+        tokenstream::TokenStreamBuilder::new()
+    }
+    fn push(&mut self, builder: &mut Self::TokenStreamBuilder, stream: Self::TokenStream) {
+        builder.push(stream);
+    }
+    fn build(&mut self, builder: Self::TokenStreamBuilder) -> Self::TokenStream {
+        builder.build()
+    }
+}
+
+impl server::TokenStreamIter for Rustc<'_> {
+    fn next(
+        &mut self,
+        iter: &mut Self::TokenStreamIter,
+    ) -> Option<TokenTree<Self::Group, Self::Punct, Self::Ident, Self::Literal>> {
+        loop {
+            let tree = iter.stack.pop().or_else(|| {
+                let next = iter.cursor.next_as_stream()?;
+                Some(TokenTree::from_internal((next, self.sess, &mut iter.stack)))
+            })?;
+            // HACK: The condition "dummy span + group with empty delimiter" represents an AST
+            // fragment approximately converted into a token stream. This may happen, for
+            // example, with inputs to proc macro attributes, including derives. Such "groups"
+            // need to flattened during iteration over stream's token trees.
+            // Eventually this needs to be removed in favor of keeping original token trees
+            // and not doing the roundtrip through AST.
+            if let TokenTree::Group(ref group) = tree {
+                if group.delimiter == Delimiter::None && group.span.entire().is_dummy() {
+                    iter.cursor.insert(group.stream.clone());
+                    continue;
+                }
+            }
+            return Some(tree);
+        }
+    }
+}
+
+impl server::Group for Rustc<'_> {
+    fn new(&mut self, delimiter: Delimiter, stream: Self::TokenStream) -> Self::Group {
+        Group {
+            delimiter,
+            stream,
+            span: DelimSpan::from_single(server::Span::call_site(self)),
+        }
+    }
+    fn delimiter(&mut self, group: &Self::Group) -> Delimiter {
+        group.delimiter
+    }
+    fn stream(&mut self, group: &Self::Group) -> Self::TokenStream {
+        group.stream.clone()
+    }
+    fn span(&mut self, group: &Self::Group) -> Self::Span {
+        group.span.entire()
+    }
+    fn span_open(&mut self, group: &Self::Group) -> Self::Span {
+        group.span.open
+    }
+    fn span_close(&mut self, group: &Self::Group) -> Self::Span {
+        group.span.close
+    }
+    fn set_span(&mut self, group: &mut Self::Group, span: Self::Span) {
+        group.span = DelimSpan::from_single(span);
+    }
+}
+
+impl server::Punct for Rustc<'_> {
+    fn new(&mut self, ch: char, spacing: Spacing) -> Self::Punct {
+        Punct {
+            ch,
+            joint: spacing == Spacing::Joint,
+            span: server::Span::call_site(self),
+        }
+    }
+    fn as_char(&mut self, punct: Self::Punct) -> char {
+        punct.ch
+    }
+    fn spacing(&mut self, punct: Self::Punct) -> Spacing {
+        if punct.joint {
+            Spacing::Joint
+        } else {
+            Spacing::Alone
+        }
+    }
+    fn span(&mut self, punct: Self::Punct) -> Self::Span {
+        punct.span
+    }
+    fn with_span(&mut self, punct: Self::Punct, span: Self::Span) -> Self::Punct {
+        Punct { span, ..punct }
+    }
+}
+
+impl server::Ident for Rustc<'_> {
+    fn new(&mut self, string: &str, span: Self::Span, is_raw: bool) -> Self::Ident {
+        let sym = Symbol::intern(string);
+        if is_raw
+            && (sym == keywords::Underscore.name()
+                || ast::Ident::with_empty_ctxt(sym).is_path_segment_keyword())
+        {
+            panic!("`{:?}` is not a valid raw identifier", string)
+        }
+        Ident { sym, span, is_raw }
+    }
+    fn span(&mut self, ident: Self::Ident) -> Self::Span {
+        ident.span
+    }
+    fn with_span(&mut self, ident: Self::Ident, span: Self::Span) -> Self::Ident {
+        Ident { span, ..ident }
+    }
+}
+
+impl server::Literal for Rustc<'_> {
+    // FIXME(eddyb) `Literal` should not expose internal `Debug` impls.
+    fn debug(&mut self, literal: &Self::Literal) -> String {
+        format!("{:?}", literal)
+    }
+    fn integer(&mut self, n: &str) -> Self::Literal {
+        Literal {
+            lit: token::Lit::Integer(Symbol::intern(n)),
+            suffix: None,
+            span: server::Span::call_site(self),
+        }
+    }
+    fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal {
+        Literal {
+            lit: token::Lit::Integer(Symbol::intern(n)),
+            suffix: Some(Symbol::intern(kind)),
+            span: server::Span::call_site(self),
+        }
+    }
+    fn float(&mut self, n: &str) -> Self::Literal {
+        Literal {
+            lit: token::Lit::Float(Symbol::intern(n)),
+            suffix: None,
+            span: server::Span::call_site(self),
+        }
+    }
+    fn f32(&mut self, n: &str) -> Self::Literal {
+        Literal {
+            lit: token::Lit::Float(Symbol::intern(n)),
+            suffix: Some(Symbol::intern("f32")),
+            span: server::Span::call_site(self),
+        }
+    }
+    fn f64(&mut self, n: &str) -> Self::Literal {
+        Literal {
+            lit: token::Lit::Float(Symbol::intern(n)),
+            suffix: Some(Symbol::intern("f64")),
+            span: server::Span::call_site(self),
+        }
+    }
+    fn string(&mut self, string: &str) -> Self::Literal {
+        let mut escaped = String::new();
+        for ch in string.chars() {
+            escaped.extend(ch.escape_debug());
+        }
+        Literal {
+            lit: token::Lit::Str_(Symbol::intern(&escaped)),
+            suffix: None,
+            span: server::Span::call_site(self),
+        }
+    }
+    fn character(&mut self, ch: char) -> Self::Literal {
+        let mut escaped = String::new();
+        escaped.extend(ch.escape_unicode());
+        Literal {
+            lit: token::Lit::Char(Symbol::intern(&escaped)),
+            suffix: None,
+            span: server::Span::call_site(self),
+        }
+    }
+    fn byte_string(&mut self, bytes: &[u8]) -> Self::Literal {
+        let string = bytes
+            .iter()
+            .cloned()
+            .flat_map(ascii::escape_default)
+            .map(Into::<char>::into)
+            .collect::<String>();
+        Literal {
+            lit: token::Lit::ByteStr(Symbol::intern(&string)),
+            suffix: None,
+            span: server::Span::call_site(self),
+        }
+    }
+    fn span(&mut self, literal: &Self::Literal) -> Self::Span {
+        literal.span
+    }
+    fn set_span(&mut self, literal: &mut Self::Literal, span: Self::Span) {
+        literal.span = span;
+    }
+    fn subspan(
+        &mut self,
+        literal: &Self::Literal,
+        start: Bound<usize>,
+        end: Bound<usize>,
+    ) -> Option<Self::Span> {
+        let span = literal.span;
+        let length = span.hi().to_usize() - span.lo().to_usize();
+
+        let start = match start {
+            Bound::Included(lo) => lo,
+            Bound::Excluded(lo) => lo + 1,
+            Bound::Unbounded => 0,
+        };
+
+        let end = match end {
+            Bound::Included(hi) => hi + 1,
+            Bound::Excluded(hi) => hi,
+            Bound::Unbounded => length,
+        };
+
+        // Bounds check the values, preventing addition overflow and OOB spans.
+        if start > u32::max_value() as usize
+            || end > u32::max_value() as usize
+            || (u32::max_value() - start as u32) < span.lo().to_u32()
+            || (u32::max_value() - end as u32) < span.lo().to_u32()
+            || start >= end
+            || end > length
+        {
+            return None;
+        }
+
+        let new_lo = span.lo() + BytePos::from_usize(start);
+        let new_hi = span.lo() + BytePos::from_usize(end);
+        Some(span.with_lo(new_lo).with_hi(new_hi))
+    }
+}
+
+impl<'a> server::SourceFile for Rustc<'a> {
+    fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
+        Lrc::ptr_eq(file1, file2)
+    }
+    fn path(&mut self, file: &Self::SourceFile) -> String {
+        match file.name {
+            FileName::Real(ref path) => path
+                .to_str()
+                .expect("non-UTF8 file path in `proc_macro::SourceFile::path`")
+                .to_string(),
+            _ => file.name.to_string(),
+        }
+    }
+    fn is_real(&mut self, file: &Self::SourceFile) -> bool {
+        file.is_real_file()
+    }
+}
+
+impl server::MultiSpan for Rustc<'_> {
+    fn new(&mut self) -> Self::MultiSpan {
+        vec![]
+    }
+    fn push(&mut self, spans: &mut Self::MultiSpan, span: Self::Span) {
+        spans.push(span)
+    }
+}
+
+impl server::Diagnostic for Rustc<'_> {
+    fn new(&mut self, level: Level, msg: &str, spans: Self::MultiSpan) -> Self::Diagnostic {
+        let mut diag = Diagnostic::new(level.to_internal(), msg);
+        diag.set_span(MultiSpan::from_spans(spans));
+        diag
+    }
+    fn sub(
+        &mut self,
+        diag: &mut Self::Diagnostic,
+        level: Level,
+        msg: &str,
+        spans: Self::MultiSpan,
+    ) {
+        diag.sub(level.to_internal(), msg, MultiSpan::from_spans(spans), None);
+    }
+    fn emit(&mut self, diag: Self::Diagnostic) {
+        DiagnosticBuilder::new_diagnostic(&self.sess.span_diagnostic, diag).emit()
+    }
+}
+
+impl server::Span for Rustc<'_> {
+    fn debug(&mut self, span: Self::Span) -> String {
+        format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0)
+    }
+    fn def_site(&mut self) -> Self::Span {
+        self.def_site
+    }
+    fn call_site(&mut self) -> Self::Span {
+        self.call_site
+    }
+    fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
+        self.sess.source_map().lookup_char_pos(span.lo()).file
+    }
+    fn parent(&mut self, span: Self::Span) -> Option<Self::Span> {
+        span.ctxt().outer().expn_info().map(|i| i.call_site)
+    }
+    fn source(&mut self, span: Self::Span) -> Self::Span {
+        span.source_callsite()
+    }
+    fn start(&mut self, span: Self::Span) -> LineColumn {
+        let loc = self.sess.source_map().lookup_char_pos(span.lo());
+        LineColumn {
+            line: loc.line,
+            column: loc.col.to_usize(),
+        }
+    }
+    fn end(&mut self, span: Self::Span) -> LineColumn {
+        let loc = self.sess.source_map().lookup_char_pos(span.hi());
+        LineColumn {
+            line: loc.line,
+            column: loc.col.to_usize(),
+        }
+    }
+    fn join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {
+        let self_loc = self.sess.source_map().lookup_char_pos(first.lo());
+        let other_loc = self.sess.source_map().lookup_char_pos(second.lo());
+
+        if self_loc.file.name != other_loc.file.name {
+            return None;
+        }
+
+        Some(first.to(second))
+    }
+    fn resolved_at(&mut self, span: Self::Span, at: Self::Span) -> Self::Span {
+        span.with_ctxt(at.ctxt())
+    }
+}
diff --git a/src/libtest/Cargo.toml b/src/libtest/Cargo.toml
index ec77f953380..aade10ed6c3 100644
--- a/src/libtest/Cargo.toml
+++ b/src/libtest/Cargo.toml
@@ -11,3 +11,6 @@ crate-type = ["dylib", "rlib"]
 [dependencies]
 getopts = "0.2"
 term = { path = "../libterm" }
+
+# not actually used but needed to always have proc_macro in the sysroot
+proc_macro = { path = "../libproc_macro" }
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs b/src/test/compile-fail/proc-macro/attr-invalid-exprs.rs
index f52c251c14d..798cd1406ac 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs
+++ b/src/test/compile-fail/proc-macro/attr-invalid-exprs.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr-stmt-expr.rs
-// ignore-stage1
 
 //! Attributes producing expressions in invalid locations
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/compile-fail/proc-macro/attr-stmt-expr.rs
index 1344156b305..6d1d5dfe8cc 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs
+++ b/src/test/compile-fail/proc-macro/attr-stmt-expr.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr-stmt-expr.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs b/src/test/compile-fail/proc-macro/attribute-with-error.rs
index cf2522be922..ed2e8ec00a9 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs
+++ b/src/test/compile-fail/proc-macro/attribute-with-error.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attribute-with-error.rs
-// ignore-stage1
 
 #![feature(custom_inner_attributes)]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute.rs b/src/test/compile-fail/proc-macro/attribute.rs
index 5d5e61270b6..f89d74de50f 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attribute.rs
+++ b/src/test/compile-fail/proc-macro/attribute.rs
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 
 extern crate proc_macro;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs b/src/test/compile-fail/proc-macro/attributes-included.rs
index e941367b08d..e129711129a 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs
+++ b/src/test/compile-fail/proc-macro/attributes-included.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attributes-included.rs
-// ignore-stage1
 // compile-pass
 
 #![warn(unused)]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs
index 22ddc913995..4cfeec2f8a6 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attribute-with-error.rs b/src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs
index 14284092669..14284092669 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attribute-with-error.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attributes-included.rs b/src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs
index a1f4209662d..a1f4209662d 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attributes-included.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/bang_proc_macro2.rs b/src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs
index 3f0a4574367..3f0a4574367 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/bang_proc_macro2.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-b.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs
index cd8750bc89c..cd8750bc89c 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-b.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-a.rs
index 53b2c23e5d7..53b2c23e5d7 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-a.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-b.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-b.rs
index 5787546fb1e..5787546fb1e 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-b.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-b.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-bad.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs
index 841b39eaed0..b2ded05eb51 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-bad.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// no-prefer-dynamic
 // force-host
+// no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-clona.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs
index 719fbdb15ef..719fbdb15ef 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-clona.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-foo.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs
index 64dcf72ba20..64dcf72ba20 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-foo.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable-2.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs
index 2d492d341eb..2d492d341eb 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable-2.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs
index a7b5d1e3e54..a7b5d1e3e54 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue-41211.rs b/src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs
index 5365e8238e9..5365e8238e9 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue-41211.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_38586.rs b/src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs
index e1a7ffaa26c..e1a7ffaa26c 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_38586.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_50493.rs b/src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs
index e71b792a48a..e71b792a48a 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_50493.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/more-gates.rs b/src/test/compile-fail/proc-macro/auxiliary/more-gates.rs
index 67fe93058aa..cc9420e1537 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/more-gates.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/more-gates.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs
index 0f8fd5b5709..7e4b7fe263d 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// no-prefer-dynamic
 // force-host
+// no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs b/src/test/compile-fail/proc-macro/auxiliary/test-macros.rs
index 581c7cb15a5..0e4343a90d6 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs
+++ b/src/test/compile-fail/proc-macro/auxiliary/test-macros.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/define-two.rs b/src/test/compile-fail/proc-macro/define-two.rs
index 8321c471b2a..f8c287b6b72 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/define-two.rs
+++ b/src/test/compile-fail/proc-macro/define-two.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs b/src/test/compile-fail/proc-macro/derive-bad.rs
index 93790f59372..ac27e87ace1 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs
+++ b/src/test/compile-fail/proc-macro/derive-bad.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-bad.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_bad;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/derive-still-gated.rs b/src/test/compile-fail/proc-macro/derive-still-gated.rs
index f36236c5356..f36236c5356 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/derive-still-gated.rs
+++ b/src/test/compile-fail/proc-macro/derive-still-gated.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs b/src/test/compile-fail/proc-macro/expand-to-unstable-2.rs
index 6f254dcbdb1..e4fcbb117a5 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs
+++ b/src/test/compile-fail/proc-macro/expand-to-unstable-2.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-unstable-2.rs
-// ignore-stage1
 
 #![allow(warnings)]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs b/src/test/compile-fail/proc-macro/expand-to-unstable.rs
index ca0f0e382ed..836e336fc22 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs
+++ b/src/test/compile-fail/proc-macro/expand-to-unstable.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-unstable.rs
-// ignore-stage1
 
 #![allow(warnings)]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/export-macro.rs b/src/test/compile-fail/proc-macro/export-macro.rs
index 477039bd7a2..d8bb3571c08 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/export-macro.rs
+++ b/src/test/compile-fail/proc-macro/export-macro.rs
@@ -10,6 +10,9 @@
 
 // error-pattern: cannot export macro_rules! macros from a `proc-macro` crate
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 
 #[macro_export]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/exports.rs b/src/test/compile-fail/proc-macro/exports.rs
index 41b94d04e8c..07e5723c1c1 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/exports.rs
+++ b/src/test/compile-fail/proc-macro/exports.rs
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 #![allow(warnings)]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs
index f37980c5e0f..f37980c5e0f 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs
+++ b/src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/import.rs b/src/test/compile-fail/proc-macro/import.rs
index fae2439344f..fae2439344f 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/import.rs
+++ b/src/test/compile-fail/proc-macro/import.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-37788.rs b/src/test/compile-fail/proc-macro/issue-37788.rs
index 691c2805801..691c2805801 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/issue-37788.rs
+++ b/src/test/compile-fail/proc-macro/issue-37788.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs b/src/test/compile-fail/proc-macro/issue-38586.rs
index 2d843d0e466..649220ac401 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs
+++ b/src/test/compile-fail/proc-macro/issue-38586.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:issue_38586.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate issue_38586;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs b/src/test/compile-fail/proc-macro/issue-41211.rs
index e0922c452b5..e0922c452b5 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs
+++ b/src/test/compile-fail/proc-macro/issue-41211.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs b/src/test/compile-fail/proc-macro/issue-50493.rs
index eaa64c6ba36..635da570497 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs
+++ b/src/test/compile-fail/proc-macro/issue-50493.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:issue_50493.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate issue_50493;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/item-error.rs b/src/test/compile-fail/proc-macro/item-error.rs
index c0d4d71a6ec..4133e75e3a6 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/item-error.rs
+++ b/src/test/compile-fail/proc-macro/item-error.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-b.rs
-// ignore-stage1
 
 #![allow(warnings)]
 
diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail/proc-macro/lints_in_proc_macros.rs
index 60e533d3ea8..d49c6120271 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs
+++ b/src/test/compile-fail/proc-macro/lints_in_proc_macros.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:bang_proc_macro2.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 #![allow(unused_macros)]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs b/src/test/compile-fail/proc-macro/macros-in-extern.rs
index f280e74fc90..43d7077d022 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs
+++ b/src/test/compile-fail/proc-macro/macros-in-extern.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:test-macros.rs
-// ignore-stage1
 // ignore-wasm32
 
 extern crate test_macros;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs b/src/test/compile-fail/proc-macro/more-gates.rs
index 4c038179544..4c038179544 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs
+++ b/src/test/compile-fail/proc-macro/more-gates.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs b/src/test/compile-fail/proc-macro/no-macro-use-attr.rs
index ab05ca28386..ab05ca28386 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs
+++ b/src/test/compile-fail/proc-macro/no-macro-use-attr.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs b/src/test/compile-fail/proc-macro/proc-macro-attributes.rs
index d0aed8b1624..6e52411500e 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs
+++ b/src/test/compile-fail/proc-macro/proc-macro-attributes.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-b.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_b;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs b/src/test/compile-fail/proc-macro/proc-macro-gates.rs
index 5049a474dd2..5049a474dd2 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs
+++ b/src/test/compile-fail/proc-macro/proc-macro-gates.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs b/src/test/compile-fail/proc-macro/proc-macro-gates2.rs
index dc182414a1d..dc182414a1d 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs
+++ b/src/test/compile-fail/proc-macro/proc-macro-gates2.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/pub-at-crate-root.rs b/src/test/compile-fail/proc-macro/pub-at-crate-root.rs
index 238dde5160c..e995eb549fa 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/pub-at-crate-root.rs
+++ b/src/test/compile-fail/proc-macro/pub-at-crate-root.rs
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 
 extern crate proc_macro;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs b/src/test/compile-fail/proc-macro/shadow-builtin.rs
index 8c5affb7b5a..a5fcfde1dda 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs
+++ b/src/test/compile-fail/proc-macro/shadow-builtin.rs
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 
 extern crate proc_macro;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/shadow.rs b/src/test/compile-fail/proc-macro/shadow.rs
index 9bff1c57ae4..9bff1c57ae4 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/shadow.rs
+++ b/src/test/compile-fail/proc-macro/shadow.rs
diff --git a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-1.rs b/src/test/compile-fail/proc-macro/two-crate-types-1.rs
index db646fb7815..06bd3f9dd6a 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-1.rs
+++ b/src/test/compile-fail/proc-macro/two-crate-types-1.rs
@@ -10,5 +10,8 @@
 
 // error-pattern: cannot mix `proc-macro` crate type with others
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 #![crate_type = "rlib"]
diff --git a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-2.rs b/src/test/compile-fail/proc-macro/two-crate-types-2.rs
index 97b0f844604..dd5e5acbec8 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-2.rs
+++ b/src/test/compile-fail/proc-macro/two-crate-types-2.rs
@@ -10,3 +10,4 @@
 
 // error-pattern: cannot mix `proc-macro` crate type with others
 // compile-flags: --crate-type rlib --crate-type proc-macro
+// force-host
diff --git a/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs b/src/test/incremental/auxiliary/incremental_proc_macro_aux.rs
index e9f9ba86f23..34d20098205 100644
--- a/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs
+++ b/src/test/incremental/auxiliary/incremental_proc_macro_aux.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs b/src/test/incremental/auxiliary/issue_49482_macro_def.rs
index 763c9eb138e..fa6bff4660a 100644
--- a/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs
+++ b/src/test/incremental/auxiliary/issue_49482_macro_def.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type="proc-macro"]
diff --git a/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs b/src/test/incremental/auxiliary/issue_49482_reexport.rs
index aa9aa3b58b9..aa9aa3b58b9 100644
--- a/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs
+++ b/src/test/incremental/auxiliary/issue_49482_reexport.rs
diff --git a/src/test/incremental-fulldeps/auxiliary/issue_54059.rs b/src/test/incremental/auxiliary/issue_54059.rs
index ec0d044d4bf..635501fd60c 100644
--- a/src/test/incremental-fulldeps/auxiliary/issue_54059.rs
+++ b/src/test/incremental/auxiliary/issue_54059.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 // check that having extern "C" functions in a proc macro doesn't crash.
diff --git a/src/test/incremental-fulldeps/incremental_proc_macro.rs b/src/test/incremental/incremental_proc_macro.rs
index 103ee30baba..495f4ff0ed0 100644
--- a/src/test/incremental-fulldeps/incremental_proc_macro.rs
+++ b/src/test/incremental/incremental_proc_macro.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:incremental_proc_macro_aux.rs
-// ignore-stage1
 // revisions: cfail1 cfail2
 // compile-pass
 
diff --git a/src/test/incremental-fulldeps/issue-49482.rs b/src/test/incremental/issue-49482.rs
index 3261b5ae092..65e86e868bb 100644
--- a/src/test/incremental-fulldeps/issue-49482.rs
+++ b/src/test/incremental/issue-49482.rs
@@ -10,7 +10,6 @@
 
 // aux-build:issue_49482_macro_def.rs
 // aux-build:issue_49482_reexport.rs
-// ignore-stage1
 // revisions: rpass1
 
 extern crate issue_49482_reexport;
diff --git a/src/test/incremental-fulldeps/issue-54059.rs b/src/test/incremental/issue-54059.rs
index dee1e0abf61..2f4ea72b066 100644
--- a/src/test/incremental-fulldeps/issue-54059.rs
+++ b/src/test/incremental/issue-54059.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:issue_54059.rs
-// ignore-stage1
 // ignore-wasm32-bare no libc for ffi testing
 // ignore-windows - dealing with weird symbols issues on dylibs isn't worth it
 // revisions: rpass1
diff --git a/src/test/pretty/attr-derive.rs b/src/test/pretty/attr-derive.rs
index a1c581a1868..f38bf6e92eb 100644
--- a/src/test/pretty/attr-derive.rs
+++ b/src/test/pretty/attr-derive.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-foo.rs
-// ignore-stage1
 // pp-exact
 // Testing that both the inner item and next outer item are
 // preserved, and that the first outer item parsed in main is not
diff --git a/src/test/pretty/auxiliary/derive-foo.rs b/src/test/pretty/auxiliary/derive-foo.rs
index bd81d3e5a3b..3552b20fd41 100644
--- a/src/test/pretty/auxiliary/derive-foo.rs
+++ b/src/test/pretty/auxiliary/derive-foo.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-make-fulldeps/issue-38237/Makefile b/src/test/run-make-fulldeps/issue-38237/Makefile
index 855d958b344..0a681401b1a 100644
--- a/src/test/run-make-fulldeps/issue-38237/Makefile
+++ b/src/test/run-make-fulldeps/issue-38237/Makefile
@@ -1,11 +1,5 @@
 -include ../tools.mk
 
-ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
-# ignore stage1
-all:
-
-else
 all:
 	$(RUSTC) foo.rs; $(RUSTC) bar.rs
 	$(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR)
-endif
diff --git a/src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile b/src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile
deleted file mode 100644
index d2c8e7fd043..00000000000
--- a/src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
--include ../tools.mk
-
-ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
-# ignore stage1
-all:
-
-else
-all:
-	$(RUSTC) foo.rs
-	$(RUSTC) bar.rs --emit dep-info
-	$(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d
-endif
diff --git a/src/test/run-make/rustc-macro-dep-files/Makefile b/src/test/run-make/rustc-macro-dep-files/Makefile
new file mode 100644
index 00000000000..0420a389168
--- /dev/null
+++ b/src/test/run-make/rustc-macro-dep-files/Makefile
@@ -0,0 +1,8 @@
+-include ../../run-make-fulldeps/tools.mk
+
+# FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC`
+# instead of hardcoding them everywhere they're needed.
+all:
+	$(BARE_RUSTC) foo.rs --out-dir $(TMPDIR)
+	$(RUSTC) bar.rs --target $(TARGET) --emit dep-info
+	$(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d
diff --git a/src/test/run-make-fulldeps/rustc-macro-dep-files/bar.rs b/src/test/run-make/rustc-macro-dep-files/bar.rs
index 03330c3d170..b2d7f3f348c 100644
--- a/src/test/run-make-fulldeps/rustc-macro-dep-files/bar.rs
+++ b/src/test/run-make/rustc-macro-dep-files/bar.rs
@@ -8,12 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![no_std]
+#![crate_type = "lib"]
+
 #[macro_use]
 extern crate foo;
 
 #[derive(A)]
 struct A;
-
-fn main() {
-    let _b = B;
-}
diff --git a/src/test/run-make-fulldeps/rustc-macro-dep-files/foo.rs b/src/test/run-make/rustc-macro-dep-files/foo.rs
index 2f2524f6ef1..2f2524f6ef1 100644
--- a/src/test/run-make-fulldeps/rustc-macro-dep-files/foo.rs
+++ b/src/test/run-make/rustc-macro-dep-files/foo.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs
index f4d3f2c94ca..f4d3f2c94ca 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs
diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs
index 6283d054373..e8cbf5a270e 100644
--- a/src/test/run-pass-fulldeps/compiler-calls.rs
+++ b/src/test/run-pass-fulldeps/compiler-calls.rs
@@ -11,6 +11,7 @@
 // Test that the CompilerCalls interface to the compiler works.
 
 // ignore-cross-compile
+// ignore-stage1
 
 #![feature(rustc_private)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs b/src/test/run-pass-fulldeps/issue-40001.rs
index b828199883f..b828199883f 100644
--- a/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs
+++ b/src/test/run-pass-fulldeps/issue-40001.rs
diff --git a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs b/src/test/run-pass/auxiliary/cond_plugin.rs
index e7545f954da..940b1ea5df4 100644
--- a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs
+++ b/src/test/run-pass/auxiliary/cond_plugin.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs b/src/test/run-pass/auxiliary/hello_macro.rs
index caf56dabf79..f3a0f2cc625 100644
--- a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs
+++ b/src/test/run-pass/auxiliary/hello_macro.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs b/src/test/run-pass/auxiliary/proc_macro_def.rs
index 847db0098ff..d111db841a5 100644
--- a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs
+++ b/src/test/run-pass/auxiliary/proc_macro_def.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/macro-quote-cond.rs b/src/test/run-pass/macro-quote-cond.rs
index d438adda151..d8e36336028 100644
--- a/src/test/run-pass-fulldeps/macro-quote-cond.rs
+++ b/src/test/run-pass/macro-quote-cond.rs
@@ -10,7 +10,6 @@
 
 #![allow(unused_parens)]
 // aux-build:cond_plugin.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/macro-quote-test.rs b/src/test/run-pass/macro-quote-test.rs
index f967ef56bb8..473f92f7b74 100644
--- a/src/test/run-pass-fulldeps/macro-quote-test.rs
+++ b/src/test/run-pass/macro-quote-test.rs
@@ -11,7 +11,6 @@
 // Test that a macro can emit delimiters with nothing inside - `()`, `{}`
 
 // aux-build:hello_macro.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/add-impl.rs b/src/test/run-pass/proc-macro/add-impl.rs
index 5175fe174a9..7ea7ceafc28 100644
--- a/src/test/run-pass-fulldeps/proc-macro/add-impl.rs
+++ b/src/test/run-pass/proc-macro/add-impl.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:add-impl.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate add_impl;
diff --git a/src/test/run-pass-fulldeps/proc-macro/append-impl.rs b/src/test/run-pass/proc-macro/append-impl.rs
index 37aef7ef131..591f3331d28 100644
--- a/src/test/run-pass-fulldeps/proc-macro/append-impl.rs
+++ b/src/test/run-pass/proc-macro/append-impl.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:append-impl.rs
-// ignore-stage1
 
 #![allow(warnings)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs b/src/test/run-pass/proc-macro/attr-args.rs
index effb3ad5189..b2ee5c2a20a 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs
+++ b/src/test/run-pass/proc-macro/attr-args.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr-args.rs
-// ignore-stage1
 
 #![allow(warnings)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs b/src/test/run-pass/proc-macro/attr-cfg.rs
index 1a9d9b9ee62..58ffd0ce8b0 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs
+++ b/src/test/run-pass/proc-macro/attr-cfg.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr-cfg.rs
-// ignore-stage1
 // revisions: foo bar
 
 extern crate attr_cfg;
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs b/src/test/run-pass/proc-macro/attr-on-trait.rs
index 698a0eca173..383c193ddb4 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs
+++ b/src/test/run-pass/proc-macro/attr-on-trait.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr-on-trait.rs
-// ignore-stage1
 
 extern crate attr_on_trait;
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/run-pass/proc-macro/attr-stmt-expr.rs
index 8a3452f24d2..43a5695f1b7 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs
+++ b/src/test/run-pass/proc-macro/attr-stmt-expr.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr-stmt-expr.rs
-// ignore-stage1
 
 #![feature(stmt_expr_attributes, proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/add-impl.rs b/src/test/run-pass/proc-macro/auxiliary/add-impl.rs
index 3959eccd81e..806d70eebde 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/add-impl.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/add-impl.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/append-impl.rs b/src/test/run-pass/proc-macro/auxiliary/append-impl.rs
index fdce709e5ba..fdce709e5ba 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/append-impl.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/append-impl.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs b/src/test/run-pass/proc-macro/auxiliary/attr-args.rs
index 655bfa3ff63..1f45a799a17 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/attr-args.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-cfg.rs b/src/test/run-pass/proc-macro/auxiliary/attr-cfg.rs
index f9037aa8bf9..553d2ca42f8 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-cfg.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/attr-cfg.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-on-trait.rs b/src/test/run-pass/proc-macro/auxiliary/attr-on-trait.rs
index 5e5c775b1ff..f5431ddb2a3 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-on-trait.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/attr-on-trait.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/run-pass/proc-macro/auxiliary/attr-stmt-expr.rs
index 4d5e22b4eb6..4704bd16cbc 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/attr-stmt-expr.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/bang-macro.rs b/src/test/run-pass/proc-macro/auxiliary/bang-macro.rs
index 8b7c6cd10b8..45301879e99 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/bang-macro.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/bang-macro.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/call-site.rs b/src/test/run-pass/proc-macro/auxiliary/call-site.rs
index 65eb8f4bec2..ed878a25e99 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/call-site.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/call-site.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs b/src/test/run-pass/proc-macro/auxiliary/count_compound_ops.rs
index 77d0d9339fe..b0d71f248d7 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/count_compound_ops.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![feature(proc_macro_hygiene, proc_macro_quote)]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/custom-attr-only-one-derive.rs b/src/test/run-pass/proc-macro/auxiliary/custom-attr-only-one-derive.rs
index 4609f57bddf..250d9508c23 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/custom-attr-only-one-derive.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/custom-attr-only-one-derive.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-a.rs b/src/test/run-pass/proc-macro/auxiliary/derive-a.rs
index b7374a07e42..55c2b3c575e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-a.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-a.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-atob.rs b/src/test/run-pass/proc-macro/auxiliary/derive-atob.rs
index 67d828d92a7..406f169c24d 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-atob.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-atob.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-attr-cfg.rs b/src/test/run-pass/proc-macro/auxiliary/derive-attr-cfg.rs
index 2b413579a9a..20ba0de5e38 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-attr-cfg.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-attr-cfg.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs b/src/test/run-pass/proc-macro/auxiliary/derive-b.rs
index e1aabad4142..d69e69de1c2 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-b.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-ctod.rs b/src/test/run-pass/proc-macro/auxiliary/derive-ctod.rs
index 550ffe9400d..91a82ba52c8 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-ctod.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-ctod.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-nothing.rs b/src/test/run-pass/proc-macro/auxiliary/derive-nothing.rs
index cfe428bf5f3..635d3364f0d 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-nothing.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-nothing.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-same-struct.rs b/src/test/run-pass/proc-macro/auxiliary/derive-same-struct.rs
index cf96f52823f..f62e0cd12a1 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-same-struct.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-same-struct.rs
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
-// compile-flags:--crate-type proc-macro
+
+#![crate_type = "proc-macro"]
 
 extern crate proc_macro;
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-two-attrs.rs b/src/test/run-pass/proc-macro/auxiliary/derive-two-attrs.rs
index d02edb50fb2..eafd457675f 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-two-attrs.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-two-attrs.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-union.rs b/src/test/run-pass/proc-macro/auxiliary/derive-union.rs
index 41bb88a0a92..e6d3d918503 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-union.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/derive-union.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs b/src/test/run-pass/proc-macro/auxiliary/double.rs
index a6c9817f247..f37679552ec 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/double.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/empty-crate.rs b/src/test/run-pass/proc-macro/auxiliary/empty-crate.rs
index b45d4bf41d6..943acd9cecf 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/empty-crate.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/empty-crate.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/expand-with-a-macro.rs b/src/test/run-pass/proc-macro/auxiliary/expand-with-a-macro.rs
index e6831b6bfdf..d7f8ec43e52 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/expand-with-a-macro.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/expand-with-a-macro.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/external-crate-var.rs b/src/test/run-pass/proc-macro/auxiliary/external-crate-var.rs
index 030c53b3e6f..030c53b3e6f 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/external-crate-var.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/external-crate-var.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs b/src/test/run-pass/proc-macro/auxiliary/gen-lifetime-token.rs
index 978de27b70a..9f300837315 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/gen-lifetime-token.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs b/src/test/run-pass/proc-macro/auxiliary/hygiene_example.rs
index ca88482064b..ca88482064b 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/hygiene_example.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs b/src/test/run-pass/proc-macro/auxiliary/hygiene_example_codegen.rs
index 551ac3863e1..af3b60173ac 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/hygiene_example_codegen.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![feature(proc_macro_quote, proc_macro_hygiene)]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-39889.rs b/src/test/run-pass/proc-macro/auxiliary/issue-39889.rs
index 9094310fb3e..9094310fb3e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-39889.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/issue-39889.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs b/src/test/run-pass/proc-macro/auxiliary/issue-42708.rs
index 906caceb869..e74b9dc7454 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/issue-42708.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-50061.rs b/src/test/run-pass/proc-macro/auxiliary/issue-50061.rs
index 6de17522fc9..a8a03ca540c 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-50061.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/issue-50061.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/lifetimes.rs b/src/test/run-pass/proc-macro/auxiliary/lifetimes.rs
index 0ee26b6a1b9..c52496d0b30 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/lifetimes.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/lifetimes.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/modify-ast.rs b/src/test/run-pass/proc-macro/auxiliary/modify-ast.rs
index 498c6811d9c..ff28c1db4f0 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/modify-ast.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/modify-ast.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/negative-token.rs b/src/test/run-pass/proc-macro/auxiliary/negative-token.rs
index fd639696991..ef4fd8d84a2 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/negative-token.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/negative-token.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/not-joint.rs b/src/test/run-pass/proc-macro/auxiliary/not-joint.rs
index e00a4d89e8d..90209e042b2 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/not-joint.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/not-joint.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs b/src/test/run-pass/proc-macro/auxiliary/span-api-tests.rs
index 8e2c5c0a088..8e2c5c0a088 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/span-api-tests.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-test-macros.rs b/src/test/run-pass/proc-macro/auxiliary/span-test-macros.rs
index b4666e2cb61..b4666e2cb61 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-test-macros.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/span-test-macros.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/test-macros.rs b/src/test/run-pass/proc-macro/auxiliary/test-macros.rs
index 581c7cb15a5..0e4343a90d6 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/test-macros.rs
+++ b/src/test/run-pass/proc-macro/auxiliary/test-macros.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs b/src/test/run-pass/proc-macro/bang-macro.rs
index 10fe0155555..f433bc64c6e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs
+++ b/src/test/run-pass/proc-macro/bang-macro.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:bang-macro.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/call-site.rs b/src/test/run-pass/proc-macro/call-site.rs
index b27c806f047..ccbf33cc73b 100644
--- a/src/test/run-pass-fulldeps/proc-macro/call-site.rs
+++ b/src/test/run-pass/proc-macro/call-site.rs
@@ -11,7 +11,6 @@
 #![allow(unused_variables)]
 #![allow(unused_imports)]
 // aux-build:call-site.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs b/src/test/run-pass/proc-macro/count_compound_ops.rs
index 07ad4f288d8..46a5906e46a 100644
--- a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs
+++ b/src/test/run-pass/proc-macro/count_compound_ops.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:count_compound_ops.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/crate-var.rs b/src/test/run-pass/proc-macro/crate-var.rs
index 41c15195bc8..00b467ad1c9 100644
--- a/src/test/run-pass-fulldeps/proc-macro/crate-var.rs
+++ b/src/test/run-pass/proc-macro/crate-var.rs
@@ -10,7 +10,6 @@
 
 // aux-build:double.rs
 // aux-build:external-crate-var.rs
-// ignore-stage1
 
 #![allow(unused)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/custom-attr-only-one-derive.rs b/src/test/run-pass/proc-macro/custom-attr-only-one-derive.rs
index 3b2833a4bcf..3b2833a4bcf 100644
--- a/src/test/run-pass-fulldeps/proc-macro/custom-attr-only-one-derive.rs
+++ b/src/test/run-pass/proc-macro/custom-attr-only-one-derive.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs b/src/test/run-pass/proc-macro/derive-attr-cfg.rs
index e7e8b3d665e..f804042374d 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs
+++ b/src/test/run-pass/proc-macro/derive-attr-cfg.rs
@@ -10,7 +10,6 @@
 
 #![allow(dead_code)]
 // aux-build:derive-attr-cfg.rs
-// ignore-stage1
 
 extern crate derive_attr_cfg;
 use derive_attr_cfg::Foo;
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs b/src/test/run-pass/proc-macro/derive-b.rs
index ac9eca38226..60a6cf7662d 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs
+++ b/src/test/run-pass/proc-macro/derive-b.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:derive-b.rs
-// ignore-stage1
 
 #![feature(unrestricted_attribute_tokens)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs b/src/test/run-pass/proc-macro/derive-same-struct.rs
index 64ad57107c7..7aff32e16ce 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs
+++ b/src/test/run-pass/proc-macro/derive-same-struct.rs
@@ -11,7 +11,6 @@
 #![allow(path_statements)]
 #![allow(dead_code)]
 // aux-build:derive-same-struct.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_same_struct;
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.stdout b/src/test/run-pass/proc-macro/derive-same-struct.stdout
index 77605de5e33..77605de5e33 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.stdout
+++ b/src/test/run-pass/proc-macro/derive-same-struct.stdout
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-test.rs b/src/test/run-pass/proc-macro/derive-test.rs
index 5a53a4e8db3..5a53a4e8db3 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-test.rs
+++ b/src/test/run-pass/proc-macro/derive-test.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs b/src/test/run-pass/proc-macro/derive-two-attrs.rs
index 9c2ba481f5e..9c2ba481f5e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs
+++ b/src/test/run-pass/proc-macro/derive-two-attrs.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-union.rs b/src/test/run-pass/proc-macro/derive-union.rs
index 298a652aacc..2aae1d8635f 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-union.rs
+++ b/src/test/run-pass/proc-macro/derive-union.rs
@@ -10,7 +10,6 @@
 
 #![allow(unused_variables)]
 // aux-build:derive-union.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_union;
diff --git a/src/test/run-pass-fulldeps/proc-macro/empty-crate.rs b/src/test/run-pass/proc-macro/empty-crate.rs
index 2b0a57dafef..1a0c0506112 100644
--- a/src/test/run-pass-fulldeps/proc-macro/empty-crate.rs
+++ b/src/test/run-pass/proc-macro/empty-crate.rs
@@ -10,7 +10,6 @@
 
 #![allow(unused_imports)]
 // aux-build:empty-crate.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate empty_crate;
diff --git a/src/test/run-pass-fulldeps/proc-macro/expand-with-a-macro.rs b/src/test/run-pass/proc-macro/expand-with-a-macro.rs
index 4ccd4615fb6..944973ee706 100644
--- a/src/test/run-pass-fulldeps/proc-macro/expand-with-a-macro.rs
+++ b/src/test/run-pass/proc-macro/expand-with-a-macro.rs
@@ -9,7 +9,8 @@
 // except according to those terms.
 
 // aux-build:expand-with-a-macro.rs
-// ignore-stage1
+
+// ignore-wasm32-bare compiled with panic=abort by default
 
 #![deny(warnings)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs b/src/test/run-pass/proc-macro/gen-lifetime-token.rs
index ce2fed86e46..ce2fed86e46 100644
--- a/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs
+++ b/src/test/run-pass/proc-macro/gen-lifetime-token.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs b/src/test/run-pass/proc-macro/hygiene_example.rs
index cf18bb247c7..41857fde269 100644
--- a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs
+++ b/src/test/run-pass/proc-macro/hygiene_example.rs
@@ -11,7 +11,6 @@
 #![allow(unused_macros)]
 // aux-build:hygiene_example_codegen.rs
 // aux-build:hygiene_example.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs b/src/test/run-pass/proc-macro/issue-39889.rs
index f7221092601..99500a77f09 100644
--- a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs
+++ b/src/test/run-pass/proc-macro/issue-39889.rs
@@ -10,7 +10,6 @@
 
 #![allow(dead_code)]
 // aux-build:issue-39889.rs
-// ignore-stage1
 
 extern crate issue_39889;
 use issue_39889::Issue39889;
diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs b/src/test/run-pass/proc-macro/issue-42708.rs
index 7bbdbc6505d..8f9c8723953 100644
--- a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs
+++ b/src/test/run-pass/proc-macro/issue-42708.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:issue-42708.rs
-// ignore-stage1
 
 #![feature(decl_macro)]
 #![allow(unused)]
diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-50061.rs b/src/test/run-pass/proc-macro/issue-50061.rs
index 04659166575..1a751161a44 100644
--- a/src/test/run-pass-fulldeps/proc-macro/issue-50061.rs
+++ b/src/test/run-pass/proc-macro/issue-50061.rs
@@ -10,7 +10,6 @@
 
 #![allow(path_statements)]
 // aux-build:issue-50061.rs
-// ignore-stage1
 
 #![feature(decl_macro)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs b/src/test/run-pass/proc-macro/lifetimes.rs
index 79d6d27dc59..7cd234df650 100644
--- a/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs
+++ b/src/test/run-pass/proc-macro/lifetimes.rs
@@ -10,7 +10,6 @@
 
 #![allow(unused_variables)]
 // aux-build:lifetimes.rs
-// ignore-stage1
 
 extern crate lifetimes;
 use lifetimes::*;
diff --git a/src/test/run-pass-fulldeps/proc-macro/load-two.rs b/src/test/run-pass/proc-macro/load-two.rs
index cf1e076f270..319e99d4e44 100644
--- a/src/test/run-pass-fulldeps/proc-macro/load-two.rs
+++ b/src/test/run-pass/proc-macro/load-two.rs
@@ -12,7 +12,6 @@
 #![allow(dead_code)]
 // aux-build:derive-atob.rs
 // aux-build:derive-ctod.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_atob;
diff --git a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs b/src/test/run-pass/proc-macro/macros-in-extern.rs
index bd76cc38054..ce62cabf281 100644
--- a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs
+++ b/src/test/run-pass/proc-macro/macros-in-extern.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:test-macros.rs
-// ignore-stage1
 // ignore-wasm32
 
 #![feature(macros_in_extern)]
diff --git a/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs b/src/test/run-pass/proc-macro/modify-ast.rs
index d6f7cc4699a..d6f7cc4699a 100644
--- a/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs
+++ b/src/test/run-pass/proc-macro/modify-ast.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/negative-token.rs b/src/test/run-pass/proc-macro/negative-token.rs
index ccd729badeb..f953ba8df7e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/negative-token.rs
+++ b/src/test/run-pass/proc-macro/negative-token.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:negative-token.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/run-pass-fulldeps/proc-macro/not-joint.rs b/src/test/run-pass/proc-macro/not-joint.rs
index 7a53348f963..7a53348f963 100644
--- a/src/test/run-pass-fulldeps/proc-macro/not-joint.rs
+++ b/src/test/run-pass/proc-macro/not-joint.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/smoke.rs b/src/test/run-pass/proc-macro/smoke.rs
index 49011e19a51..ba0cd3b398d 100644
--- a/src/test/run-pass-fulldeps/proc-macro/smoke.rs
+++ b/src/test/run-pass/proc-macro/smoke.rs
@@ -11,7 +11,6 @@
 #![allow(unused_must_use)]
 #![allow(path_statements)]
 // aux-build:derive-a.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_a;
diff --git a/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs b/src/test/run-pass/proc-macro/span-api-tests.rs
index 415cada265e..415cada265e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs
+++ b/src/test/run-pass/proc-macro/span-api-tests.rs
diff --git a/src/test/run-pass-fulldeps/proc-macro/struct-field-macro.rs b/src/test/run-pass/proc-macro/struct-field-macro.rs
index db52aa5d3a6..b1ac8038fa2 100644
--- a/src/test/run-pass-fulldeps/proc-macro/struct-field-macro.rs
+++ b/src/test/run-pass/proc-macro/struct-field-macro.rs
@@ -10,7 +10,6 @@
 
 #![allow(dead_code)]
 // aux-build:derive-nothing.rs
-// ignore-stage1
 
 #[macro_use]
 extern crate derive_nothing;
diff --git a/src/test/run-pass-fulldeps/proc_macro.rs b/src/test/run-pass/proc_macro.rs
index 27e0c23561f..e14ceca8e42 100644
--- a/src/test/run-pass-fulldeps/proc_macro.rs
+++ b/src/test/run-pass/proc_macro.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:proc_macro_def.rs
-// ignore-stage1
 // ignore-cross-compile
 
 #![feature(proc_macro_hygiene)]
diff --git a/src/test/rustdoc/doc-proc-macro.rs b/src/test/rustdoc/doc-proc-macro.rs
index 01a4a410b03..b3b403a7b86 100644
--- a/src/test/rustdoc/doc-proc-macro.rs
+++ b/src/test/rustdoc/doc-proc-macro.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-stage1
-
 // Issue #52129: ICE when trying to document the `quote` proc-macro from proc_macro
 
 // As of this writing, we don't currently attempt to document proc-macros. However, we shouldn't
diff --git a/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs b/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs
index 6aac070c45b..bde1fd8b1e4 100644
--- a/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs
+++ b/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type="proc-macro"]
diff --git a/src/test/rustdoc/inline_cross/proc_macro.rs b/src/test/rustdoc/inline_cross/proc_macro.rs
index a879258f82a..c259e9cdaac 100644
--- a/src/test/rustdoc/inline_cross/proc_macro.rs
+++ b/src/test/rustdoc/inline_cross/proc_macro.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-stage1
 // aux-build:proc_macro.rs
 // build-aux-docs
 
diff --git a/src/test/rustdoc/proc-macro.rs b/src/test/rustdoc/proc-macro.rs
index bfd194701c8..23d0d005807 100644
--- a/src/test/rustdoc/proc-macro.rs
+++ b/src/test/rustdoc/proc-macro.rs
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-stage1
+// force-host
+// no-prefer-dynamic
 
 #![crate_type="proc-macro"]
 #![crate_name="some_macros"]
diff --git a/src/test/rustdoc/rustc-macro-crate.rs b/src/test/rustdoc/rustc-macro-crate.rs
index d46f9684411..6ad5556b8f5 100644
--- a/src/test/rustdoc/rustc-macro-crate.rs
+++ b/src/test/rustdoc/rustc-macro-crate.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
-// ignore-stage1
 
 #![crate_type = "proc-macro"]
 
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs
deleted file mode 100644
index 679cb772868..00000000000
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs
deleted file mode 100644
index 6484725814a..00000000000
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro]
-pub fn bang_proc_macro(input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/ui-fulldeps/custom-derive/auxiliary/plugin.rs b/src/test/ui/custom-derive/auxiliary/plugin.rs
index 124bc05b7a3..921e2ce2fe0 100644
--- a/src/test/ui-fulldeps/custom-derive/auxiliary/plugin.rs
+++ b/src/test/ui/custom-derive/auxiliary/plugin.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/custom-derive/derive-in-mod.rs b/src/test/ui/custom-derive/derive-in-mod.rs
index 8478ff1a6ae..8478ff1a6ae 100644
--- a/src/test/ui-fulldeps/custom-derive/derive-in-mod.rs
+++ b/src/test/ui/custom-derive/derive-in-mod.rs
diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.rs b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs
index b750a8bb0d9..ba072ba3568 100644
--- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.rs
+++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs
@@ -1,5 +1,4 @@
 // aux-build:plugin.rs
-// ignore-stage1
 
 #[macro_use(WithHelper)]
 extern crate plugin;
diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr
index d288d729512..2c9d226cc9e 100644
--- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr
+++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr
@@ -1,16 +1,16 @@
 error[E0659]: `helper` is ambiguous (derive helper attribute vs any other name)
-  --> $DIR/helper-attr-blocked-by-import-ambig.rs:10:3
+  --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:3
    |
 LL | #[helper] //~ ERROR `helper` is ambiguous
    |   ^^^^^^ ambiguous name
    |
 note: `helper` could refer to the derive helper attribute defined here
-  --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:10
+  --> $DIR/helper-attr-blocked-by-import-ambig.rs:8:10
    |
 LL | #[derive(WithHelper)]
    |          ^^^^^^^^^^
 note: `helper` could also refer to the attribute macro imported here
-  --> $DIR/helper-attr-blocked-by-import-ambig.rs:7:5
+  --> $DIR/helper-attr-blocked-by-import-ambig.rs:6:5
    |
 LL | use plugin::helper;
    |     ^^^^^^^^^^^^^^
diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import.rs b/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs
index 03b774f6c64..abbf014f553 100644
--- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import.rs
+++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs
@@ -1,6 +1,5 @@
 // compile-pass
 // aux-build:plugin.rs
-// ignore-stage1
 
 #[macro_use(WithHelper)]
 extern crate plugin;
diff --git a/src/test/ui-fulldeps/custom-derive/issue-36935.rs b/src/test/ui/custom-derive/issue-36935.rs
index 5ec79a55200..92c47eba9ad 100644
--- a/src/test/ui-fulldeps/custom-derive/issue-36935.rs
+++ b/src/test/ui/custom-derive/issue-36935.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:plugin.rs
-// ignore-stage1
+
 
 #[macro_use] extern crate plugin;
 
diff --git a/src/test/ui-fulldeps/custom-derive/issue-36935.stderr b/src/test/ui/custom-derive/issue-36935.stderr
index ecbe0a9a0c0..ecbe0a9a0c0 100644
--- a/src/test/ui-fulldeps/custom-derive/issue-36935.stderr
+++ b/src/test/ui/custom-derive/issue-36935.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.rs b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.rs
index 6a47e50f62d..6a47e50f62d 100644
--- a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.rs
+++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.rs
diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr
index db07055b6a1..db07055b6a1 100644
--- a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.stderr
+++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.rs b/src/test/ui/proc-macro/ambiguous-builtin-attrs.rs
index 9f4f0abf324..9f4f0abf324 100644
--- a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.rs
+++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs.rs
diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr
index 79dc922b9db..79dc922b9db 100644
--- a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr
+++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr
diff --git a/src/test/ui-fulldeps/attribute-order-restricted.rs b/src/test/ui/proc-macro/attribute-order-restricted.rs
index 7b1eecd1558..7b1eecd1558 100644
--- a/src/test/ui-fulldeps/attribute-order-restricted.rs
+++ b/src/test/ui/proc-macro/attribute-order-restricted.rs
diff --git a/src/test/ui-fulldeps/attribute-order-restricted.stderr b/src/test/ui/proc-macro/attribute-order-restricted.stderr
index a4f165cd1b5..a4f165cd1b5 100644
--- a/src/test/ui-fulldeps/attribute-order-restricted.stderr
+++ b/src/test/ui/proc-macro/attribute-order-restricted.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs b/src/test/ui/proc-macro/attribute-spans-preserved.rs
index af47dad9e0b..af47dad9e0b 100644
--- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs
+++ b/src/test/ui/proc-macro/attribute-spans-preserved.rs
diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr b/src/test/ui/proc-macro/attribute-spans-preserved.stderr
index 329e5bea61c..329e5bea61c 100644
--- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr
+++ b/src/test/ui/proc-macro/attribute-spans-preserved.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout b/src/test/ui/proc-macro/attribute-spans-preserved.stdout
index b1487fcd5ed..b1487fcd5ed 100644
--- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout
+++ b/src/test/ui/proc-macro/attribute-spans-preserved.stdout
diff --git a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs b/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs
index 679cb772868..679cb772868 100644
--- a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs
+++ b/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/attribute-spans-preserved.rs b/src/test/ui/proc-macro/auxiliary/attribute-spans-preserved.rs
index e725cc7afb8..9f7a7e4f222 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/attribute-spans-preserved.rs
+++ b/src/test/ui/proc-macro/auxiliary/attribute-spans-preserved.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs b/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs
index 6484725814a..6484725814a 100644
--- a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs
+++ b/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/builtin-attrs.rs b/src/test/ui/proc-macro/auxiliary/builtin-attrs.rs
index e18ca57aab1..571ea1bc5f3 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/builtin-attrs.rs
+++ b/src/test/ui/proc-macro/auxiliary/builtin-attrs.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/auxiliary/derive-clona.rs b/src/test/ui/proc-macro/auxiliary/derive-clona.rs
index 719fbdb15ef..719fbdb15ef 100644
--- a/src/test/ui-fulldeps/auxiliary/derive-clona.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-clona.rs
diff --git a/src/test/ui-fulldeps/auxiliary/derive-foo.rs b/src/test/ui/proc-macro/auxiliary/derive-foo.rs
index 64dcf72ba20..64dcf72ba20 100644
--- a/src/test/ui-fulldeps/auxiliary/derive-foo.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-foo.rs
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed-2.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs
index 9912a89dafb..9912a89dafb 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed-2.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs
index 4e701710f42..5b5243dd60e 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs
@@ -1,3 +1,4 @@
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowing.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs
index 0fd8aa5638a..6e0bdcba9c5 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowing.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs
@@ -1,3 +1,4 @@
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs b/src/test/ui/proc-macro/auxiliary/derive-panic.rs
index 3274f0324e1..d7fa5b6bed1 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-panic.rs
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// no-prefer-dynamic
 // force-host
+// no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
 
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs b/src/test/ui/proc-macro/auxiliary/generate-mod.rs
index 1ed8ef52027..a1f025de3be 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs
+++ b/src/test/ui/proc-macro/auxiliary/generate-mod.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // run-pass
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/auxiliary/invalid-punct-ident.rs b/src/test/ui/proc-macro/auxiliary/invalid-punct-ident.rs
index cc899fa610d..cc899fa610d 100644
--- a/src/test/ui-fulldeps/auxiliary/invalid-punct-ident.rs
+++ b/src/test/ui/proc-macro/auxiliary/invalid-punct-ident.rs
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/issue-53481.rs b/src/test/ui/proc-macro/auxiliary/issue-53481.rs
index 9554cdde490..d9f290dec7e 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/issue-53481.rs
+++ b/src/test/ui/proc-macro/auxiliary/issue-53481.rs
@@ -1,3 +1,4 @@
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/auxiliary/lifetimes.rs b/src/test/ui/proc-macro/auxiliary/lifetimes.rs
index fc59a622bfa..8348d0888e4 100644
--- a/src/test/ui-fulldeps/auxiliary/lifetimes.rs
+++ b/src/test/ui/proc-macro/auxiliary/lifetimes.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/macro-brackets.rs b/src/test/ui/proc-macro/auxiliary/macro-brackets.rs
index be1777f3ebd..08ff604fead 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/macro-brackets.rs
+++ b/src/test/ui/proc-macro/auxiliary/macro-brackets.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs b/src/test/ui/proc-macro/auxiliary/multispan.rs
index 383016f990e..e122b22e080 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs
+++ b/src/test/ui/proc-macro/auxiliary/multispan.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/nested-item-spans.rs b/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs
index 6b893150b45..e195f425ab3 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/nested-item-spans.rs
+++ b/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/parent-source-spans.rs b/src/test/ui/proc-macro/auxiliary/parent-source-spans.rs
index f5590405e61..a007fad3675 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/parent-source-spans.rs
+++ b/src/test/ui/proc-macro/auxiliary/parent-source-spans.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![feature(proc_macro_diagnostic, proc_macro_span)]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs b/src/test/ui/proc-macro/auxiliary/span-preservation.rs
index 65ed9cf7372..33c7968104b 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs
+++ b/src/test/ui/proc-macro/auxiliary/span-preservation.rs
@@ -1,3 +1,4 @@
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/auxiliary/subspan.rs b/src/test/ui/proc-macro/auxiliary/subspan.rs
index 134b04d7333..dbf355fea50 100644
--- a/src/test/ui-fulldeps/auxiliary/subspan.rs
+++ b/src/test/ui/proc-macro/auxiliary/subspan.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs b/src/test/ui/proc-macro/auxiliary/three-equals.rs
index 569a458f55a..b23841077e3 100644
--- a/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs
+++ b/src/test/ui/proc-macro/auxiliary/three-equals.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowed.rs b/src/test/ui/proc-macro/derive-helper-shadowed.rs
index 792b54b3b94..792b54b3b94 100644
--- a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowed.rs
+++ b/src/test/ui/proc-macro/derive-helper-shadowed.rs
diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.rs b/src/test/ui/proc-macro/derive-helper-shadowing.rs
index aa9eae0ba31..aa9eae0ba31 100644
--- a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.rs
+++ b/src/test/ui/proc-macro/derive-helper-shadowing.rs
diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr
index cc50fefc464..cc50fefc464 100644
--- a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr
+++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs b/src/test/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
index 25a2a376147..25a2a376147 100644
--- a/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs
+++ b/src/test/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
diff --git a/src/test/ui-fulldeps/proc-macro/generate-mod.rs b/src/test/ui/proc-macro/generate-mod.rs
index 977faf7decd..977faf7decd 100644
--- a/src/test/ui-fulldeps/proc-macro/generate-mod.rs
+++ b/src/test/ui/proc-macro/generate-mod.rs
diff --git a/src/test/ui-fulldeps/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr
index a981b1bc8b8..a981b1bc8b8 100644
--- a/src/test/ui-fulldeps/proc-macro/generate-mod.stderr
+++ b/src/test/ui/proc-macro/generate-mod.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs b/src/test/ui/proc-macro/invalid-attributes.rs
index 8b940a0f405..cca954fdc6b 100644
--- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs
+++ b/src/test/ui/proc-macro/invalid-attributes.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr b/src/test/ui/proc-macro/invalid-attributes.stderr
index 5fd87362db2..c480bcb5df9 100644
--- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr
+++ b/src/test/ui/proc-macro/invalid-attributes.stderr
@@ -1,35 +1,35 @@
 error: `#[proc_macro]` attribute does not take any arguments
-  --> $DIR/invalid-attributes.rs:19:1
+  --> $DIR/invalid-attributes.rs:20:1
    |
 LL | #[proc_macro = "test"] //~ ERROR: does not take any arguments
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 error: `#[proc_macro]` attribute does not take any arguments
-  --> $DIR/invalid-attributes.rs:22:1
+  --> $DIR/invalid-attributes.rs:23:1
    |
 LL | #[proc_macro()] //~ ERROR: does not take any arguments
    | ^^^^^^^^^^^^^^^
 
 error: `#[proc_macro]` attribute does not take any arguments
-  --> $DIR/invalid-attributes.rs:25:1
+  --> $DIR/invalid-attributes.rs:26:1
    |
 LL | #[proc_macro(x)] //~ ERROR: does not take any arguments
    | ^^^^^^^^^^^^^^^^
 
 error: `#[proc_macro_attribute]` attribute does not take any arguments
-  --> $DIR/invalid-attributes.rs:28:1
+  --> $DIR/invalid-attributes.rs:29:1
    |
 LL | #[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `#[proc_macro_attribute]` attribute does not take any arguments
-  --> $DIR/invalid-attributes.rs:31:1
+  --> $DIR/invalid-attributes.rs:32:1
    |
 LL | #[proc_macro_attribute()] //~ ERROR: does not take any arguments
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `#[proc_macro_attribute]` attribute does not take any arguments
-  --> $DIR/invalid-attributes.rs:34:1
+  --> $DIR/invalid-attributes.rs:35:1
    |
 LL | #[proc_macro_attribute(x)] //~ ERROR: does not take any arguments
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-1.rs b/src/test/ui/proc-macro/invalid-punct-ident-1.rs
index 576c156c105..576c156c105 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-1.rs
+++ b/src/test/ui/proc-macro/invalid-punct-ident-1.rs
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr
index 3b3619e2637..3b3619e2637 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-1.stderr
+++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-2.rs b/src/test/ui/proc-macro/invalid-punct-ident-2.rs
index 874a7d169d1..874a7d169d1 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-2.rs
+++ b/src/test/ui/proc-macro/invalid-punct-ident-2.rs
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-2.stderr b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr
index 869c0908bb5..869c0908bb5 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-2.stderr
+++ b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-3.rs b/src/test/ui/proc-macro/invalid-punct-ident-3.rs
index f73bf500545..f73bf500545 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-3.rs
+++ b/src/test/ui/proc-macro/invalid-punct-ident-3.rs
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-3.stderr b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr
index 716f6ffa098..716f6ffa098 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-3.stderr
+++ b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-4.rs b/src/test/ui/proc-macro/invalid-punct-ident-4.rs
index 1e93c69c650..1e93c69c650 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-4.rs
+++ b/src/test/ui/proc-macro/invalid-punct-ident-4.rs
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr
index 669a1eb5839..669a1eb5839 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-4.stderr
+++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/issue-53481.rs b/src/test/ui/proc-macro/issue-53481.rs
index 479fd1db630..479fd1db630 100644
--- a/src/test/ui-fulldeps/proc-macro/issue-53481.rs
+++ b/src/test/ui/proc-macro/issue-53481.rs
diff --git a/src/test/ui-fulldeps/lifetimes.rs b/src/test/ui/proc-macro/lifetimes.rs
index ff6464a7a3a..ff6464a7a3a 100644
--- a/src/test/ui-fulldeps/lifetimes.rs
+++ b/src/test/ui/proc-macro/lifetimes.rs
diff --git a/src/test/ui-fulldeps/lifetimes.stderr b/src/test/ui/proc-macro/lifetimes.stderr
index 6baf2b16998..6baf2b16998 100644
--- a/src/test/ui-fulldeps/lifetimes.stderr
+++ b/src/test/ui/proc-macro/lifetimes.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/load-panic.rs b/src/test/ui/proc-macro/load-panic.rs
index 462eaf03417..462eaf03417 100644
--- a/src/test/ui-fulldeps/proc-macro/load-panic.rs
+++ b/src/test/ui/proc-macro/load-panic.rs
diff --git a/src/test/ui-fulldeps/proc-macro/load-panic.stderr b/src/test/ui/proc-macro/load-panic.stderr
index 30ad53f9041..30ad53f9041 100644
--- a/src/test/ui-fulldeps/proc-macro/load-panic.stderr
+++ b/src/test/ui/proc-macro/load-panic.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/macro-brackets.rs b/src/test/ui/proc-macro/macro-brackets.rs
index b29f2775201..b29f2775201 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-brackets.rs
+++ b/src/test/ui/proc-macro/macro-brackets.rs
diff --git a/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr b/src/test/ui/proc-macro/macro-brackets.stderr
index 7c263d38df9..7c263d38df9 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr
+++ b/src/test/ui/proc-macro/macro-brackets.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs b/src/test/ui/proc-macro/macro-namespace-reserved-2.rs
index fa05ad2fc60..02526b60db0 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs
+++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr
index 9def03e9450..9e989ebdd31 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr
+++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr
@@ -1,53 +1,53 @@
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:34:5
+  --> $DIR/macro-namespace-reserved-2.rs:35:5
    |
 LL |     my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it
    |     ^^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:37:5
+  --> $DIR/macro-namespace-reserved-2.rs:38:5
    |
 LL |     my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it
    |     ^^^^^^^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:40:5
+  --> $DIR/macro-namespace-reserved-2.rs:41:5
    |
 LL |     MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it
    |     ^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:43:3
+  --> $DIR/macro-namespace-reserved-2.rs:44:3
    |
 LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it
    |   ^^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:45:3
+  --> $DIR/macro-namespace-reserved-2.rs:46:3
    |
 LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it
    |   ^^^^^^^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:47:3
+  --> $DIR/macro-namespace-reserved-2.rs:48:3
    |
 LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it
    |   ^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:50:10
+  --> $DIR/macro-namespace-reserved-2.rs:51:10
    |
 LL | #[derive(my_macro)] //~ ERROR can't use a procedural macro from the same crate that defines it
    |          ^^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:52:10
+  --> $DIR/macro-namespace-reserved-2.rs:53:10
    |
 LL | #[derive(my_macro_attr)] //~ ERROR can't use a procedural macro from the same crate that defines it
    |          ^^^^^^^^^^^^^
 
 error: can't use a procedural macro from the same crate that defines it
-  --> $DIR/macro-namespace-reserved-2.rs:54:10
+  --> $DIR/macro-namespace-reserved-2.rs:55:10
    |
 LL | #[derive(MyTrait)] //~ ERROR can't use a procedural macro from the same crate that defines it
    |          ^^^^^^^
diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs b/src/test/ui/proc-macro/macro-namespace-reserved.rs
index e7bb05de88c..b0a3dbf0c1f 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs
+++ b/src/test/ui/proc-macro/macro-namespace-reserved.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![feature(decl_macro)]
diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.stderr b/src/test/ui/proc-macro/macro-namespace-reserved.stderr
index 44b51edcc0b..c453bde6c17 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.stderr
+++ b/src/test/ui/proc-macro/macro-namespace-reserved.stderr
@@ -1,5 +1,5 @@
 error[E0428]: the name `my_macro` is defined multiple times
-  --> $DIR/macro-namespace-reserved.rs:34:1
+  --> $DIR/macro-namespace-reserved.rs:35:1
    |
 LL | pub fn my_macro(input: TokenStream) -> TokenStream {
    | -------------------------------------------------- previous definition of the macro `my_macro` here
@@ -10,7 +10,7 @@ LL | macro my_macro() {} //~ ERROR the name `my_macro` is defined multiple times
    = note: `my_macro` must be defined only once in the macro namespace of this module
 
 error[E0428]: the name `my_macro_attr` is defined multiple times
-  --> $DIR/macro-namespace-reserved.rs:35:1
+  --> $DIR/macro-namespace-reserved.rs:36:1
    |
 LL | pub fn my_macro_attr(input: TokenStream, _: TokenStream) -> TokenStream {
    | ----------------------------------------------------------------------- previous definition of the macro `my_macro_attr` here
@@ -21,7 +21,7 @@ LL | macro my_macro_attr() {} //~ ERROR the name `my_macro_attr` is defined mult
    = note: `my_macro_attr` must be defined only once in the macro namespace of this module
 
 error[E0428]: the name `MyTrait` is defined multiple times
-  --> $DIR/macro-namespace-reserved.rs:36:1
+  --> $DIR/macro-namespace-reserved.rs:37:1
    |
 LL | #[proc_macro_derive(MyTrait)]
    |                     ------- previous definition of the macro `MyTrait` here
@@ -32,7 +32,7 @@ LL | macro MyTrait() {} //~ ERROR the name `MyTrait` is defined multiple times
    = note: `MyTrait` must be defined only once in the macro namespace of this module
 
 error[E0428]: the name `SameName` is defined multiple times
-  --> $DIR/macro-namespace-reserved.rs:44:1
+  --> $DIR/macro-namespace-reserved.rs:45:1
    |
 LL | #[proc_macro_derive(SameName)]
    |                     -------- previous definition of the macro `SameName` here
diff --git a/src/test/ui-fulldeps/proc-macro/macro-use-attr.rs b/src/test/ui/proc-macro/macro-use-attr.rs
index 904562e903d..904562e903d 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-use-attr.rs
+++ b/src/test/ui/proc-macro/macro-use-attr.rs
diff --git a/src/test/ui-fulldeps/proc-macro/macro-use-bang.rs b/src/test/ui/proc-macro/macro-use-bang.rs
index d7713f48e70..d7713f48e70 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-use-bang.rs
+++ b/src/test/ui/proc-macro/macro-use-bang.rs
diff --git a/src/test/ui-fulldeps/proc-macro/multispan.rs b/src/test/ui/proc-macro/multispan.rs
index 63a95ce211d..03067868a81 100644
--- a/src/test/ui-fulldeps/proc-macro/multispan.rs
+++ b/src/test/ui/proc-macro/multispan.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:multispan.rs
-// ignore-stage1
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/ui-fulldeps/proc-macro/multispan.stderr b/src/test/ui/proc-macro/multispan.stderr
index 267313ef5ae..39bdbb5e450 100644
--- a/src/test/ui-fulldeps/proc-macro/multispan.stderr
+++ b/src/test/ui/proc-macro/multispan.stderr
@@ -1,83 +1,83 @@
 error: hello to you, too!
-  --> $DIR/multispan.rs:25:5
+  --> $DIR/multispan.rs:24:5
    |
 LL |     hello!(hi); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:25:12
+  --> $DIR/multispan.rs:24:12
    |
 LL |     hello!(hi); //~ ERROR hello to you, too!
    |            ^^
 
 error: hello to you, too!
-  --> $DIR/multispan.rs:28:5
+  --> $DIR/multispan.rs:27:5
    |
 LL |     hello!(hi hi); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:28:12
+  --> $DIR/multispan.rs:27:12
    |
 LL |     hello!(hi hi); //~ ERROR hello to you, too!
    |            ^^ ^^
 
 error: hello to you, too!
-  --> $DIR/multispan.rs:31:5
+  --> $DIR/multispan.rs:30:5
    |
 LL |     hello!(hi hi hi); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:31:12
+  --> $DIR/multispan.rs:30:12
    |
 LL |     hello!(hi hi hi); //~ ERROR hello to you, too!
    |            ^^ ^^ ^^
 
 error: hello to you, too!
-  --> $DIR/multispan.rs:34:5
+  --> $DIR/multispan.rs:33:5
    |
 LL |     hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:34:12
+  --> $DIR/multispan.rs:33:12
    |
 LL |     hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too!
    |            ^^     ^^    ^^           ^^ ^^
 
 error: hello to you, too!
-  --> $DIR/multispan.rs:35:5
+  --> $DIR/multispan.rs:34:5
    |
 LL |     hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:35:12
+  --> $DIR/multispan.rs:34:12
    |
 LL |     hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too!
    |            ^^        ^^              ^^    ^^
 
 error: hello to you, too!
-  --> $DIR/multispan.rs:36:5
+  --> $DIR/multispan.rs:35:5
    |
 LL |     hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:36:19
+  --> $DIR/multispan.rs:35:19
    |
 LL |     hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too!
    |                   ^^    ^^
 
 error: hello to you, too!
-  --> $DIR/multispan.rs:37:5
+  --> $DIR/multispan.rs:36:5
    |
 LL |     hello!(hi good hi and good bye); //~ ERROR hello to you, too!
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: found these 'hi's
-  --> $DIR/multispan.rs:37:12
+  --> $DIR/multispan.rs:36:12
    |
 LL |     hello!(hi good hi and good bye); //~ ERROR hello to you, too!
    |            ^^      ^^
diff --git a/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs b/src/test/ui/proc-macro/nested-item-spans.rs
index 8f059d6344d..8f059d6344d 100644
--- a/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs
+++ b/src/test/ui/proc-macro/nested-item-spans.rs
diff --git a/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr
index 75140747e8c..75140747e8c 100644
--- a/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr
+++ b/src/test/ui/proc-macro/nested-item-spans.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/non-root.rs b/src/test/ui/proc-macro/non-root.rs
index 24404885788..437973a426e 100644
--- a/src/test/ui-fulldeps/proc-macro/non-root.rs
+++ b/src/test/ui/proc-macro/non-root.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/proc-macro/non-root.stderr b/src/test/ui/proc-macro/non-root.stderr
index 23222a2b851..8c14f644d7a 100644
--- a/src/test/ui-fulldeps/proc-macro/non-root.stderr
+++ b/src/test/ui/proc-macro/non-root.stderr
@@ -1,5 +1,5 @@
 error: functions tagged with `#[proc_macro]` must currently reside in the root of the crate
-  --> $DIR/non-root.rs:20:5
+  --> $DIR/non-root.rs:21:5
    |
 LL |     pub fn foo(arg: TokenStream) -> TokenStream { arg }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs b/src/test/ui/proc-macro/parent-source-spans.rs
index 7c30a8e328a..8f8e22ba1c3 100644
--- a/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs
+++ b/src/test/ui/proc-macro/parent-source-spans.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:parent-source-spans.rs
-// ignore-stage1
+
 
 #![feature(decl_macro, proc_macro_hygiene)]
 
diff --git a/src/test/ui-fulldeps/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr
index 0442c4f6ce7..0442c4f6ce7 100644
--- a/src/test/ui-fulldeps/proc-macro/parent-source-spans.stderr
+++ b/src/test/ui/proc-macro/parent-source-spans.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.rs b/src/test/ui/proc-macro/reserved-macro-names.rs
index ff5984aa67c..7c66af172fd 100644
--- a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.rs
+++ b/src/test/ui/proc-macro/reserved-macro-names.rs
@@ -1,3 +1,6 @@
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 
 extern crate proc_macro;
diff --git a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr b/src/test/ui/proc-macro/reserved-macro-names.stderr
index be6e80c3878..5ebe62a4969 100644
--- a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr
+++ b/src/test/ui/proc-macro/reserved-macro-names.stderr
@@ -1,17 +1,17 @@
 error: name `cfg` is reserved in macro namespace
-  --> $DIR/reserved-macro-names.rs:7:8
+  --> $DIR/reserved-macro-names.rs:10:8
    |
 LL | pub fn cfg(_: TokenStream, input: TokenStream) -> TokenStream {
    |        ^^^
 
 error: name `cfg_attr` is reserved in macro namespace
-  --> $DIR/reserved-macro-names.rs:13:8
+  --> $DIR/reserved-macro-names.rs:16:8
    |
 LL | pub fn cfg_attr(_: TokenStream, input: TokenStream) -> TokenStream {
    |        ^^^^^^^^
 
 error: name `derive` is reserved in macro namespace
-  --> $DIR/reserved-macro-names.rs:19:8
+  --> $DIR/reserved-macro-names.rs:22:8
    |
 LL | pub fn derive(_: TokenStream, input: TokenStream) -> TokenStream {
    |        ^^^^^^
diff --git a/src/test/ui-fulldeps/resolve-error.rs b/src/test/ui/proc-macro/resolve-error.rs
index 1940151357c..1940151357c 100644
--- a/src/test/ui-fulldeps/resolve-error.rs
+++ b/src/test/ui/proc-macro/resolve-error.rs
diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr
index 59ca668d485..59ca668d485 100644
--- a/src/test/ui-fulldeps/resolve-error.stderr
+++ b/src/test/ui/proc-macro/resolve-error.stderr
diff --git a/src/test/ui-fulldeps/proc-macro/signature.rs b/src/test/ui/proc-macro/signature.rs
index f2ea6f778cd..4d6903187e4 100644
--- a/src/test/ui-fulldeps/proc-macro/signature.rs
+++ b/src/test/ui/proc-macro/signature.rs
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
+// no-prefer-dynamic
+
 #![crate_type = "proc-macro"]
 #![allow(warnings)]
 
diff --git a/src/test/ui-fulldeps/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr
index fdd10c3c5b9..681e72c08c4 100644
--- a/src/test/ui-fulldeps/proc-macro/signature.stderr
+++ b/src/test/ui/proc-macro/signature.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/signature.rs:17:1
+  --> $DIR/signature.rs:20:1
    |
 LL | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 {
 LL | |     //~^ ERROR: mismatched types
diff --git a/src/test/ui-fulldeps/proc-macro/span-preservation.rs b/src/test/ui/proc-macro/span-preservation.rs
index adcb42ab2d1..adcb42ab2d1 100644
--- a/src/test/ui-fulldeps/proc-macro/span-preservation.rs
+++ b/src/test/ui/proc-macro/span-preservation.rs
diff --git a/src/test/ui-fulldeps/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr
index f33245aec37..f33245aec37 100644
--- a/src/test/ui-fulldeps/proc-macro/span-preservation.stderr
+++ b/src/test/ui/proc-macro/span-preservation.stderr
diff --git a/src/test/ui-fulldeps/subspan.rs b/src/test/ui/proc-macro/subspan.rs
index 437123ca479..dccf6e20448 100644
--- a/src/test/ui-fulldeps/subspan.rs
+++ b/src/test/ui/proc-macro/subspan.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:subspan.rs
-// ignore-stage1
 
 extern crate subspan;
 
diff --git a/src/test/ui-fulldeps/subspan.stderr b/src/test/ui/proc-macro/subspan.stderr
index 4d3928cae72..d9339bdaf76 100644
--- a/src/test/ui-fulldeps/subspan.stderr
+++ b/src/test/ui/proc-macro/subspan.stderr
@@ -1,95 +1,95 @@
 error: found 'hi's
-  --> $DIR/subspan.rs:22:1
+  --> $DIR/subspan.rs:21:1
    |
 LL | subspan!("hi"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:22:11
+  --> $DIR/subspan.rs:21:11
    |
 LL | subspan!("hi"); //~ ERROR found 'hi's
    |           ^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:25:1
+  --> $DIR/subspan.rs:24:1
    |
 LL | subspan!("hihi"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:25:11
+  --> $DIR/subspan.rs:24:11
    |
 LL | subspan!("hihi"); //~ ERROR found 'hi's
    |           ^^^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:28:1
+  --> $DIR/subspan.rs:27:1
    |
 LL | subspan!("hihihi"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:28:11
+  --> $DIR/subspan.rs:27:11
    |
 LL | subspan!("hihihi"); //~ ERROR found 'hi's
    |           ^^^^^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:31:1
+  --> $DIR/subspan.rs:30:1
    |
 LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:31:17
+  --> $DIR/subspan.rs:30:17
    |
 LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's
    |                 ^^    ^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:32:1
+  --> $DIR/subspan.rs:31:1
    |
 LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:32:16
+  --> $DIR/subspan.rs:31:16
    |
 LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's
    |                ^^  ^^    ^^    ^^ ^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:33:1
+  --> $DIR/subspan.rs:32:1
    |
 LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:33:12
+  --> $DIR/subspan.rs:32:12
    |
 LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's
    |            ^^       ^^       ^^             ^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:34:1
+  --> $DIR/subspan.rs:33:1
    |
 LL | subspan!("how are you this evening"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:34:24
+  --> $DIR/subspan.rs:33:24
    |
 LL | subspan!("how are you this evening"); //~ ERROR found 'hi's
    |                        ^^
 
 error: found 'hi's
-  --> $DIR/subspan.rs:35:1
+  --> $DIR/subspan.rs:34:1
    |
 LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
-  --> $DIR/subspan.rs:35:12
+  --> $DIR/subspan.rs:34:12
    |
 LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's
    |            ^^     ^^
diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.rs b/src/test/ui/proc-macro/three-equals.rs
index dd81b1017eb..e3285d3e821 100644
--- a/src/test/ui-fulldeps/proc-macro/three-equals.rs
+++ b/src/test/ui/proc-macro/three-equals.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:three-equals.rs
-// ignore-stage1
+
 
 #![feature(proc_macro_hygiene)]
 
diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr
index 1a0337f93f9..1a0337f93f9 100644
--- a/src/test/ui-fulldeps/proc-macro/three-equals.stderr
+++ b/src/test/ui/proc-macro/three-equals.stderr
diff --git a/src/test/ui-fulldeps/rust-2018/auxiliary/suggestions-not-always-applicable.rs b/src/test/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs
index 7ae4731fde1..b8a05e89a66 100644
--- a/src/test/ui-fulldeps/rust-2018/auxiliary/suggestions-not-always-applicable.rs
+++ b/src/test/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// force-host
 // no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
diff --git a/src/test/ui-fulldeps/rust-2018/proc-macro-crate-in-paths.rs b/src/test/ui/rust-2018/proc-macro-crate-in-paths.rs
index 1068c058745..51314abaad2 100644
--- a/src/test/ui-fulldeps/rust-2018/proc-macro-crate-in-paths.rs
+++ b/src/test/ui/rust-2018/proc-macro-crate-in-paths.rs
@@ -9,6 +9,8 @@
 // except according to those terms.
 
 // compile-pass
+// force-host
+// no-prefer-dynamic
 
 #![crate_type = "proc-macro"]
 #![deny(rust_2018_compatibility)]
diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed b/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed
index b64ebed0305..b64ebed0305 100644
--- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed
+++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed
diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs b/src/test/ui/rust-2018/suggestions-not-always-applicable.rs
index b64ebed0305..b64ebed0305 100644
--- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs
+++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.rs
diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
index 415733a346f..415733a346f 100644
--- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.stderr
+++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.rs b/src/test/ui/unnecessary-extern-crate.rs
index 1cdc9229d07..110cfefcd92 100644
--- a/src/test/ui-fulldeps/unnecessary-extern-crate.rs
+++ b/src/test/ui/unnecessary-extern-crate.rs
@@ -13,10 +13,10 @@
 #![deny(unused_extern_crates)]
 #![feature(alloc, test, libc, crate_visibility_modifier)]
 
-extern crate alloc;
+extern crate libc;
 //~^ ERROR unused extern crate
 //~| HELP remove
-extern crate alloc as x;
+extern crate libc as x;
 //~^ ERROR unused extern crate
 //~| HELP remove
 
@@ -27,22 +27,22 @@ extern crate test;
 
 pub extern crate test as y;
 
-pub extern crate libc;
+pub extern crate alloc;
 
-pub(crate) extern crate libc as a;
+pub(crate) extern crate alloc as a;
 
-crate extern crate libc as b;
+crate extern crate alloc as b;
 
 mod foo {
-    pub(in crate::foo) extern crate libc as c;
+    pub(in crate::foo) extern crate alloc as c;
 
-    pub(super) extern crate libc as d;
+    pub(super) extern crate alloc as d;
 
-    extern crate alloc;
+    extern crate libc;
     //~^ ERROR unused extern crate
     //~| HELP remove
 
-    extern crate alloc as x;
+    extern crate libc as x;
     //~^ ERROR unused extern crate
     //~| HELP remove
 
@@ -51,35 +51,31 @@ mod foo {
     pub extern crate test as y;
 
     mod bar {
-        extern crate alloc;
+        extern crate libc;
         //~^ ERROR unused extern crate
         //~| HELP remove
 
-        extern crate alloc as x;
+        extern crate libc as x;
         //~^ ERROR unused extern crate
         //~| HELP remove
 
-        pub(in crate::foo::bar) extern crate libc as e;
+        pub(in crate::foo::bar) extern crate alloc as e;
 
         fn dummy() {
-            unsafe {
-                e::getpid();
-            }
+            e::string::String::new();
         }
     }
 
     fn dummy() {
-        unsafe {
-            c::getpid();
-            d::getpid();
-        }
+        c::string::String::new();
+        d::string::String::new();
     }
 }
 
 
 fn main() {
-    unsafe { a::getpid(); }
-    unsafe { b::getpid(); }
+    a::string::String::new();
+    b::string::String::new();
 
     proc_macro::TokenStream::new();
 }
diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.stderr b/src/test/ui/unnecessary-extern-crate.stderr
index 58ec5901585..1315bff791d 100644
--- a/src/test/ui-fulldeps/unnecessary-extern-crate.stderr
+++ b/src/test/ui/unnecessary-extern-crate.stderr
@@ -1,8 +1,8 @@
 error: unused extern crate
   --> $DIR/unnecessary-extern-crate.rs:16:1
    |
-LL | extern crate alloc;
-   | ^^^^^^^^^^^^^^^^^^^ help: remove it
+LL | extern crate libc;
+   | ^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: lint level defined here
   --> $DIR/unnecessary-extern-crate.rs:13:9
@@ -13,32 +13,32 @@ LL | #![deny(unused_extern_crates)]
 error: unused extern crate
   --> $DIR/unnecessary-extern-crate.rs:19:1
    |
-LL | extern crate alloc as x;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+LL | extern crate libc as x;
+   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
 
 error: unused extern crate
   --> $DIR/unnecessary-extern-crate.rs:41:5
    |
-LL |     extern crate alloc;
-   |     ^^^^^^^^^^^^^^^^^^^ help: remove it
+LL |     extern crate libc;
+   |     ^^^^^^^^^^^^^^^^^^ help: remove it
 
 error: unused extern crate
   --> $DIR/unnecessary-extern-crate.rs:45:5
    |
-LL |     extern crate alloc as x;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+LL |     extern crate libc as x;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
 
 error: unused extern crate
   --> $DIR/unnecessary-extern-crate.rs:54:9
    |
-LL |         extern crate alloc;
-   |         ^^^^^^^^^^^^^^^^^^^ help: remove it
+LL |         extern crate libc;
+   |         ^^^^^^^^^^^^^^^^^^ help: remove it
 
 error: unused extern crate
   --> $DIR/unnecessary-extern-crate.rs:58:9
    |
-LL |         extern crate alloc as x;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+LL |         extern crate libc as x;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
 
 error: aborting due to 6 previous errors
 
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 399f9f577ed..b650e056eb7 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1829,10 +1829,10 @@ impl<'test> TestCx<'test> {
             rustc.args(self.split_maybe_args(&self.config.host_rustcflags));
         } else {
             rustc.args(self.split_maybe_args(&self.config.target_rustcflags));
-        }
-        if !is_rustdoc {
-            if let Some(ref linker) = self.config.linker {
-                rustc.arg(format!("-Clinker={}", linker));
+            if !is_rustdoc {
+                if let Some(ref linker) = self.config.linker {
+                    rustc.arg(format!("-Clinker={}", linker));
+                }
             }
         }