about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh White <jwhite927@gmail.com>2020-02-07 23:56:44 -0500
committerJosh White <jwhite927@gmail.com>2020-02-07 23:56:44 -0500
commit69075f065cdbb0a5138549260c3f2f8234aa7cfc (patch)
treee318c22f9a55a89626f70e02753928377a0a2a6b
parent92fc98c695d133ae28fb9d386d22efef57e2fc87 (diff)
parent8498c5f5b02dbb4ed58a1eb4901b0b733342c35f (diff)
downloadrust-69075f065cdbb0a5138549260c3f2f8234aa7cfc.tar.gz
rust-69075f065cdbb0a5138549260c3f2f8234aa7cfc.zip
Merge branch 'master' of https://github.com/jwhite927/rust into E0637
-rw-r--r--.github/ISSUE_TEMPLATE/blank_issue.md4
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md44
-rw-r--r--.github/ISSUE_TEMPLATE/config.yml5
-rw-r--r--.github/ISSUE_TEMPLATE/ice.md52
-rw-r--r--.github/ISSUE_TEMPLATE/tracking_issue.md58
-rw-r--r--.mailmap1
-rw-r--r--Cargo.lock1
-rw-r--r--src/bootstrap/builder.rs8
m---------src/doc/rustc-guide0
-rw-r--r--src/doc/unstable-book/src/language-features/generators.md26
-rw-r--r--src/doc/unstable-book/src/language-features/no-sanitize.md29
-rw-r--r--src/liballoc/benches/btree/map.rs56
-rw-r--r--src/liballoc/boxed.rs24
-rw-r--r--src/liballoc/collections/btree/map.rs66
-rw-r--r--src/liballoc/collections/btree/node.rs9
-rw-r--r--src/liballoc/collections/btree/search.rs12
-rw-r--r--src/libcore/ops/generator.rs35
-rw-r--r--src/libcore/option.rs6
-rw-r--r--src/libcore/result.rs6
-rw-r--r--src/librustc/arena.rs2
-rw-r--r--src/librustc/dep_graph/dep_node.rs15
-rw-r--r--src/librustc/hir/map/collector.rs9
-rw-r--r--src/librustc/hir/map/hir_id_validator.rs2
-rw-r--r--src/librustc/hir/map/mod.rs98
-rw-r--r--src/librustc/hir/mod.rs41
-rw-r--r--src/librustc/ich/impls_syntax.rs7
-rw-r--r--src/librustc/ich/impls_ty.rs5
-rw-r--r--src/librustc/infer/canonical/canonicalizer.rs17
-rw-r--r--src/librustc/infer/combine.rs2
-rw-r--r--src/librustc/infer/error_reporting/mod.rs35
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs2
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/mod.rs18
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs2
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs19
-rw-r--r--src/librustc/infer/freshen.rs2
-rw-r--r--src/librustc/infer/higher_ranked/mod.rs10
-rw-r--r--src/librustc/infer/lexical_region_resolve/mod.rs148
-rw-r--r--src/librustc/infer/mod.rs36
-rw-r--r--src/librustc/infer/opaque_types/mod.rs9
-rw-r--r--src/librustc/infer/outlives/verify.rs13
-rw-r--r--src/librustc/infer/region_constraints/leak_check.rs12
-rw-r--r--src/librustc/infer/region_constraints/mod.rs8
-rw-r--r--src/librustc/middle/codegen_fn_attrs.rs8
-rw-r--r--src/librustc/middle/free_region.rs60
-rw-r--r--src/librustc/mir/mod.rs11
-rw-r--r--src/librustc/mir/visit.rs6
-rw-r--r--src/librustc/query/mod.rs12
-rw-r--r--src/librustc/traits/coherence.rs15
-rw-r--r--src/librustc/traits/mod.rs22
-rw-r--r--src/librustc/traits/specialize/mod.rs6
-rw-r--r--src/librustc/traits/specialize/specialization_graph.rs24
-rw-r--r--src/librustc/traits/util.rs6
-rw-r--r--src/librustc/ty/context.rs19
-rw-r--r--src/librustc/ty/free_region_map.rs89
-rw-r--r--src/librustc/ty/layout.rs5
-rw-r--r--src/librustc/ty/print/pretty.rs8
-rw-r--r--src/librustc/ty/query/mod.rs2
-rw-r--r--src/librustc/ty/query/plumbing.rs1
-rw-r--r--src/librustc/ty/structural_impls.rs6
-rw-r--r--src/librustc/ty/sty.rs126
-rw-r--r--src/librustc_ast_lowering/expr.rs4
-rw-r--r--src/librustc_codegen_llvm/attributes.rs26
-rw-r--r--src/librustc_codegen_llvm/base.rs7
-rw-r--r--src/librustc_codegen_llvm/declare.rs16
-rw-r--r--src/librustc_codegen_ssa/base.rs22
-rw-r--r--src/librustc_data_structures/box_region.rs39
-rw-r--r--src/librustc_driver/pretty.rs16
-rw-r--r--src/librustc_error_codes/error_codes/E0276.md5
-rw-r--r--src/librustc_error_codes/error_codes/E0511.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0534.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0535.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0565.md14
-rw-r--r--src/librustc_error_codes/error_codes/E0626.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0633.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0668.md2
-rw-r--r--src/librustc_errors/annotate_snippet_emitter_writer.rs10
-rw-r--r--src/librustc_errors/emitter.rs231
-rw-r--r--src/librustc_errors/json.rs22
-rw-r--r--src/librustc_errors/lib.rs8
-rw-r--r--src/librustc_feature/active.rs3
-rw-r--r--src/librustc_feature/builtin_attrs.rs5
-rw-r--r--src/librustc_index/vec.rs8
-rw-r--r--src/librustc_interface/passes.rs12
-rw-r--r--src/librustc_interface/queries.rs18
-rw-r--r--src/librustc_metadata/rmeta/encoder.rs4
-rw-r--r--src/librustc_mir/borrow_check/diagnostics/region_name.rs2
-rw-r--r--src/librustc_mir/borrow_check/invalidation.rs4
-rw-r--r--src/librustc_mir/borrow_check/mod.rs4
-rw-r--r--src/librustc_mir/borrow_check/region_infer/mod.rs5
-rw-r--r--src/librustc_mir/borrow_check/type_check/constraint_conversion.rs6
-rw-r--r--src/librustc_mir/borrow_check/type_check/free_region_relations.rs11
-rw-r--r--src/librustc_mir/borrow_check/universal_regions.rs4
-rw-r--r--src/librustc_mir/dataflow/impls/storage_liveness.rs20
-rw-r--r--src/librustc_mir/dataflow/move_paths/builder.rs4
-rw-r--r--src/librustc_mir/transform/generator.rs120
-rw-r--r--src/librustc_mir/transform/inline.rs23
-rw-r--r--src/librustc_mir_build/build/expr/as_rvalue.rs14
-rw-r--r--src/librustc_mir_build/build/expr/category.rs2
-rw-r--r--src/librustc_mir_build/build/expr/into.rs21
-rw-r--r--src/librustc_mir_build/build/mod.rs28
-rw-r--r--src/librustc_passes/check_const.rs3
-rw-r--r--src/librustc_passes/entry.rs4
-rw-r--r--src/librustc_resolve/lifetimes.rs2
-rw-r--r--src/librustc_session/config.rs2
-rw-r--r--src/librustc_session/lint/builtin.rs18
-rw-r--r--src/librustc_session/options.rs4
-rw-r--r--src/librustc_session/session.rs12
-rw-r--r--src/librustc_span/source_map.rs8
-rw-r--r--src/librustc_span/symbol.rs4
-rw-r--r--src/librustc_traits/chalk_context/resolvent_ops.rs8
-rw-r--r--src/librustc_traits/dropck_outlives.rs5
-rw-r--r--src/librustc_typeck/check/closure.rs13
-rw-r--r--src/librustc_typeck/check/expr.rs11
-rw-r--r--src/librustc_typeck/check/mod.rs20
-rw-r--r--src/librustc_typeck/check/pat.rs2
-rw-r--r--src/librustc_typeck/coherence/inherent_impls_overlap.rs5
-rw-r--r--src/librustc_typeck/collect.rs43
-rw-r--r--src/librustc_typeck/outlives/utils.rs2
-rw-r--r--src/librustc_typeck/variance/constraints.rs2
-rw-r--r--src/librustdoc/clean/mod.rs6
-rw-r--r--src/librustdoc/test.rs4
-rw-r--r--src/libstd/future.rs5
-rw-r--r--src/libtest/lib.rs26
-rw-r--r--src/test/codegen/sanitizer-no-sanitize-inlining.rs32
-rw-r--r--src/test/codegen/sanitizer-no-sanitize.rs29
-rw-r--r--src/test/debuginfo/generator-locals.rs6
-rw-r--r--src/test/debuginfo/generator-objects.rs6
-rw-r--r--src/test/debuginfo/issue-57822.rs2
-rw-r--r--src/test/incremental/crate_hash_reorder.rs8
-rw-r--r--src/test/incremental/issue-38222.rs12
-rw-r--r--src/test/incremental/krate-inherent.rs8
-rw-r--r--src/test/incremental/krate-inlined.rs4
-rw-r--r--src/test/mir-opt/generator-drop-cleanup.rs8
-rw-r--r--src/test/mir-opt/generator-storage-dead-unwind.rs52
-rw-r--r--src/test/run-fail/generator-resume-after-panic.rs4
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.stderr1
-rw-r--r--src/test/ui-fulldeps/hash-stable-is-unstable.stderr1
-rw-r--r--src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr1
-rw-r--r--src/test/ui/allocator/not-an-allocator.stderr4
-rw-r--r--src/test/ui/allocator/two-allocators.stderr2
-rw-r--r--src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs6
-rw-r--r--src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr2
-rw-r--r--src/test/ui/borrowck/issue-64453.stderr2
-rw-r--r--src/test/ui/borrowck/move-error-snippets.stderr2
-rw-r--r--src/test/ui/codemap_tests/bad-format-args.stderr2
-rw-r--r--src/test/ui/codemap_tests/issue-28308.stderr2
-rw-r--r--src/test/ui/coherence/coherence-inherited-subtyping.old.stderr14
-rw-r--r--src/test/ui/coherence/coherence-inherited-subtyping.re.stderr14
-rw-r--r--src/test/ui/coherence/coherence-inherited-subtyping.rs21
-rw-r--r--src/test/ui/coherence/coherence-subtyping.old.stderr14
-rw-r--r--src/test/ui/coherence/coherence-subtyping.re.stderr14
-rw-r--r--src/test/ui/coherence/coherence-subtyping.rs13
-rw-r--r--src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr2
-rw-r--r--src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr2
-rw-r--r--src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr1
-rw-r--r--src/test/ui/const-generics/broken-mir-2.stderr1
-rw-r--r--src/test/ui/const-generics/derive-debug-array-wrapper.stderr1
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr4
-rw-r--r--src/test/ui/consts/const-eval/const_panic.stderr6
-rw-r--r--src/test/ui/consts/const-eval/const_panic_libcore.stderr6
-rw-r--r--src/test/ui/consts/const-eval/const_panic_libcore_main.stderr6
-rw-r--r--src/test/ui/consts/const-eval/feature-gate-const_panic.stderr6
-rw-r--r--src/test/ui/consts/const-eval/panic-assoc-never-type.stderr2
-rw-r--r--src/test/ui/consts/const-eval/panic-never-type.stderr2
-rw-r--r--src/test/ui/consts/const-external-macro-const-err.stderr2
-rw-r--r--src/test/ui/consts/control-flow/assert.both.stderr2
-rw-r--r--src/test/ui/consts/control-flow/assert.if_match.stderr4
-rw-r--r--src/test/ui/consts/control-flow/assert.panic.stderr2
-rw-r--r--src/test/ui/consts/control-flow/assert.stock.stderr2
-rw-r--r--src/test/ui/consts/control-flow/issue-50577.if_match.stderr2
-rw-r--r--src/test/ui/consts/control-flow/issue-50577.stock.stderr8
-rw-r--r--src/test/ui/consts/control-flow/short-circuit.stock.stderr4
-rw-r--r--src/test/ui/consts/enum-discr-type-err.stderr2
-rw-r--r--src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr2
-rw-r--r--src/test/ui/cross/cross-crate-macro-backtrace/main.stderr2
-rw-r--r--src/test/ui/cross/cross-file-errors/main.stderr2
-rw-r--r--src/test/ui/custom_test_frameworks/mismatch.stderr1
-rw-r--r--src/test/ui/dep-graph/dep-graph-variance-alias.rs9
-rw-r--r--src/test/ui/dep-graph/dep-graph-variance-alias.stderr2
-rw-r--r--src/test/ui/deprecation/deprecation-lint-2.stderr2
-rw-r--r--src/test/ui/deprecation/deprecation-lint-3.stderr2
-rw-r--r--src/test/ui/deref-suggestion.stderr4
-rw-r--r--src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Clone-enum.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Clone-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Clone-tuple-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Debug-enum.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Debug-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Debug-tuple-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Default-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Default-tuple-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Eq-enum.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Eq-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Eq-tuple-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr2
-rw-r--r--src/test/ui/derives/derives-span-Hash-enum.stderr2
-rw-r--r--src/test/ui/derives/derives-span-Hash-struct.stderr2
-rw-r--r--src/test/ui/derives/derives-span-Hash-tuple-struct.stderr2
-rw-r--r--src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Ord-enum.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Ord-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-Ord-tuple-struct.stderr1
-rw-r--r--src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr2
-rw-r--r--src/test/ui/derives/derives-span-PartialEq-enum.stderr2
-rw-r--r--src/test/ui/derives/derives-span-PartialEq-struct.stderr2
-rw-r--r--src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr2
-rw-r--r--src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr5
-rw-r--r--src/test/ui/derives/derives-span-PartialOrd-enum.stderr5
-rw-r--r--src/test/ui/derives/derives-span-PartialOrd-struct.stderr5
-rw-r--r--src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr5
-rw-r--r--src/test/ui/derives/deriving-no-inner-impl-error-message.stderr3
-rw-r--r--src/test/ui/derives/deriving-with-repr-packed.stderr4
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-expr.stderr2
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-pat.stderr4
-rw-r--r--src/test/ui/did_you_mean/bad-assoc-ty.stderr4
-rw-r--r--src/test/ui/did_you_mean/recursion_limit_macro.stderr1
-rw-r--r--src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr6
-rw-r--r--src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr8
-rw-r--r--src/test/ui/drop/dynamic-drop.rs2
-rw-r--r--src/test/ui/editions/edition-imports-2015.stderr2
-rw-r--r--src/test/ui/editions/edition-imports-2018.stderr2
-rw-r--r--src/test/ui/editions/edition-imports-virtual-2015-gated.stderr2
-rw-r--r--src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr2
-rw-r--r--src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr2
-rw-r--r--src/test/ui/error-codes/E0184.stderr2
-rw-r--r--src/test/ui/error-codes/E0665.stderr2
-rw-r--r--src/test/ui/exclusive-drop-and-copy.stderr4
-rw-r--r--src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr1
-rw-r--r--src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr1
-rw-r--r--src/test/ui/feature-gates/feature-gate-concat_idents2.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-no_sanitize.rs4
-rw-r--r--src/test/ui/feature-gates/feature-gate-no_sanitize.stderr12
-rw-r--r--src/test/ui/generator-yielding-or-returning-itself.rs2
-rw-r--r--src/test/ui/generator-yielding-or-returning-itself.stderr21
-rw-r--r--src/test/ui/generator/auxiliary/xcrate-reachable.rs2
-rw-r--r--src/test/ui/generator/auxiliary/xcrate.rs4
-rw-r--r--src/test/ui/generator/borrowing.rs2
-rw-r--r--src/test/ui/generator/borrowing.stderr2
-rw-r--r--src/test/ui/generator/conditional-drop.rs8
-rw-r--r--src/test/ui/generator/control-flow.rs4
-rw-r--r--src/test/ui/generator/drop-and-replace.rs2
-rw-r--r--src/test/ui/generator/drop-env.rs4
-rw-r--r--src/test/ui/generator/dropck-resume.rs33
-rw-r--r--src/test/ui/generator/dropck-resume.stderr15
-rw-r--r--src/test/ui/generator/dropck.rs2
-rw-r--r--src/test/ui/generator/generator-region-requirements.rs2
-rw-r--r--src/test/ui/generator/issue-44197.rs13
-rw-r--r--src/test/ui/generator/issue-61442-stmt-expr-with-drop.rs4
-rw-r--r--src/test/ui/generator/iterator-count.rs6
-rw-r--r--src/test/ui/generator/live-upvar-across-yield.rs2
-rw-r--r--src/test/ui/generator/nested_generators.rs2
-rw-r--r--src/test/ui/generator/no-parameters-on-generators.rs8
-rw-r--r--src/test/ui/generator/no-parameters-on-generators.stderr21
-rw-r--r--src/test/ui/generator/panic-drops-resume.rs37
-rw-r--r--src/test/ui/generator/panic-drops.rs4
-rw-r--r--src/test/ui/generator/panic-safe.rs4
-rw-r--r--src/test/ui/generator/resume-after-return.rs4
-rw-r--r--src/test/ui/generator/resume-arg-late-bound.rs17
-rw-r--r--src/test/ui/generator/resume-arg-late-bound.stderr15
-rw-r--r--src/test/ui/generator/resume-live-across-yield.rs45
-rw-r--r--src/test/ui/generator/retain-resume-ref.rs25
-rw-r--r--src/test/ui/generator/retain-resume-ref.stderr14
-rw-r--r--src/test/ui/generator/sized-yield.rs2
-rw-r--r--src/test/ui/generator/sized-yield.stderr2
-rw-r--r--src/test/ui/generator/smoke-resume-args.rs97
-rw-r--r--src/test/ui/generator/smoke.rs28
-rw-r--r--src/test/ui/generator/static-generators.rs4
-rw-r--r--src/test/ui/generator/too-many-parameters.rs8
-rw-r--r--src/test/ui/generator/too-many-parameters.stderr8
-rw-r--r--src/test/ui/generator/type-mismatch-error.rs22
-rw-r--r--src/test/ui/generator/type-mismatch-error.stderr19
-rw-r--r--src/test/ui/generator/type-mismatch-signature-deduction.rs6
-rw-r--r--src/test/ui/generator/type-mismatch-signature-deduction.stderr25
-rw-r--r--src/test/ui/generator/xcrate-reachable.rs2
-rw-r--r--src/test/ui/generator/xcrate.rs6
-rw-r--r--src/test/ui/generator/yield-while-iterating.rs6
-rw-r--r--src/test/ui/generator/yield-while-iterating.stderr2
-rw-r--r--src/test/ui/generator/yield-while-local-borrowed.rs6
-rw-r--r--src/test/ui/generator/yield-while-ref-reborrowed.rs6
-rw-r--r--src/test/ui/generator/yield-while-ref-reborrowed.stderr2
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr2
-rw-r--r--src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr1
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr1
-rw-r--r--src/test/ui/hygiene/assoc_item_ctxt.stderr4
-rw-r--r--src/test/ui/hygiene/duplicate_lifetimes.stderr4
-rw-r--r--src/test/ui/hygiene/extern-prelude-from-opaque-fail.stderr4
-rw-r--r--src/test/ui/hygiene/fields-definition.stderr2
-rw-r--r--src/test/ui/hygiene/fields-move.stderr1
-rw-r--r--src/test/ui/hygiene/fields.stderr8
-rw-r--r--src/test/ui/hygiene/generate-mod.stderr8
-rw-r--r--src/test/ui/hygiene/globs.stderr3
-rw-r--r--src/test/ui/hygiene/hygienic-label-1.stderr2
-rw-r--r--src/test/ui/hygiene/hygienic-label-3.stderr2
-rw-r--r--src/test/ui/hygiene/hygienic-labels-in-let.stderr32
-rw-r--r--src/test/ui/hygiene/hygienic-labels.stderr32
-rw-r--r--src/test/ui/hygiene/impl_items.stderr2
-rw-r--r--src/test/ui/hygiene/intercrate.stderr2
-rw-r--r--src/test/ui/hygiene/no_implicit_prelude.stderr5
-rw-r--r--src/test/ui/hygiene/privacy-early.stderr1
-rw-r--r--src/test/ui/hygiene/trait_items.stderr1
-rw-r--r--src/test/ui/if/if-let.stderr3
-rw-r--r--src/test/ui/if/ifmt-bad-arg.stderr2
-rw-r--r--src/test/ui/if/ifmt-bad-format-args.stderr2
-rw-r--r--src/test/ui/if/ifmt-unimpl.stderr1
-rw-r--r--src/test/ui/imports/extern-prelude-extern-crate-fail.stderr2
-rw-r--r--src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr3
-rw-r--r--src/test/ui/imports/import-crate-var.stderr2
-rw-r--r--src/test/ui/imports/import-prefix-macro-1.stderr2
-rw-r--r--src/test/ui/imports/import-prefix-macro-2.stderr2
-rw-r--r--src/test/ui/imports/local-modularized-tricky-fail-1.stderr4
-rw-r--r--src/test/ui/imports/local-modularized-tricky-fail-2.stderr3
-rw-r--r--src/test/ui/imports/local-modularized-tricky-fail-3.stderr2
-rw-r--r--src/test/ui/imports/shadow_builtin_macros.stderr1
-rw-r--r--src/test/ui/in-band-lifetimes/elided-lifetimes.stderr4
-rw-r--r--src/test/ui/include-macros/mismatched-types.stderr2
-rw-r--r--src/test/ui/infinite/infinite-macro-expansion.stderr1
-rw-r--r--src/test/ui/inline-asm-bad-constraint.stderr6
-rw-r--r--src/test/ui/internal/internal-unstable-noallow.stderr8
-rw-r--r--src/test/ui/internal/internal-unstable.stderr1
-rw-r--r--src/test/ui/invalid/invalid-no-sanitize.rs5
-rw-r--r--src/test/ui/invalid/invalid-no-sanitize.stderr10
-rw-r--r--src/test/ui/issues/issue-12997-2.stderr2
-rw-r--r--src/test/ui/issues/issue-13446.stderr2
-rw-r--r--src/test/ui/issues/issue-14091-2.stderr1
-rw-r--r--src/test/ui/issues/issue-15167.stderr8
-rw-r--r--src/test/ui/issues/issue-16098.stderr1
-rw-r--r--src/test/ui/issues/issue-16966.stderr2
-rw-r--r--src/test/ui/issues/issue-21160.stderr2
-rw-r--r--src/test/ui/issues/issue-2150.stderr1
-rw-r--r--src/test/ui/issues/issue-25385.stderr2
-rw-r--r--src/test/ui/issues/issue-25386.stderr4
-rw-r--r--src/test/ui/issues/issue-25793.stderr2
-rw-r--r--src/test/ui/issues/issue-26093.stderr4
-rw-r--r--src/test/ui/issues/issue-26094.stderr2
-rw-r--r--src/test/ui/issues/issue-27340.stderr2
-rw-r--r--src/test/ui/issues/issue-27592.stderr4
-rw-r--r--src/test/ui/issues/issue-29084.stderr2
-rw-r--r--src/test/ui/issues/issue-31011.stderr2
-rw-r--r--src/test/ui/issues/issue-32655.stderr2
-rw-r--r--src/test/ui/issues/issue-32782.stderr1
-rw-r--r--src/test/ui/issues/issue-32829.stderr2
-rw-r--r--src/test/ui/issues/issue-32950.stderr2
-rw-r--r--src/test/ui/issues/issue-34229.stderr5
-rw-r--r--src/test/ui/issues/issue-34334.stderr2
-rw-r--r--src/test/ui/issues/issue-38821.stderr1
-rw-r--r--src/test/ui/issues/issue-42954.stderr2
-rw-r--r--src/test/ui/issues/issue-48364.stderr1
-rw-r--r--src/test/ui/issues/issue-48728.stderr1
-rw-r--r--src/test/ui/issues/issue-50480.stderr2
-rw-r--r--src/test/ui/issues/issue-51848.stderr1
-rw-r--r--src/test/ui/issues/issue-53251.stderr4
-rw-r--r--src/test/ui/issues/issue-56411.stderr2
-rw-r--r--src/test/ui/issues/issue-59488.stderr6
-rw-r--r--src/test/ui/issues/issue-6596-1.stderr2
-rw-r--r--src/test/ui/issues/issue-6596-2.stderr2
-rw-r--r--src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr2
-rw-r--r--src/test/ui/lifetimes/borrowck-let-suggestion.stderr2
-rw-r--r--src/test/ui/lint/lint-stability2.stderr2
-rw-r--r--src/test/ui/lint/lint-stability3.stderr2
-rw-r--r--src/test/ui/lint/lint-unsafe-code.stderr2
-rw-r--r--src/test/ui/lint/lints-in-foreign-macros.stderr1
-rw-r--r--src/test/ui/lint/test-inner-fn.stderr3
-rw-r--r--src/test/ui/lint/unreachable_pub-pub_crate.stderr1
-rw-r--r--src/test/ui/lint/unreachable_pub.stderr1
-rw-r--r--src/test/ui/liveness/liveness-return-last-stmt-semi.stderr2
-rw-r--r--src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr (renamed from src/test/ui/macro_backtrace/main.stderr)6
-rw-r--r--src/test/ui/macro_backtrace/main.default.stderr35
-rw-r--r--src/test/ui/macro_backtrace/main.rs3
-rw-r--r--src/test/ui/macros/assert.stderr2
-rw-r--r--src/test/ui/macros/cfg.stderr2
-rw-r--r--src/test/ui/macros/derive-in-eager-expansion-hang.stderr1
-rw-r--r--src/test/ui/macros/format-parse-errors.stderr2
-rw-r--r--src/test/ui/macros/issue-54441.stderr2
-rw-r--r--src/test/ui/macros/macro-backtrace-invalid-internals.stderr14
-rw-r--r--src/test/ui/macros/macro-backtrace-nested.stderr4
-rw-r--r--src/test/ui/macros/macro-backtrace-println.stderr2
-rw-r--r--src/test/ui/macros/macro-context.stderr2
-rw-r--r--src/test/ui/macros/macro-lifetime-used-with-labels.stderr2
-rw-r--r--src/test/ui/macros/macro-local-data-key-priv.stderr2
-rw-r--r--src/test/ui/macros/macro-shadowing.stderr2
-rw-r--r--src/test/ui/macros/macros-nonfatal-errors.stderr6
-rw-r--r--src/test/ui/macros/must-use-in-macro-55516.stderr2
-rw-r--r--src/test/ui/macros/nonterminal-matching.stderr2
-rw-r--r--src/test/ui/macros/restricted-shadowing-legacy.stderr8
-rw-r--r--src/test/ui/macros/restricted-shadowing-modern.stderr6
-rw-r--r--src/test/ui/macros/same-sequence-span.stderr7
-rw-r--r--src/test/ui/macros/span-covering-argument-1.stderr2
-rw-r--r--src/test/ui/macros/trace_faulty_macros.stderr3
-rw-r--r--src/test/ui/malformed/malformed-derive-entry.stderr4
-rw-r--r--src/test/ui/malformed/malformed-interpolated.stderr4
-rw-r--r--src/test/ui/match/match-arm-resolving-to-never.stderr2
-rw-r--r--src/test/ui/methods/method-on-ambiguous-numeric-type.stderr2
-rw-r--r--src/test/ui/mismatched_types/issue-26480.stderr2
-rw-r--r--src/test/ui/missing/missing-semicolon-warning.stderr2
-rw-r--r--src/test/ui/never_type/feature-gate-never_type_fallback.stderr1
-rw-r--r--src/test/ui/never_type/never-assign-dead-code.stderr1
-rw-r--r--src/test/ui/nll/issue-55850.rs2
-rw-r--r--src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs4
-rw-r--r--src/test/ui/on-unimplemented/no-debug.stderr4
-rw-r--r--src/test/ui/out-of-order-shadowing.stderr2
-rw-r--r--src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr4
-rw-r--r--src/test/ui/parser/macro/issue-37113.stderr2
-rw-r--r--src/test/ui/parser/macro/issue-37234.stderr2
-rw-r--r--src/test/ui/parser/macro/macro-incomplete-parse.stderr2
-rw-r--r--src/test/ui/parser/macro/pub-item-macro.stderr2
-rw-r--r--src/test/ui/parser/macro/trait-non-item-macros.stderr2
-rw-r--r--src/test/ui/parser/mut-patterns.stderr2
-rw-r--r--src/test/ui/parser/recover-range-pats.stderr6
-rw-r--r--src/test/ui/pattern/rest-pat-semantic-disallowed.stderr1
-rw-r--r--src/test/ui/privacy/associated-item-privacy-inherent.stderr42
-rw-r--r--src/test/ui/privacy/associated-item-privacy-trait.stderr70
-rw-r--r--src/test/ui/privacy/associated-item-privacy-type-binding.stderr32
-rw-r--r--src/test/ui/privacy/private-inferred-type-3.stderr14
-rw-r--r--src/test/ui/privacy/private-inferred-type.stderr12
-rw-r--r--src/test/ui/proc-macro/derive-bad.stderr2
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowing.stderr4
-rw-r--r--src/test/ui/proc-macro/dollar-crate.stderr3
-rw-r--r--src/test/ui/proc-macro/expand-to-unstable-2.stderr1
-rw-r--r--src/test/ui/proc-macro/expand-to-unstable.stderr1
-rw-r--r--src/test/ui/proc-macro/gen-macro-rules-hygiene.stderr4
-rw-r--r--src/test/ui/proc-macro/generate-mod.stderr14
-rw-r--r--src/test/ui/proc-macro/invalid-punct-ident-4.stderr7
-rw-r--r--src/test/ui/proc-macro/issue-38586.stderr2
-rw-r--r--src/test/ui/proc-macro/issue-50493.stderr4
-rw-r--r--src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr2
-rw-r--r--src/test/ui/proc-macro/lints_in_proc_macros.stderr7
-rw-r--r--src/test/ui/proc-macro/mixed-site-span.stderr15
-rw-r--r--src/test/ui/proc-macro/multispan.stderr7
-rw-r--r--src/test/ui/proc-macro/parent-source-spans.stderr18
-rw-r--r--src/test/ui/proc-macro/subspan.stderr24
-rw-r--r--src/test/ui/proc-macro/three-equals.stderr1
-rw-r--r--src/test/ui/range/range_traits-1.stderr36
-rw-r--r--src/test/ui/range/range_traits-2.stderr2
-rw-r--r--src/test/ui/range/range_traits-3.stderr2
-rw-r--r--src/test/ui/range/range_traits-6.stderr2
-rw-r--r--src/test/ui/reachable/expr_again.stderr2
-rw-r--r--src/test/ui/reachable/expr_block.stderr2
-rw-r--r--src/test/ui/reachable/expr_if.stderr2
-rw-r--r--src/test/ui/reachable/expr_loop.stderr6
-rw-r--r--src/test/ui/reachable/expr_match.stderr4
-rw-r--r--src/test/ui/regions/regions-var-type-out-of-scope.stderr1
-rw-r--r--src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr1
-rw-r--r--src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr2
-rw-r--r--src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr2
-rw-r--r--src/test/ui/rust-2018/suggestions-not-always-applicable.stderr2
-rw-r--r--src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr1
-rw-r--r--src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr1
-rw-r--r--src/test/ui/sanitize-inline-always.rs15
-rw-r--r--src/test/ui/sanitize-inline-always.stderr13
-rw-r--r--src/test/ui/span/E0204.stderr4
-rw-r--r--src/test/ui/span/coerce-suggestions.stderr2
-rw-r--r--src/test/ui/span/issue-33884.stderr2
-rw-r--r--src/test/ui/span/macro-span-replacement.stderr1
-rw-r--r--src/test/ui/span/slice-borrow.stderr2
-rw-r--r--src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr7
-rw-r--r--src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr2
-rw-r--r--src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr2
-rw-r--r--src/test/ui/suggestions/path-display.stderr1
-rw-r--r--src/test/ui/suggestions/vec-macro-in-pattern.stderr2
-rw-r--r--src/test/ui/test-panic-abort-nocapture.rs39
-rw-r--r--src/test/ui/test-panic-abort-nocapture.run.stderr9
-rw-r--r--src/test/ui/test-panic-abort-nocapture.run.stdout23
-rw-r--r--src/test/ui/trace_macros-gate.stderr1
-rw-r--r--src/test/ui/try-block/try-block-opt-init.stderr2
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test2.stderr2
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test3.stderr2
-rw-r--r--src/test/ui/type/ascription/issue-47666.stderr2
-rw-r--r--src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr2
-rw-r--r--src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr2
-rw-r--r--src/test/ui/union/union-derive-clone.stderr1
-rw-r--r--src/test/ui/union/union-derive-eq.stderr1
-rw-r--r--src/test/ui/unreachable-code-ret.stderr2
-rw-r--r--src/test/ui/unused/unused-macro-rules.stderr2
-rw-r--r--src/test/ui/while-let.stderr3
m---------src/tools/miri16
-rw-r--r--src/tools/rustbook/Cargo.toml3
-rw-r--r--src/tools/rustbook/src/main.rs72
489 files changed, 3440 insertions, 1045 deletions
diff --git a/.github/ISSUE_TEMPLATE/blank_issue.md b/.github/ISSUE_TEMPLATE/blank_issue.md
new file mode 100644
index 00000000000..9aef3ebe637
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/blank_issue.md
@@ -0,0 +1,4 @@
+---
+name: Blank Issue
+about: Create a blank issue.
+---
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000000..5675579bc96
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,44 @@
+---
+name: Bug Report
+about: Create a bug report for Rust.
+labels: C-bug
+---
+<!--
+Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
+along with any information you feel relevant to replicating the bug.
+-->
+
+I tried this code:
+
+```rust
+<code>
+```
+
+I expected to see this happen: *explanation*
+
+Instead, this happened: *explanation*
+
+### Meta
+<!--
+If you're using the stable version of the compiler, you should also check if the
+bug also exists in the beta or nightly versions.
+-->
+
+`rustc --version --verbose`:
+```
+<version>
+```
+
+<!--
+Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
+environment. E.g. `RUST_BACKTRACE=1 cargo build`.
+-->
+<details><summary>Backtrace</summary>
+<p>
+
+```
+<backtrace>
+```
+
+</p>
+</details>
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000000..bd7dc0ac95c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: true
+contact_links:
+  - name: Rust Programming Language Forum
+    url: https://users.rust-lang.org
+    about: Please ask and answer questions about Rust here.
diff --git a/.github/ISSUE_TEMPLATE/ice.md b/.github/ISSUE_TEMPLATE/ice.md
new file mode 100644
index 00000000000..e669e4912f8
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/ice.md
@@ -0,0 +1,52 @@
+---
+name: Internal Compiler Error
+about: Create a report for an internal compiler error in rustc.
+labels: C-bug, I-ICE, T-compiler
+---
+<!--
+Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
+a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
+how to create smaller examples.
+
+http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
+
+-->
+
+### Code
+
+```
+<code>
+```
+
+
+### Meta
+<!--
+If you're using the stable version of the compiler, you should also check if the
+bug also exists in the beta or nightly versions.
+-->
+
+`rustc --version --verbose`:
+```
+<version>
+```
+
+### Error output
+
+```
+<output>
+```
+
+<!--
+Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
+environment. E.g. `RUST_BACKTRACE=1 cargo build`.
+-->
+<details><summary><strong>Backtrace</strong></summary>
+<p>
+
+```
+<backtrace>
+```
+
+</p>
+</details>
+
diff --git a/.github/ISSUE_TEMPLATE/tracking_issue.md b/.github/ISSUE_TEMPLATE/tracking_issue.md
new file mode 100644
index 00000000000..f93591204cd
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/tracking_issue.md
@@ -0,0 +1,58 @@
+---
+name: Tracking Issue
+about: A tracking issue for a feature in Rust.
+title: Tracking Issue for XXX
+labels: C-tracking-issue
+---
+<!--
+Thank you for creating a tracking issue! 📜 Tracking issues are for tracking a
+feature from implementation to stabilisation. Make sure to include the relevant
+RFC for the feature if it has one. Otherwise provide a short summary of the
+feature and link any relevant PRs or issues, and remove any sections that are
+not relevant to the feature.
+
+Remember to add team labels to the tracking issue.
+For a language team feature, this would e.g., be `T-lang`.
+Such a feature should also be labeled with e.g., `F-my_feature`.
+This label is used to associate issues (e.g., bugs and design questions) to the feature.
+-->
+
+This is a tracking issue for the RFC "XXX" (rust-lang/rfcs#NNN).
+The feature gate for the issue is `#![feature(FFF)]`.
+
+### About tracking issues
+
+Tracking issues are used to record the overall progress of implementation.
+They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
+A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
+Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
+
+### Steps
+<!--
+Include each step required to complete the feature. Typically this is a PR
+implementing a feature, followed by a PR that stabilises the feature. However
+for larger features an implementation could be broken up into multiple PRs.
+-->
+
+- [ ] Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
+      instructions?)
+- [ ] Adjust documentation ([see instructions on rustc-guide][doc-guide])
+- [ ] Stabilization PR ([see instructions on rustc-guide][stabilization-guide])
+
+[stabilization-guide]: https://rust-lang.github.io/rustc-guide/stabilization_guide.html#stabilization-pr
+[doc-guide]: https://rust-lang.github.io/rustc-guide/stabilization_guide.html#documentation-prs
+
+### Unresolved Questions
+<!--
+Include any open questions that need to be answered before the feature can be
+stabilised.
+-->
+
+XXX --- list all the "unresolved questions" found in the RFC to ensure they are
+not forgotten
+
+### Implementation history
+
+<!--
+Include a list of all the PRs that were involved in implementing the feature.
+-->
diff --git a/.mailmap b/.mailmap
index 6ab6be26cf1..14797092475 100644
--- a/.mailmap
+++ b/.mailmap
@@ -100,6 +100,7 @@ Graydon Hoare <graydon@pobox.com> Graydon Hoare <graydon@mozilla.com>
 Guillaume Gomez <guillaume1.gomez@gmail.com>
 Guillaume Gomez <guillaume1.gomez@gmail.com> ggomez <ggomez@ggo.ifr.lan>
 Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <ggomez@ggo.ifr.lan>
+Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
 Heather <heather@cynede.net> <Cynede@Gentoo.org>
 Heather <heather@cynede.net> <Heather@cynede.net>
 Herman J. Radtke III <herman@hermanradtke.com> Herman J. Radtke III <hermanradtke@gmail.com>
diff --git a/Cargo.lock b/Cargo.lock
index ec976b69016..bbfda0fa2c8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3067,6 +3067,7 @@ name = "rustbook"
 version = "0.1.0"
 dependencies = [
  "clap",
+ "codespan",
  "codespan-reporting",
  "failure",
  "mdbook",
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 18f6fda7608..d12ee2935eb 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -847,7 +847,13 @@ impl<'a> Builder<'a> {
             rustflags.arg("-Zforce-unstable-if-unmarked");
         }
 
-        rustflags.arg("-Zexternal-macro-backtrace");
+        // cfg(bootstrap): the flag was renamed from `-Zexternal-macro-backtrace`
+        // to `-Zmacro-backtrace`, keep only the latter after beta promotion.
+        if stage == 0 {
+            rustflags.arg("-Zexternal-macro-backtrace");
+        } else {
+            rustflags.arg("-Zmacro-backtrace");
+        }
 
         let want_rustdoc = self.doc_tests != DocTests::No;
 
diff --git a/src/doc/rustc-guide b/src/doc/rustc-guide
-Subproject 92baf7293dd2d418d2ac4b141b0faa822075d9f
+Subproject 5bd60bc51efaec04e69e2e18b59678e2af06643
diff --git a/src/doc/unstable-book/src/language-features/generators.md b/src/doc/unstable-book/src/language-features/generators.md
index 97cf58e57e6..8bc62418b39 100644
--- a/src/doc/unstable-book/src/language-features/generators.md
+++ b/src/doc/unstable-book/src/language-features/generators.md
@@ -37,11 +37,11 @@ fn main() {
         return "foo"
     };
 
-    match Pin::new(&mut generator).resume() {
+    match Pin::new(&mut generator).resume(()) {
         GeneratorState::Yielded(1) => {}
         _ => panic!("unexpected value from resume"),
     }
-    match Pin::new(&mut generator).resume() {
+    match Pin::new(&mut generator).resume(()) {
         GeneratorState::Complete("foo") => {}
         _ => panic!("unexpected value from resume"),
     }
@@ -71,9 +71,9 @@ fn main() {
     };
 
     println!("1");
-    Pin::new(&mut generator).resume();
+    Pin::new(&mut generator).resume(());
     println!("3");
-    Pin::new(&mut generator).resume();
+    Pin::new(&mut generator).resume(());
     println!("5");
 }
 ```
@@ -92,10 +92,10 @@ The `Generator` trait in `std::ops` currently looks like:
 # use std::ops::GeneratorState;
 # use std::pin::Pin;
 
-pub trait Generator {
+pub trait Generator<R = ()> {
     type Yield;
     type Return;
-    fn resume(self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return>;
+    fn resume(self: Pin<&mut Self>, resume: R) -> GeneratorState<Self::Yield, Self::Return>;
 }
 ```
 
@@ -152,10 +152,6 @@ closure-like semantics. Namely:
 * Whenever a generator is dropped it will drop all captured environment
   variables.
 
-Note that unlike closures, generators at this time cannot take any arguments.
-That is, generators must always look like `|| { ... }`. This restriction may be
-lifted at a future date, the design is ongoing!
-
 ### Generators as state machines
 
 In the compiler, generators are currently compiled as state machines. Each
@@ -179,8 +175,8 @@ fn main() {
         return ret
     };
 
-    Pin::new(&mut generator).resume();
-    Pin::new(&mut generator).resume();
+    Pin::new(&mut generator).resume(());
+    Pin::new(&mut generator).resume(());
 }
 ```
 
@@ -205,7 +201,7 @@ fn main() {
             type Yield = i32;
             type Return = &'static str;
 
-            fn resume(mut self: Pin<&mut Self>) -> GeneratorState<i32, &'static str> {
+            fn resume(mut self: Pin<&mut Self>, resume: ()) -> GeneratorState<i32, &'static str> {
                 use std::mem;
                 match mem::replace(&mut *self, __Generator::Done) {
                     __Generator::Start(s) => {
@@ -228,8 +224,8 @@ fn main() {
         __Generator::Start(ret)
     };
 
-    Pin::new(&mut generator).resume();
-    Pin::new(&mut generator).resume();
+    Pin::new(&mut generator).resume(());
+    Pin::new(&mut generator).resume(());
 }
 ```
 
diff --git a/src/doc/unstable-book/src/language-features/no-sanitize.md b/src/doc/unstable-book/src/language-features/no-sanitize.md
new file mode 100644
index 00000000000..28c683934d4
--- /dev/null
+++ b/src/doc/unstable-book/src/language-features/no-sanitize.md
@@ -0,0 +1,29 @@
+# `no_sanitize`
+
+The tracking issue for this feature is: [#39699]
+
+[#39699]: https://github.com/rust-lang/rust/issues/39699
+
+------------------------
+
+The `no_sanitize` attribute can be used to selectively disable sanitizer
+instrumentation in an annotated function. This might be useful to: avoid
+instrumentation overhead in a performance critical function, or avoid
+instrumenting code that contains constructs unsupported by given sanitizer.
+
+The precise effect of this annotation depends on particular sanitizer in use.
+For example, with `no_sanitize(thread)`, the thread sanitizer will no longer
+instrument non-atomic store / load operations, but it will instrument atomic
+operations to avoid reporting false positives and provide meaning full stack
+traces.
+
+## Examples
+
+``` rust
+#![feature(no_sanitize)]
+
+#[no_sanitize(address)]
+fn foo() {
+  // ...
+}
+```
diff --git a/src/liballoc/benches/btree/map.rs b/src/liballoc/benches/btree/map.rs
index ea69769279f..83cdebf0e3f 100644
--- a/src/liballoc/benches/btree/map.rs
+++ b/src/liballoc/benches/btree/map.rs
@@ -1,5 +1,6 @@
 use std::collections::BTreeMap;
 use std::iter::Iterator;
+use std::ops::Bound::{Excluded, Unbounded};
 use std::vec::Vec;
 
 use rand::{seq::SliceRandom, thread_rng, Rng};
@@ -200,3 +201,58 @@ pub fn first_and_last_100(b: &mut Bencher) {
 pub fn first_and_last_10k(b: &mut Bencher) {
     bench_first_and_last(b, 10_000);
 }
+
+#[bench]
+pub fn range_excluded_excluded(b: &mut Bencher) {
+    let size = 144;
+    let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
+    b.iter(|| {
+        for first in 0..size {
+            for last in first + 1..size {
+                black_box(map.range((Excluded(first), Excluded(last))));
+            }
+        }
+    });
+}
+
+#[bench]
+pub fn range_excluded_unbounded(b: &mut Bencher) {
+    let size = 144;
+    let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
+    b.iter(|| {
+        for first in 0..size {
+            black_box(map.range((Excluded(first), Unbounded)));
+        }
+    });
+}
+
+#[bench]
+pub fn range_included_included(b: &mut Bencher) {
+    let size = 144;
+    let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
+    b.iter(|| {
+        for first in 0..size {
+            for last in first..size {
+                black_box(map.range(first..=last));
+            }
+        }
+    });
+}
+
+#[bench]
+pub fn range_included_unbounded(b: &mut Bencher) {
+    let size = 144;
+    let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
+    b.iter(|| {
+        for first in 0..size {
+            black_box(map.range(first..));
+        }
+    });
+}
+
+#[bench]
+pub fn range_unbounded_unbounded(b: &mut Bencher) {
+    let size = 144;
+    let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
+    b.iter(|| map.range(..));
+}
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 7e5efbe3078..d65aee09232 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -1104,6 +1104,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> {
 #[stable(feature = "pin", since = "1.33.0")]
 impl<T: ?Sized> Unpin for Box<T> {}
 
+#[cfg(bootstrap)]
 #[unstable(feature = "generator_trait", issue = "43122")]
 impl<G: ?Sized + Generator + Unpin> Generator for Box<G> {
     type Yield = G::Yield;
@@ -1114,6 +1115,7 @@ impl<G: ?Sized + Generator + Unpin> Generator for Box<G> {
     }
 }
 
+#[cfg(bootstrap)]
 #[unstable(feature = "generator_trait", issue = "43122")]
 impl<G: ?Sized + Generator> Generator for Pin<Box<G>> {
     type Yield = G::Yield;
@@ -1124,6 +1126,28 @@ impl<G: ?Sized + Generator> Generator for Pin<Box<G>> {
     }
 }
 
+#[cfg(not(bootstrap))]
+#[unstable(feature = "generator_trait", issue = "43122")]
+impl<G: ?Sized + Generator<R> + Unpin, R> Generator<R> for Box<G> {
+    type Yield = G::Yield;
+    type Return = G::Return;
+
+    fn resume(mut self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return> {
+        G::resume(Pin::new(&mut *self), arg)
+    }
+}
+
+#[cfg(not(bootstrap))]
+#[unstable(feature = "generator_trait", issue = "43122")]
+impl<G: ?Sized + Generator<R>, R> Generator<R> for Pin<Box<G>> {
+    type Yield = G::Yield;
+    type Return = G::Return;
+
+    fn resume(mut self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return> {
+        G::resume((*self).as_mut(), arg)
+    }
+}
+
 #[stable(feature = "futures_api", since = "1.36.0")]
 impl<F: ?Sized + Future + Unpin> Future for Box<F> {
     type Output = F::Output;
diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs
index 8eabc177304..0b3f603686d 100644
--- a/src/liballoc/collections/btree/map.rs
+++ b/src/liballoc/collections/btree/map.rs
@@ -1861,65 +1861,51 @@ where
     let mut max_node = root2;
     let mut min_found = false;
     let mut max_found = false;
-    let mut diverged = false;
 
     loop {
-        let min_edge = match (min_found, range.start_bound()) {
-            (false, Included(key)) => match search::search_linear(&min_node, key) {
-                (i, true) => {
+        let front = match (min_found, range.start_bound()) {
+            (false, Included(key)) => match search::search_node(min_node, key) {
+                Found(kv) => {
                     min_found = true;
-                    i
+                    kv.left_edge()
                 }
-                (i, false) => i,
+                GoDown(edge) => edge,
             },
-            (false, Excluded(key)) => match search::search_linear(&min_node, key) {
-                (i, true) => {
+            (false, Excluded(key)) => match search::search_node(min_node, key) {
+                Found(kv) => {
                     min_found = true;
-                    i + 1
+                    kv.right_edge()
                 }
-                (i, false) => i,
+                GoDown(edge) => edge,
             },
-            (_, Unbounded) => 0,
-            (true, Included(_)) => min_node.len(),
-            (true, Excluded(_)) => 0,
+            (true, Included(_)) => min_node.last_edge(),
+            (true, Excluded(_)) => min_node.first_edge(),
+            (_, Unbounded) => min_node.first_edge(),
         };
 
-        let max_edge = match (max_found, range.end_bound()) {
-            (false, Included(key)) => match search::search_linear(&max_node, key) {
-                (i, true) => {
+        let back = match (max_found, range.end_bound()) {
+            (false, Included(key)) => match search::search_node(max_node, key) {
+                Found(kv) => {
                     max_found = true;
-                    i + 1
+                    kv.right_edge()
                 }
-                (i, false) => i,
+                GoDown(edge) => edge,
             },
-            (false, Excluded(key)) => match search::search_linear(&max_node, key) {
-                (i, true) => {
+            (false, Excluded(key)) => match search::search_node(max_node, key) {
+                Found(kv) => {
                     max_found = true;
-                    i
+                    kv.left_edge()
                 }
-                (i, false) => i,
+                GoDown(edge) => edge,
             },
-            (_, Unbounded) => max_node.len(),
-            (true, Included(_)) => 0,
-            (true, Excluded(_)) => max_node.len(),
+            (true, Included(_)) => max_node.first_edge(),
+            (true, Excluded(_)) => max_node.last_edge(),
+            (_, Unbounded) => max_node.last_edge(),
         };
 
-        if !diverged {
-            if max_edge < min_edge {
-                panic!("Ord is ill-defined in BTreeMap range")
-            }
-            if min_edge != max_edge {
-                diverged = true;
-            }
+        if front.partial_cmp(&back) == Some(Ordering::Greater) {
+            panic!("Ord is ill-defined in BTreeMap range");
         }
-
-        // Safety guarantee: `min_edge` is always in range for `min_node`, because
-        // `min_edge` is unconditionally calculated for each iteration's value of `min_node`,
-        // either (if not found) as the edge index returned by `search_linear`,
-        // or (if found) as the KV index returned by `search_linear`, possibly + 1.
-        // Likewise for `max_node` versus `max_edge`.
-        let front = unsafe { Handle::new_edge(min_node, min_edge) };
-        let back = unsafe { Handle::new_edge(max_node, max_edge) };
         match (front.force(), back.force()) {
             (Leaf(f), Leaf(b)) => {
                 return (f, b);
diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs
index e4123c9a20b..abf926186e8 100644
--- a/src/liballoc/collections/btree/node.rs
+++ b/src/liballoc/collections/btree/node.rs
@@ -31,6 +31,7 @@
 // - A node of length `n` has `n` keys, `n` values, and (in an internal node) `n + 1` edges.
 //   This implies that even an empty internal node has at least one edge.
 
+use core::cmp::Ordering;
 use core::marker::PhantomData;
 use core::mem::{self, MaybeUninit};
 use core::ptr::{self, NonNull, Unique};
@@ -832,6 +833,14 @@ impl<BorrowType, K, V, NodeType, HandleType> PartialEq
     }
 }
 
+impl<BorrowType, K, V, NodeType, HandleType> PartialOrd
+    for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
+{
+    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+        if self.node.node == other.node.node { Some(self.idx.cmp(&other.idx)) } else { None }
+    }
+}
+
 impl<BorrowType, K, V, NodeType, HandleType>
     Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
 {
diff --git a/src/liballoc/collections/btree/search.rs b/src/liballoc/collections/btree/search.rs
index e680e364147..2ba5cebbdee 100644
--- a/src/liballoc/collections/btree/search.rs
+++ b/src/liballoc/collections/btree/search.rs
@@ -10,6 +10,10 @@ pub enum SearchResult<BorrowType, K, V, FoundType, GoDownType> {
     GoDown(Handle<NodeRef<BorrowType, K, V, GoDownType>, marker::Edge>),
 }
 
+/// Looks up a given key in a (sub)tree headed by the given node, recursively.
+/// Returns a `Found` with the handle of the matching KV, if any. Otherwise,
+/// returns a `GoDown` with the handle of the possible leaf edge where the key
+/// belongs.
 pub fn search_tree<BorrowType, K, V, Q: ?Sized>(
     mut node: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
     key: &Q,
@@ -32,6 +36,10 @@ where
     }
 }
 
+/// Looks up a given key in a given node, without recursion.
+/// Returns a `Found` with the handle of the matching KV, if any. Otherwise,
+/// returns a `GoDown` with the handle of the edge where the key might be found.
+/// If the node is a leaf, a `GoDown` edge is not an actual edge but a possible edge.
 pub fn search_node<BorrowType, K, V, Type, Q: ?Sized>(
     node: NodeRef<BorrowType, K, V, Type>,
     key: &Q,
@@ -50,8 +58,8 @@ where
 /// or could exist, and whether it exists in the node itself. If it doesn't
 /// exist in the node itself, it may exist in the subtree with that index
 /// (if the node has subtrees). If the key doesn't exist in node or subtree,
-/// the returned index is the position or subtree to insert at.
-pub fn search_linear<BorrowType, K, V, Type, Q: ?Sized>(
+/// the returned index is the position or subtree where the key belongs.
+fn search_linear<BorrowType, K, V, Type, Q: ?Sized>(
     node: &NodeRef<BorrowType, K, V, Type>,
     key: &Q,
 ) -> (usize, bool)
diff --git a/src/libcore/ops/generator.rs b/src/libcore/ops/generator.rs
index 5401fff860e..4e43561996c 100644
--- a/src/libcore/ops/generator.rs
+++ b/src/libcore/ops/generator.rs
@@ -50,11 +50,11 @@ pub enum GeneratorState<Y, R> {
 ///         return "foo"
 ///     };
 ///
-///     match Pin::new(&mut generator).resume() {
+///     match Pin::new(&mut generator).resume(()) {
 ///         GeneratorState::Yielded(1) => {}
 ///         _ => panic!("unexpected return from resume"),
 ///     }
-///     match Pin::new(&mut generator).resume() {
+///     match Pin::new(&mut generator).resume(()) {
 ///         GeneratorState::Complete("foo") => {}
 ///         _ => panic!("unexpected return from resume"),
 ///     }
@@ -67,7 +67,7 @@ pub enum GeneratorState<Y, R> {
 #[lang = "generator"]
 #[unstable(feature = "generator_trait", issue = "43122")]
 #[fundamental]
-pub trait Generator {
+pub trait Generator<#[cfg(not(bootstrap))] R = ()> {
     /// The type of value this generator yields.
     ///
     /// This associated type corresponds to the `yield` expression and the
@@ -110,9 +110,13 @@ pub trait Generator {
     /// been returned previously. While generator literals in the language are
     /// guaranteed to panic on resuming after `Complete`, this is not guaranteed
     /// for all implementations of the `Generator` trait.
-    fn resume(self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return>;
+    fn resume(
+        self: Pin<&mut Self>,
+        #[cfg(not(bootstrap))] arg: R,
+    ) -> GeneratorState<Self::Yield, Self::Return>;
 }
 
+#[cfg(bootstrap)]
 #[unstable(feature = "generator_trait", issue = "43122")]
 impl<G: ?Sized + Generator> Generator for Pin<&mut G> {
     type Yield = G::Yield;
@@ -123,6 +127,7 @@ impl<G: ?Sized + Generator> Generator for Pin<&mut G> {
     }
 }
 
+#[cfg(bootstrap)]
 #[unstable(feature = "generator_trait", issue = "43122")]
 impl<G: ?Sized + Generator + Unpin> Generator for &mut G {
     type Yield = G::Yield;
@@ -132,3 +137,25 @@ impl<G: ?Sized + Generator + Unpin> Generator for &mut G {
         G::resume(Pin::new(&mut *self))
     }
 }
+
+#[cfg(not(bootstrap))]
+#[unstable(feature = "generator_trait", issue = "43122")]
+impl<G: ?Sized + Generator<R>, R> Generator<R> for Pin<&mut G> {
+    type Yield = G::Yield;
+    type Return = G::Return;
+
+    fn resume(mut self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return> {
+        G::resume((*self).as_mut(), arg)
+    }
+}
+
+#[cfg(not(bootstrap))]
+#[unstable(feature = "generator_trait", issue = "43122")]
+impl<G: ?Sized + Generator<R> + Unpin, R> Generator<R> for &mut G {
+    type Yield = G::Yield;
+    type Return = G::Return;
+
+    fn resume(mut self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return> {
+        G::resume(Pin::new(&mut *self), arg)
+    }
+}
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index ad0491f888c..e35c91206b8 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -455,6 +455,12 @@ impl<T> Option<T> {
     /// Applies a function to the contained value (if any),
     /// or returns the provided default (if not).
     ///
+    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing
+    /// the result of a function call, it is recommended to use [`map_or_else`],
+    /// which is lazily evaluated.
+    ///
+    /// [`map_or_else`]: #method.map_or_else
+    ///
     /// # Examples
     ///
     /// ```
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index bc70dbd62eb..809d4bace8e 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -524,6 +524,12 @@ impl<T, E> Result<T, E> {
     /// Applies a function to the contained value (if any),
     /// or returns the provided default (if not).
     ///
+    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing
+    /// the result of a function call, it is recommended to use [`map_or_else`],
+    /// which is lazily evaluated.
+    ///
+    /// [`map_or_else`]: #method.map_or_else
+    ///
     /// # Examples
     ///
     /// ```
diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs
index 92f5bf87535..dd242686d26 100644
--- a/src/librustc/arena.rs
+++ b/src/librustc/arena.rs
@@ -127,7 +127,7 @@ macro_rules! arena_types {
             [] tys: rustc::ty::TyS<$tcx>,
 
             // HIR types
-            [few] hir_forest: rustc::hir::map::Forest<$tcx>,
+            [few] hir_krate: rustc_hir::Crate<$tcx>,
             [] arm: rustc_hir::Arm<$tcx>,
             [] attribute: syntax::ast::Attribute,
             [] block: rustc_hir::Block<$tcx>,
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 9df8e28254c..29b94986a5f 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -35,7 +35,7 @@
 //! "infer" some properties for each kind of `DepNode`:
 //!
 //! * Whether a `DepNode` of a given kind has any parameters at all. Some
-//!   `DepNode`s, like `Krate`, represent global concepts with only one value.
+//!   `DepNode`s, like `AllLocalTraitImpls`, represent global concepts with only one value.
 //! * Whether it is possible, in principle, to reconstruct a query key from a
 //!   given `DepNode`. Many `DepKind`s only require a single `DefId` parameter,
 //!   in which case it is possible to map the node's fingerprint back to the
@@ -400,19 +400,6 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
     // We use this for most things when incr. comp. is turned off.
     [] Null,
 
-    // Represents the `Krate` as a whole (the `hir::Krate` value) (as
-    // distinct from the krate module). This is basically a hash of
-    // the entire krate, so if you read from `Krate` (e.g., by calling
-    // `tcx.hir().krate()`), we will have to assume that any change
-    // means that you need to be recompiled. This is because the
-    // `Krate` value gives you access to all other items. To avoid
-    // this fate, do not call `tcx.hir().krate()`; instead, prefer
-    // wrappers like `tcx.visit_all_items_in_krate()`.  If there is no
-    // suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain
-    // access to the krate, but you must remember to add suitable
-    // edges yourself for the individual items that you read.
-    [eval_always] Krate,
-
     // Represents the body of a function or method. The def-id is that of the
     // function/method.
     [eval_always] HirBody(DefId),
diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs
index b6be4bb0019..4c922654e02 100644
--- a/src/librustc/hir/map/collector.rs
+++ b/src/librustc/hir/map/collector.rs
@@ -223,12 +223,9 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
             (commandline_args_hash, crate_disambiguator.to_fingerprint()),
         );
 
-        let (_, crate_hash) = input_dep_node_and_hash(
-            self.dep_graph,
-            &mut self.hcx,
-            DepNode::new_no_params(DepKind::Krate),
-            crate_hash_input,
-        );
+        let mut stable_hasher = StableHasher::new();
+        crate_hash_input.hash_stable(&mut self.hcx, &mut stable_hasher);
+        let crate_hash: Fingerprint = stable_hasher.finish();
 
         let svh = Svh::new(crate_hash.to_smaller_hash());
         (self.map, svh)
diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs
index 76e42b8af28..c721faafbec 100644
--- a/src/librustc/hir/map/hir_id_validator.rs
+++ b/src/librustc/hir/map/hir_id_validator.rs
@@ -12,7 +12,7 @@ pub fn check_crate(hir_map: &Map<'_>) {
 
     let errors = Lock::new(Vec::new());
 
-    par_iter(&hir_map.krate().modules).for_each(|(module_id, _)| {
+    par_iter(&hir_map.krate.modules).for_each(|(module_id, _)| {
         let local_def_id = hir_map.local_def_id(*module_id);
         hir_map.visit_item_likes_in_module(
             local_def_id,
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 6d7f53133a6..1645420892a 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -129,30 +129,6 @@ impl<'hir> Entry<'hir> {
     }
 }
 
-/// Stores a crate and any number of inlined items from other crates.
-pub struct Forest<'hir> {
-    krate: Crate<'hir>,
-    pub dep_graph: DepGraph,
-}
-
-impl Forest<'hir> {
-    pub fn new(krate: Crate<'hir>, dep_graph: &DepGraph) -> Forest<'hir> {
-        Forest { krate, dep_graph: dep_graph.clone() }
-    }
-
-    pub fn krate(&self) -> &Crate<'hir> {
-        self.dep_graph.read(DepNode::new_no_params(DepKind::Krate));
-        &self.krate
-    }
-
-    /// This is used internally in the dependency tracking system.
-    /// Use the `krate` method to ensure your dependency on the
-    /// crate is tracked.
-    pub fn untracked_krate(&self) -> &Crate<'hir> {
-        &self.krate
-    }
-}
-
 /// This type is effectively a `HashMap<HirId, Entry<'hir>>`,
 /// but it is implemented as 2 layers of arrays.
 /// - first we have `A = IndexVec<DefIndex, B>` mapping `DefIndex`s to an inner value
@@ -162,11 +138,8 @@ pub(super) type HirEntryMap<'hir> = IndexVec<DefIndex, IndexVec<ItemLocalId, Opt
 /// Represents a mapping from `NodeId`s to AST elements and their parent `NodeId`s.
 #[derive(Clone)]
 pub struct Map<'hir> {
-    /// The backing storage for all the AST nodes.
-    pub forest: &'hir Forest<'hir>,
+    krate: &'hir Crate<'hir>,
 
-    /// Same as the dep_graph in forest, just available with one fewer
-    /// deref. This is a gratuitous micro-optimization.
     pub dep_graph: DepGraph,
 
     /// The SVH of the local crate.
@@ -217,6 +190,13 @@ impl<'hir> Iterator for ParentHirIterator<'_, 'hir> {
 }
 
 impl<'hir> Map<'hir> {
+    /// This is used internally in the dependency tracking system.
+    /// Use the `krate` method to ensure your dependency on the
+    /// crate is tracked.
+    pub fn untracked_krate(&self) -> &Crate<'hir> {
+        &self.krate
+    }
+
     #[inline]
     fn lookup(&self, id: HirId) -> Option<&Entry<'hir>> {
         let local_map = self.map.get(id.owner)?;
@@ -401,40 +381,36 @@ impl<'hir> Map<'hir> {
         self.lookup(id).cloned()
     }
 
-    pub fn krate(&self) -> &'hir Crate<'hir> {
-        self.forest.krate()
-    }
-
     pub fn item(&self, id: HirId) -> &'hir Item<'hir> {
         self.read(id);
 
-        // N.B., intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.krate()` so that we
         // do not trigger a read of the whole krate here
-        self.forest.krate.item(id)
+        self.krate.item(id)
     }
 
     pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem<'hir> {
         self.read(id.hir_id);
 
-        // N.B., intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.krate()` so that we
         // do not trigger a read of the whole krate here
-        self.forest.krate.trait_item(id)
+        self.krate.trait_item(id)
     }
 
     pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem<'hir> {
         self.read(id.hir_id);
 
-        // N.B., intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.krate()` so that we
         // do not trigger a read of the whole krate here
-        self.forest.krate.impl_item(id)
+        self.krate.impl_item(id)
     }
 
     pub fn body(&self, id: BodyId) -> &'hir Body<'hir> {
         self.read(id.hir_id);
 
-        // N.B., intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.krate()` so that we
         // do not trigger a read of the whole krate here
-        self.forest.krate.body(id)
+        self.krate.body(id)
     }
 
     pub fn fn_decl_by_hir_id(&self, hir_id: HirId) -> Option<&'hir FnDecl<'hir>> {
@@ -530,9 +506,9 @@ impl<'hir> Map<'hir> {
     pub fn trait_impls(&self, trait_did: DefId) -> &'hir [HirId] {
         self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls));
 
-        // N.B., intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.krate()` so that we
         // do not trigger a read of the whole krate here
-        self.forest.krate.trait_impls.get(&trait_did).map_or(&[], |xs| &xs[..])
+        self.krate.trait_impls.get(&trait_did).map_or(&[], |xs| &xs[..])
     }
 
     /// Gets the attributes on the crate. This is preferable to
@@ -542,7 +518,7 @@ impl<'hir> Map<'hir> {
         let def_path_hash = self.definitions.def_path_hash(CRATE_DEF_INDEX);
 
         self.dep_graph.read(def_path_hash.to_dep_node(DepKind::Hir));
-        &self.forest.krate.attrs
+        &self.krate.attrs
     }
 
     pub fn get_module(&self, module: DefId) -> (&'hir Mod<'hir>, Span, HirId) {
@@ -550,7 +526,7 @@ impl<'hir> Map<'hir> {
         self.read(hir_id);
         match self.find_entry(hir_id).unwrap().node {
             Node::Item(&Item { span, kind: ItemKind::Mod(ref m), .. }) => (m, span, hir_id),
-            Node::Crate => (&self.forest.krate.module, self.forest.krate.span, hir_id),
+            Node::Crate => (&self.krate.module, self.krate.span, hir_id),
             node => panic!("not a module: {:?}", node),
         }
     }
@@ -567,7 +543,7 @@ impl<'hir> Map<'hir> {
         // in the expect_* calls the loops below
         self.read(hir_id);
 
-        let module = &self.forest.krate.modules[&hir_id];
+        let module = &self.krate.modules[&hir_id];
 
         for id in &module.items {
             visitor.visit_item(self.expect_item(*id));
@@ -984,7 +960,7 @@ impl<'hir> Map<'hir> {
             // Unit/tuple structs/variants take the attributes straight from
             // the struct/variant definition.
             Some(Node::Ctor(..)) => return self.attrs(self.get_parent_item(id)),
-            Some(Node::Crate) => Some(&self.forest.krate.attrs[..]),
+            Some(Node::Crate) => Some(&self.krate.attrs[..]),
             _ => None,
         };
         attrs.unwrap_or(&[])
@@ -1063,7 +1039,7 @@ impl<'hir> Map<'hir> {
             Some(Node::Visibility(v)) => bug!("unexpected Visibility {:?}", v),
             Some(Node::Local(local)) => local.span,
             Some(Node::MacroDef(macro_def)) => macro_def.span,
-            Some(Node::Crate) => self.forest.krate.span,
+            Some(Node::Crate) => self.krate.span,
             None => bug!("hir::map::Map::span: id not in map: {:?}", hir_id),
         }
     }
@@ -1231,7 +1207,8 @@ impl Named for ImplItem<'_> {
 pub fn map_crate<'hir>(
     sess: &rustc_session::Session,
     cstore: &CrateStoreDyn,
-    forest: &'hir Forest<'hir>,
+    krate: &'hir Crate<'hir>,
+    dep_graph: DepGraph,
     definitions: Definitions,
 ) -> Map<'hir> {
     let _prof_timer = sess.prof.generic_activity("build_hir_map");
@@ -1244,31 +1221,18 @@ pub fn map_crate<'hir>(
         .collect();
 
     let (map, crate_hash) = {
-        let hcx = crate::ich::StableHashingContext::new(sess, &forest.krate, &definitions, cstore);
-
-        let mut collector = NodeCollector::root(
-            sess,
-            &forest.krate,
-            &forest.dep_graph,
-            &definitions,
-            &hir_to_node_id,
-            hcx,
-        );
-        intravisit::walk_crate(&mut collector, &forest.krate);
+        let hcx = crate::ich::StableHashingContext::new(sess, krate, &definitions, cstore);
+
+        let mut collector =
+            NodeCollector::root(sess, krate, &dep_graph, &definitions, &hir_to_node_id, hcx);
+        intravisit::walk_crate(&mut collector, krate);
 
         let crate_disambiguator = sess.local_crate_disambiguator();
         let cmdline_args = sess.opts.dep_tracking_hash();
         collector.finalize_and_compute_crate_hash(crate_disambiguator, cstore, cmdline_args)
     };
 
-    let map = Map {
-        forest,
-        dep_graph: forest.dep_graph.clone(),
-        crate_hash,
-        map,
-        hir_to_node_id,
-        definitions,
-    };
+    let map = Map { krate, dep_graph, crate_hash, map, hir_to_node_id, definitions };
 
     sess.time("validate_HIR_map", || {
         hir_id_validator::check_crate(&map);
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 6275c0aabe8..2e7e8fdd724 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -7,7 +7,48 @@ pub mod exports;
 pub mod map;
 
 use crate::ty::query::Providers;
+use crate::ty::TyCtxt;
+use rustc_hir::def_id::LOCAL_CRATE;
+use rustc_hir::print;
+use rustc_hir::Crate;
+use std::ops::Deref;
+
+/// A wrapper type which allows you to access HIR.
+#[derive(Clone)]
+pub struct Hir<'tcx> {
+    tcx: TyCtxt<'tcx>,
+    map: &'tcx map::Map<'tcx>,
+}
+
+impl<'tcx> Hir<'tcx> {
+    pub fn krate(&self) -> &'tcx Crate<'tcx> {
+        self.tcx.hir_crate(LOCAL_CRATE)
+    }
+}
+
+impl<'tcx> Deref for Hir<'tcx> {
+    type Target = &'tcx map::Map<'tcx>;
+
+    #[inline(always)]
+    fn deref(&self) -> &Self::Target {
+        &self.map
+    }
+}
+
+impl<'hir> print::PpAnn for Hir<'hir> {
+    fn nested(&self, state: &mut print::State<'_>, nested: print::Nested) {
+        self.map.nested(state, nested)
+    }
+}
+
+impl<'tcx> TyCtxt<'tcx> {
+    #[inline(always)]
+    pub fn hir(self) -> Hir<'tcx> {
+        Hir { tcx: self, map: &self.hir_map }
+    }
+}
 
 pub fn provide(providers: &mut Providers<'_>) {
+    providers.hir_crate = |tcx, _| tcx.hir_map.untracked_krate();
     map::provide(providers);
 }
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs
index e1733794b8d..d1815d5e320 100644
--- a/src/librustc/ich/impls_syntax.rs
+++ b/src/librustc/ich/impls_syntax.rs
@@ -12,13 +12,6 @@ use smallvec::SmallVec;
 
 impl<'ctx> rustc_target::HashStableContext for StableHashingContext<'ctx> {}
 
-impl<'a> HashStable<StableHashingContext<'a>> for ast::Lifetime {
-    fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
-        self.id.hash_stable(hcx, hasher);
-        self.ident.hash_stable(hcx, hasher);
-    }
-}
-
 impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {
     fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
         if self.len() == 0 {
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs
index 6af0cee948d..844250f51a0 100644
--- a/src/librustc/ich/impls_ty.rs
+++ b/src/librustc/ich/impls_ty.rs
@@ -63,9 +63,12 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionKind {
     fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
         mem::discriminant(self).hash_stable(hcx, hasher);
         match *self {
-            ty::ReErased | ty::ReStatic | ty::ReEmpty => {
+            ty::ReErased | ty::ReStatic => {
                 // No variant fields to hash for these ...
             }
+            ty::ReEmpty(universe) => {
+                universe.hash_stable(hcx, hasher);
+            }
             ty::ReLateBound(db, ty::BrAnon(i)) => {
                 db.hash_stable(hcx, hasher);
                 i.hash_stable(hcx, hasher);
diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs
index b720168f356..48a6c6d7413 100644
--- a/src/librustc/infer/canonical/canonicalizer.rs
+++ b/src/librustc/infer/canonical/canonicalizer.rs
@@ -167,11 +167,17 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
         r: ty::Region<'tcx>,
     ) -> ty::Region<'tcx> {
         match r {
-            ty::ReFree(_) | ty::ReEmpty | ty::ReErased | ty::ReStatic | ty::ReEarlyBound(..) => r,
+            ty::ReFree(_)
+            | ty::ReErased
+            | ty::ReStatic
+            | ty::ReEmpty(ty::UniverseIndex::ROOT)
+            | ty::ReEarlyBound(..) => r,
+
             ty::RePlaceholder(placeholder) => canonicalizer.canonical_var_for_region(
                 CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderRegion(*placeholder) },
                 r,
             ),
+
             ty::ReVar(vid) => {
                 let universe = canonicalizer.region_var_universe(*vid);
                 canonicalizer.canonical_var_for_region(
@@ -179,6 +185,11 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse {
                     r,
                 )
             }
+
+            ty::ReEmpty(ui) => {
+                bug!("canonicalizing 'empty in universe {:?}", ui) // FIXME
+            }
+
             _ => {
                 // Other than `'static` or `'empty`, the query
                 // response should be executing in a fully
@@ -213,7 +224,7 @@ impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation {
         r: ty::Region<'tcx>,
     ) -> ty::Region<'tcx> {
         match r {
-            ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReErased | ty::ReEmpty | ty::ReStatic => r,
+            ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReErased | ty::ReStatic => r,
             ty::ReVar(_) => canonicalizer.canonical_var_for_region_in_root_universe(r),
             _ => {
                 // We only expect region names that the user can type.
@@ -320,8 +331,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
             | ty::ReEarlyBound(..)
             | ty::ReFree(_)
             | ty::ReScope(_)
+            | ty::ReEmpty(_)
             | ty::RePlaceholder(..)
-            | ty::ReEmpty
             | ty::ReErased => self.canonicalize_region_mode.canonicalize_free_region(self, r),
 
             ty::ReClosureBound(..) => {
diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs
index 5d765a2a3d3..2518805a1ec 100644
--- a/src/librustc/infer/combine.rs
+++ b/src/librustc/infer/combine.rs
@@ -577,7 +577,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
 
             ty::RePlaceholder(..)
             | ty::ReVar(..)
-            | ty::ReEmpty
+            | ty::ReEmpty(_)
             | ty::ReStatic
             | ty::ReScope(..)
             | ty::ReEarlyBound(..)
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index 58566bdcc35..57a52a991ed 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -138,7 +138,10 @@ pub(super) fn note_and_explain_region(
             msg_span_from_free_region(tcx, region)
         }
 
-        ty::ReEmpty => ("the empty lifetime".to_owned(), None),
+        ty::ReEmpty(ty::UniverseIndex::ROOT) => ("the empty lifetime".to_owned(), None),
+
+        // uh oh, hope no user ever sees THIS
+        ty::ReEmpty(ui) => (format!("the empty lifetime in universe {:?}", ui), None),
 
         ty::RePlaceholder(_) => (format!("any other region"), None),
 
@@ -181,7 +184,8 @@ fn msg_span_from_free_region(
             msg_span_from_early_bound_and_free_regions(tcx, region)
         }
         ty::ReStatic => ("the static lifetime".to_owned(), None),
-        ty::ReEmpty => ("an empty lifetime".to_owned(), None),
+        ty::ReEmpty(ty::UniverseIndex::ROOT) => ("an empty lifetime".to_owned(), None),
+        ty::ReEmpty(ui) => (format!("an empty lifetime in universe {:?}", ui), None),
         _ => bug!("{:?}", region),
     }
 }
@@ -375,6 +379,31 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                         }
                     }
 
+                    RegionResolutionError::UpperBoundUniverseConflict(
+                        _,
+                        _,
+                        var_universe,
+                        sup_origin,
+                        sup_r,
+                    ) => {
+                        assert!(sup_r.is_placeholder());
+
+                        // Make a dummy value for the "sub region" --
+                        // this is the initial value of the
+                        // placeholder. In practice, we expect more
+                        // tailored errors that don't really use this
+                        // value.
+                        let sub_r = self.tcx.mk_region(ty::ReEmpty(var_universe));
+
+                        self.report_placeholder_failure(
+                            region_scope_tree,
+                            sup_origin,
+                            sub_r,
+                            sup_r,
+                        )
+                        .emit();
+                    }
+
                     RegionResolutionError::MemberConstraintFailure {
                         opaque_type_def_id,
                         hidden_ty,
@@ -429,6 +458,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             RegionResolutionError::GenericBoundFailure(..) => true,
             RegionResolutionError::ConcreteFailure(..)
             | RegionResolutionError::SubSupConflict(..)
+            | RegionResolutionError::UpperBoundUniverseConflict(..)
             | RegionResolutionError::MemberConstraintFailure { .. } => false,
         };
 
@@ -443,6 +473,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             RegionResolutionError::ConcreteFailure(ref sro, _, _) => sro.span(),
             RegionResolutionError::GenericBoundFailure(ref sro, _, _) => sro.span(),
             RegionResolutionError::SubSupConflict(_, ref rvo, _, _, _, _) => rvo.span(),
+            RegionResolutionError::UpperBoundUniverseConflict(_, ref rvo, _, _, _) => rvo.span(),
             RegionResolutionError::MemberConstraintFailure { span, .. } => span,
         });
         errors
diff --git a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs
index 8f4c6439920..6a9fe19e1ac 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs
@@ -45,7 +45,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
     ///
     /// It will later be extended to trait objects.
     pub(super) fn try_report_anon_anon_conflict(&self) -> Option<ErrorReported> {
-        let (span, sub, sup) = self.regions();
+        let (span, sub, sup) = self.regions()?;
 
         // Determine whether the sub and sup consist of both anonymous (elided) regions.
         let anon_reg_sup = self.tcx().is_suitable_region(sup)?;
diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs
index 8749d6cd34b..b10a60ef6f1 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs
@@ -17,11 +17,6 @@ mod util;
 
 impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
     pub fn try_report_nice_region_error(&self, error: &RegionResolutionError<'tcx>) -> bool {
-        match *error {
-            ConcreteFailure(..) | SubSupConflict(..) => {}
-            _ => return false, // inapplicable
-        }
-
         if let Some(tables) = self.in_progress_tables {
             let tables = tables.borrow();
             NiceRegionError::new(self, error.clone(), Some(&tables)).try_report().is_some()
@@ -79,13 +74,14 @@ impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx> {
             .or_else(|| self.try_report_impl_not_conforming_to_trait())
     }
 
-    pub fn regions(&self) -> (Span, ty::Region<'tcx>, ty::Region<'tcx>) {
+    pub fn regions(&self) -> Option<(Span, ty::Region<'tcx>, ty::Region<'tcx>)> {
         match (&self.error, self.regions) {
-            (Some(ConcreteFailure(origin, sub, sup)), None) => (origin.span(), sub, sup),
-            (Some(SubSupConflict(_, _, origin, sub, _, sup)), None) => (origin.span(), sub, sup),
-            (None, Some((span, sub, sup))) => (span, sub, sup),
-            (Some(_), Some(_)) => panic!("incorrectly built NiceRegionError"),
-            _ => panic!("trying to report on an incorrect lifetime failure"),
+            (Some(ConcreteFailure(origin, sub, sup)), None) => Some((origin.span(), sub, sup)),
+            (Some(SubSupConflict(_, _, origin, sub, _, sup)), None) => {
+                Some((origin.span(), sub, sup))
+            }
+            (None, Some((span, sub, sup))) => Some((span, sub, sup)),
+            _ => None,
         }
     }
 }
diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
index df37f53606b..250dcff372c 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
@@ -9,7 +9,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
     /// When given a `ConcreteFailure` for a function with parameters containing a named region and
     /// an anonymous region, emit an descriptive diagnostic error.
     pub(super) fn try_report_named_anon_conflict(&self) -> Option<DiagnosticBuilder<'a>> {
-        let (span, sub, sup) = self.regions();
+        let (span, sub, sup) = self.regions()?;
 
         debug!(
             "try_report_named_anon_conflict(sub={:?}, sup={:?}, error={:?})",
diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs
index 7b31fe7cd7e..0b0bd61ce77 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs
@@ -107,6 +107,25 @@ impl NiceRegionError<'me, 'tcx> {
                 found.substs,
             )),
 
+            Some(RegionResolutionError::UpperBoundUniverseConflict(
+                vid,
+                _,
+                _,
+                SubregionOrigin::Subtype(box TypeTrace {
+                    cause,
+                    values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
+                }),
+                sup_placeholder @ ty::RePlaceholder(_),
+            )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait(
+                Some(self.tcx().mk_region(ty::ReVar(*vid))),
+                cause,
+                None,
+                Some(*sup_placeholder),
+                expected.def_id,
+                expected.substs,
+                found.substs,
+            )),
+
             Some(RegionResolutionError::ConcreteFailure(
                 SubregionOrigin::Subtype(box TypeTrace {
                     cause,
diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs
index 16087959972..cf61cac0ac4 100644
--- a/src/librustc/infer/freshen.rs
+++ b/src/librustc/infer/freshen.rs
@@ -130,7 +130,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
             | ty::ReScope(_)
             | ty::ReVar(_)
             | ty::RePlaceholder(..)
-            | ty::ReEmpty
+            | ty::ReEmpty(_)
             | ty::ReErased => {
                 // replace all free regions with 'erased
                 self.tcx().lifetimes.re_erased
diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs
index bbca4823431..d25d186f4d7 100644
--- a/src/librustc/infer/higher_ranked/mod.rs
+++ b/src/librustc/infer/higher_ranked/mod.rs
@@ -128,6 +128,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
         placeholder_map: &PlaceholderMap<'tcx>,
         snapshot: &CombinedSnapshot<'_, 'tcx>,
     ) -> RelateResult<'tcx, ()> {
+        // If the user gave `-Zno-leak-check`, or we have been
+        // configured to skip the leak check, then skip the leak check
+        // completely. The leak check is deprecated. Any legitimate
+        // subtyping errors that it would have caught will now be
+        // caught later on, during region checking. However, we
+        // continue to use it for a transition period.
+        if self.tcx.sess.opts.debugging_opts.no_leak_check || self.skip_leak_check.get() {
+            return Ok(());
+        }
+
         self.borrow_region_constraints().leak_check(
             self.tcx,
             overly_polymorphic,
diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs
index 4b1f8a5be14..e0a8c3b4e65 100644
--- a/src/librustc/infer/lexical_region_resolve/mod.rs
+++ b/src/librustc/infer/lexical_region_resolve/mod.rs
@@ -82,6 +82,16 @@ pub enum RegionResolutionError<'tcx> {
         Region<'tcx>,
     ),
 
+    /// Indicates a `'b: 'a` constraint where `'a` is in a universe that
+    /// cannot name the placeholder `'b`.
+    UpperBoundUniverseConflict(
+        RegionVid,
+        RegionVariableOrigin,
+        ty::UniverseIndex,     // the universe index of the region variable
+        SubregionOrigin<'tcx>, // cause of the constraint
+        Region<'tcx>,          // the placeholder `'b`
+    ),
+
     /// Indicates a failure of a `MemberConstraint`. These arise during
     /// impl trait processing explicitly -- basically, the impl trait's hidden type
     /// included some region that it was not supposed to.
@@ -149,7 +159,14 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
     fn construct_var_data(&self, tcx: TyCtxt<'tcx>) -> LexicalRegionResolutions<'tcx> {
         LexicalRegionResolutions {
             error_region: tcx.lifetimes.re_static,
-            values: IndexVec::from_elem_n(VarValue::Value(tcx.lifetimes.re_empty), self.num_vars()),
+            values: IndexVec::from_fn_n(
+                |vid| {
+                    let vid_universe = self.var_infos[vid].universe;
+                    let re_empty = tcx.mk_region(ty::ReEmpty(vid_universe));
+                    VarValue::Value(re_empty)
+                },
+                self.num_vars(),
+            ),
         }
     }
 
@@ -381,8 +398,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                 // This is a specialized version of the `lub_concrete_regions`
                 // check below for a common case, here purely as an
                 // optimization.
-                if let ReEmpty = a_region {
-                    return false;
+                let b_universe = self.var_infos[b_vid].universe;
+                if let ReEmpty(a_universe) = a_region {
+                    if *a_universe == b_universe {
+                        return false;
+                    }
                 }
 
                 let mut lub = self.lub_concrete_regions(a_region, cur_region);
@@ -399,7 +419,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                 // tighter bound than `'static`.
                 //
                 // (This might e.g. arise from being asked to prove `for<'a> { 'b: 'a }`.)
-                let b_universe = self.var_infos[b_vid].universe;
                 if let ty::RePlaceholder(p) = lub {
                     if b_universe.cannot_name(p.universe) {
                         lub = self.tcx().lifetimes.re_static;
@@ -420,12 +439,38 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
 
     /// True if `a <= b`, but not defined over inference variables.
     fn sub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> bool {
+        let tcx = self.tcx();
+        let sub_free_regions = |r1, r2| self.region_rels.free_regions.sub_free_regions(tcx, r1, r2);
+
+        // Check for the case where we know that `'b: 'static` -- in that case,
+        // `a <= b` for all `a`.
+        let b_free_or_static = self.region_rels.free_regions.is_free_or_static(b);
+        if b_free_or_static && sub_free_regions(tcx.lifetimes.re_static, b) {
+            return true;
+        }
+
+        // If both `a` and `b` are free, consult the declared
+        // relationships.  Note that this can be more precise than the
+        // `lub` relationship defined below, since sometimes the "lub"
+        // is actually the `postdom_upper_bound` (see
+        // `TransitiveRelation` for more details).
+        let a_free_or_static = self.region_rels.free_regions.is_free_or_static(a);
+        if a_free_or_static && b_free_or_static {
+            return sub_free_regions(a, b);
+        }
+
+        // For other cases, leverage the LUB code to find the LUB and
+        // check if it is equal to `b`.
         self.lub_concrete_regions(a, b) == b
     }
 
-    /// Returns the smallest region `c` such that `a <= c` and `b <= c`.
+    /// Returns the least-upper-bound of `a` and `b`; i.e., the
+    /// smallest region `c` such that `a <= c` and `b <= c`.
+    ///
+    /// Neither `a` nor `b` may be an inference variable (hence the
+    /// term "concrete regions").
     fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
-        match (a, b) {
+        let r = match (a, b) {
             (&ty::ReClosureBound(..), _)
             | (_, &ty::ReClosureBound(..))
             | (&ReLateBound(..), _)
@@ -435,14 +480,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                 bug!("cannot relate region: LUB({:?}, {:?})", a, b);
             }
 
-            (r @ &ReStatic, _) | (_, r @ &ReStatic) => {
-                r // nothing lives longer than static
-            }
-
-            (&ReEmpty, r) | (r, &ReEmpty) => {
-                r // everything lives longer than empty
-            }
-
             (&ReVar(v_id), _) | (_, &ReVar(v_id)) => {
                 span_bug!(
                     self.var_infos[v_id].origin.span(),
@@ -453,6 +490,41 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                 );
             }
 
+            (&ReStatic, _) | (_, &ReStatic) => {
+                // nothing lives longer than `'static`
+                self.tcx().lifetimes.re_static
+            }
+
+            (&ReEmpty(_), r @ ReEarlyBound(_))
+            | (r @ ReEarlyBound(_), &ReEmpty(_))
+            | (&ReEmpty(_), r @ ReFree(_))
+            | (r @ ReFree(_), &ReEmpty(_))
+            | (&ReEmpty(_), r @ ReScope(_))
+            | (r @ ReScope(_), &ReEmpty(_)) => {
+                // All empty regions are less than early-bound, free,
+                // and scope regions.
+                r
+            }
+
+            (&ReEmpty(a_ui), &ReEmpty(b_ui)) => {
+                // Empty regions are ordered according to the universe
+                // they are associated with.
+                let ui = a_ui.min(b_ui);
+                self.tcx().mk_region(ReEmpty(ui))
+            }
+
+            (&ReEmpty(empty_ui), &RePlaceholder(placeholder))
+            | (&RePlaceholder(placeholder), &ReEmpty(empty_ui)) => {
+                // If this empty region is from a universe that can
+                // name the placeholder, then the placeholder is
+                // larger; otherwise, the only ancestor is `'static`.
+                if empty_ui.can_name(placeholder.universe) {
+                    self.tcx().mk_region(RePlaceholder(placeholder))
+                } else {
+                    self.tcx().lifetimes.re_static
+                }
+            }
+
             (&ReEarlyBound(_), &ReScope(s_id))
             | (&ReScope(s_id), &ReEarlyBound(_))
             | (&ReFree(_), &ReScope(s_id))
@@ -509,7 +581,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                     self.tcx().lifetimes.re_static
                 }
             }
-        }
+        };
+
+        debug!("lub_concrete_regions({:?}, {:?}) = {:?}", a, b, r);
+
+        r
     }
 
     /// After expansion is complete, go and check upper bounds (i.e.,
@@ -528,7 +604,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                 }
 
                 Constraint::RegSubReg(sub, sup) => {
-                    if self.region_rels.is_subregion_of(sub, sup) {
+                    if self.sub_concrete_regions(sub, sup) {
                         continue;
                     }
 
@@ -557,7 +633,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                     // Do not report these errors immediately:
                     // instead, set the variable value to error and
                     // collect them later.
-                    if !self.region_rels.is_subregion_of(a_region, b_region) {
+                    if !self.sub_concrete_regions(a_region, b_region) {
                         debug!(
                             "collect_errors: region error at {:?}: \
                              cannot verify that {:?}={:?} <= {:?}",
@@ -592,12 +668,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
             debug!("collect_errors: verify={:?}", verify);
             let sub = var_data.normalize(self.tcx(), verify.region);
 
-            // This was an inference variable which didn't get
-            // constrained, therefore it can be assume to hold.
-            if let ty::ReEmpty = *sub {
-                continue;
-            }
-
             let verify_kind_ty = verify.kind.to_ty(self.tcx());
             if self.bound_is_met(&verify.bound, var_data, verify_kind_ty, sub) {
                 continue;
@@ -760,7 +830,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
             };
 
             for upper_bound in &upper_bounds {
-                if !self.region_rels.is_subregion_of(effective_lower_bound, upper_bound.region) {
+                if !self.sub_concrete_regions(effective_lower_bound, upper_bound.region) {
                     let origin = self.var_infos[node_idx].origin;
                     debug!(
                         "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
@@ -780,6 +850,26 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
             }
         }
 
+        // If we have a scenario like `exists<'a> { forall<'b> { 'b:
+        // 'a } }`, we wind up without any lower-bound -- all we have
+        // are placeholders as upper bounds, but the universe of the
+        // variable `'a` doesn't permit those placeholders.
+        for upper_bound in &upper_bounds {
+            if let ty::RePlaceholder(p) = upper_bound.region {
+                if node_universe.cannot_name(p.universe) {
+                    let origin = self.var_infos[node_idx].origin.clone();
+                    errors.push(RegionResolutionError::UpperBoundUniverseConflict(
+                        node_idx,
+                        origin,
+                        node_universe,
+                        upper_bound.origin.clone(),
+                        upper_bound.region,
+                    ));
+                    return;
+                }
+            }
+        }
+
         // Errors in earlier passes can yield error variables without
         // resolution errors here; delay ICE in favor of those errors.
         self.tcx().sess.delay_span_bug(
@@ -890,7 +980,15 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
             }
 
             VerifyBound::OutlivedBy(r) => {
-                self.region_rels.is_subregion_of(min, var_values.normalize(self.tcx(), r))
+                self.sub_concrete_regions(min, var_values.normalize(self.tcx(), r))
+            }
+
+            VerifyBound::IsEmpty => {
+                if let ty::ReEmpty(_) = min {
+                    true
+                } else {
+                    false
+                }
             }
 
             VerifyBound::AnyBound(bs) => {
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index 4681a47317c..b93f4408cdc 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -125,6 +125,13 @@ pub struct InferCtxt<'a, 'tcx> {
     /// order, represented by its upper and lower bounds.
     pub type_variables: RefCell<type_variable::TypeVariableTable<'tcx>>,
 
+    /// If set, this flag causes us to skip the 'leak check' during
+    /// higher-ranked subtyping operations. This flag is a temporary one used
+    /// to manage the removal of the leak-check: for the time being, we still run the
+    /// leak-check, but we issue warnings. This flag can only be set to true
+    /// when entering a snapshot.
+    skip_leak_check: Cell<bool>,
+
     /// Map from const parameter variable to the kind of const it represents.
     const_unification_table: RefCell<ut::UnificationTable<ut::InPlace<ty::ConstVid<'tcx>>>>,
 
@@ -246,7 +253,7 @@ pub enum ValuePairs<'tcx> {
 /// encounter an error or subtyping constraint.
 ///
 /// See the `error_reporting` module for more details.
-#[derive(Clone)]
+#[derive(Clone, Debug)]
 pub struct TypeTrace<'tcx> {
     cause: ObligationCause<'tcx>,
     values: ValuePairs<'tcx>,
@@ -550,6 +557,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
                 tainted_by_errors_flag: Cell::new(false),
                 err_count_on_creation: tcx.sess.err_count(),
                 in_snapshot: Cell::new(false),
+                skip_leak_check: Cell::new(false),
                 region_obligations: RefCell::new(vec![]),
                 universe: Cell::new(ty::UniverseIndex::ROOT),
             })
@@ -593,6 +601,7 @@ pub struct CombinedSnapshot<'a, 'tcx> {
     region_obligations_snapshot: usize,
     universe: ty::UniverseIndex,
     was_in_snapshot: bool,
+    was_skip_leak_check: bool,
     _in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
 }
 
@@ -720,6 +729,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             region_obligations_snapshot: self.region_obligations.borrow().len(),
             universe: self.universe(),
             was_in_snapshot: in_snapshot,
+            was_skip_leak_check: self.skip_leak_check.get(),
             // Borrow tables "in progress" (i.e., during typeck)
             // to ban writes from within a snapshot to them.
             _in_progress_tables: self.in_progress_tables.map(|tables| tables.borrow()),
@@ -738,11 +748,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             region_obligations_snapshot,
             universe,
             was_in_snapshot,
+            was_skip_leak_check,
             _in_progress_tables,
         } = snapshot;
 
         self.in_snapshot.set(was_in_snapshot);
         self.universe.set(universe);
+        self.skip_leak_check.set(was_skip_leak_check);
 
         self.projection_cache.borrow_mut().rollback_to(projection_cache_snapshot);
         self.type_variables.borrow_mut().rollback_to(type_snapshot);
@@ -765,10 +777,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             region_obligations_snapshot: _,
             universe: _,
             was_in_snapshot,
+            was_skip_leak_check,
             _in_progress_tables,
         } = snapshot;
 
         self.in_snapshot.set(was_in_snapshot);
+        self.skip_leak_check.set(was_skip_leak_check);
 
         self.projection_cache.borrow_mut().commit(projection_cache_snapshot);
         self.type_variables.borrow_mut().commit(type_snapshot);
@@ -822,6 +836,20 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
         r
     }
 
+    /// If `should_skip` is true, then execute `f` then unroll any bindings it creates.
+    pub fn probe_maybe_skip_leak_check<R, F>(&self, should_skip: bool, f: F) -> R
+    where
+        F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R,
+    {
+        debug!("probe()");
+        let snapshot = self.start_snapshot();
+        let skip_leak_check = should_skip || self.skip_leak_check.get();
+        self.skip_leak_check.set(skip_leak_check);
+        let r = f(&snapshot);
+        self.rollback_to("probe", snapshot);
+        r
+    }
+
     /// Scan the constraints produced since `snapshot` began and returns:
     ///
     /// - `None` -- if none of them involve "region outlives" constraints
@@ -1647,12 +1675,6 @@ impl<'tcx> TypeTrace<'tcx> {
     }
 }
 
-impl<'tcx> fmt::Debug for TypeTrace<'tcx> {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "TypeTrace({:?})", self.cause)
-    }
-}
-
 impl<'tcx> SubregionOrigin<'tcx> {
     pub fn span(&self) -> Span {
         match *self {
diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs
index fe3a5d149f6..7fef9d27c4d 100644
--- a/src/librustc/infer/opaque_types/mod.rs
+++ b/src/librustc/infer/opaque_types/mod.rs
@@ -384,9 +384,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             match least_region {
                 None => least_region = Some(subst_arg),
                 Some(lr) => {
-                    if free_region_relations.sub_free_regions(lr, subst_arg) {
+                    if free_region_relations.sub_free_regions(self.tcx, lr, subst_arg) {
                         // keep the current least region
-                    } else if free_region_relations.sub_free_regions(subst_arg, lr) {
+                    } else if free_region_relations.sub_free_regions(self.tcx, subst_arg, lr) {
                         // switch to `subst_arg`
                         least_region = Some(subst_arg);
                     } else {
@@ -611,7 +611,7 @@ pub fn unexpected_hidden_region_diagnostic(
     );
 
     // Explain the region we are capturing.
-    if let ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReStatic | ty::ReEmpty = hidden_region {
+    if let ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReStatic | ty::ReEmpty(_) = hidden_region {
         // Assuming regionck succeeded (*), we ought to always be
         // capturing *some* region from the fn header, and hence it
         // ought to be free. So under normal circumstances, we will go
@@ -744,6 +744,7 @@ where
 
                 substs.as_generator().return_ty(def_id, self.tcx).visit_with(self);
                 substs.as_generator().yield_ty(def_id, self.tcx).visit_with(self);
+                substs.as_generator().resume_ty(def_id, self.tcx).visit_with(self);
             }
             _ => {
                 ty.super_visit_with(self);
@@ -843,7 +844,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
                         .emit();
                     }
                 }
-                self.tcx.lifetimes.re_empty
+                self.tcx.lifetimes.re_root_empty
             }
             None => {
                 self.tcx
diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs
index 8ee8482e79d..a2c99064caa 100644
--- a/src/librustc/infer/outlives/verify.rs
+++ b/src/librustc/infer/outlives/verify.rs
@@ -60,7 +60,18 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
         // scope type parameters:
         let param_bounds = param_bounds.chain(self.implicit_region_bound);
 
-        VerifyBound::AnyBound(param_bounds.map(|r| VerifyBound::OutlivedBy(r)).collect())
+        let any_bounds: Vec<_> = param_bounds.map(|r| VerifyBound::OutlivedBy(r)).collect();
+
+        if any_bounds.is_empty() {
+            // We know that all types `T` outlive `'empty`, so if we
+            // can find no other bound, then check that the region
+            // being tested is `'empty`.
+            VerifyBound::IsEmpty
+        } else {
+            // If we can find any other bound `R` such that `T: R`, then
+            // we don't need to check for `'empty`, because `R: 'empty`.
+            VerifyBound::AnyBound(any_bounds)
+        }
     }
 
     /// Given a projection like `T::Item`, searches the environment
diff --git a/src/librustc/infer/region_constraints/leak_check.rs b/src/librustc/infer/region_constraints/leak_check.rs
index 3b3a464ba55..29290cef2d2 100644
--- a/src/librustc/infer/region_constraints/leak_check.rs
+++ b/src/librustc/infer/region_constraints/leak_check.rs
@@ -33,18 +33,6 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
 
         assert!(self.in_snapshot());
 
-        // If the user gave `-Zno-leak-check`, then skip the leak
-        // check completely. This is wildly unsound and also not
-        // unlikely to cause an ICE or two. It is intended for use
-        // only during a transition period, in which the MIR typeck
-        // uses the "universe-style" check, and the rest of typeck
-        // uses the more conservative leak check.  Since the leak
-        // check is more conservative, we can't test the
-        // universe-style check without disabling it.
-        if tcx.sess.opts.debugging_opts.no_leak_check {
-            return Ok(());
-        }
-
         // Go through each placeholder that we created.
         for (_, &placeholder_region) in placeholder_map {
             // Find the universe this placeholder inhabits.
diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs
index 410058b70b5..2c580e2e349 100644
--- a/src/librustc/infer/region_constraints/mod.rs
+++ b/src/librustc/infer/region_constraints/mod.rs
@@ -233,6 +233,9 @@ pub enum VerifyBound<'tcx> {
     /// if `R: min`, then by transitivity `G: min`.
     OutlivedBy(Region<'tcx>),
 
+    /// Given a region `R`, true if it is `'empty`.
+    IsEmpty,
+
     /// Given a set of bounds `B`, expands to the function:
     ///
     /// ```rust
@@ -792,10 +795,10 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
         match *region {
             ty::ReScope(..)
             | ty::ReStatic
-            | ty::ReEmpty
             | ty::ReErased
             | ty::ReFree(..)
             | ty::ReEarlyBound(..) => ty::UniverseIndex::ROOT,
+            ty::ReEmpty(ui) => ui,
             ty::RePlaceholder(placeholder) => placeholder.universe,
             ty::ReClosureBound(vid) | ty::ReVar(vid) => self.var_universe(vid),
             ty::ReLateBound(..) => bug!("universe(): encountered bound region {:?}", region),
@@ -867,6 +870,7 @@ impl<'tcx> VerifyBound<'tcx> {
             VerifyBound::IfEq(..) => false,
             VerifyBound::OutlivedBy(ty::ReStatic) => true,
             VerifyBound::OutlivedBy(_) => false,
+            VerifyBound::IsEmpty => false,
             VerifyBound::AnyBound(bs) => bs.iter().any(|b| b.must_hold()),
             VerifyBound::AllBounds(bs) => bs.iter().all(|b| b.must_hold()),
         }
@@ -875,7 +879,7 @@ impl<'tcx> VerifyBound<'tcx> {
     pub fn cannot_hold(&self) -> bool {
         match self {
             VerifyBound::IfEq(_, b) => b.cannot_hold(),
-            VerifyBound::OutlivedBy(ty::ReEmpty) => true,
+            VerifyBound::IsEmpty => false,
             VerifyBound::OutlivedBy(_) => false,
             VerifyBound::AnyBound(bs) => bs.iter().all(|b| b.cannot_hold()),
             VerifyBound::AllBounds(bs) => bs.iter().any(|b| b.cannot_hold()),
diff --git a/src/librustc/middle/codegen_fn_attrs.rs b/src/librustc/middle/codegen_fn_attrs.rs
index 9f8c2020861..82adcfddc28 100644
--- a/src/librustc/middle/codegen_fn_attrs.rs
+++ b/src/librustc/middle/codegen_fn_attrs.rs
@@ -72,6 +72,14 @@ bitflags! {
         const FFI_RETURNS_TWICE         = 1 << 10;
         /// `#[track_caller]`: allow access to the caller location
         const TRACK_CALLER              = 1 << 11;
+        /// `#[no_sanitize(address)]`: disables address sanitizer instrumentation
+        const NO_SANITIZE_ADDRESS = 1 << 12;
+        /// `#[no_sanitize(memory)]`: disables memory sanitizer instrumentation
+        const NO_SANITIZE_MEMORY  = 1 << 13;
+        /// `#[no_sanitize(thread)]`: disables thread sanitizer instrumentation
+        const NO_SANITIZE_THREAD  = 1 << 14;
+        /// All `#[no_sanitize(...)]` attributes.
+        const NO_SANITIZE_ANY = Self::NO_SANITIZE_ADDRESS.bits | Self::NO_SANITIZE_MEMORY.bits | Self::NO_SANITIZE_THREAD.bits;
     }
 }
 
diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs
index 355f949b870..62ccd946744 100644
--- a/src/librustc/middle/free_region.rs
+++ b/src/librustc/middle/free_region.rs
@@ -4,8 +4,8 @@
 //! and use that to decide when one free region outlives another, and so forth.
 
 use crate::middle::region;
-use crate::ty::free_region_map::{FreeRegionMap, FreeRegionRelations};
-use crate::ty::{self, Region, TyCtxt};
+use crate::ty::free_region_map::FreeRegionMap;
+use crate::ty::{Region, TyCtxt};
 use rustc_hir::def_id::DefId;
 
 /// Combines a `region::ScopeTree` (which governs relationships between
@@ -38,62 +38,6 @@ impl<'a, 'tcx> RegionRelations<'a, 'tcx> {
         Self { tcx, context, region_scope_tree, free_regions }
     }
 
-    /// Determines whether one region is a subregion of another. This is intended to run *after
-    /// inference* and sadly the logic is somewhat duplicated with the code in infer.rs.
-    pub fn is_subregion_of(
-        &self,
-        sub_region: ty::Region<'tcx>,
-        super_region: ty::Region<'tcx>,
-    ) -> bool {
-        let result = sub_region == super_region || {
-            match (sub_region, super_region) {
-                (ty::ReEmpty, _) | (_, ty::ReStatic) => true,
-
-                (ty::ReScope(sub_scope), ty::ReScope(super_scope)) => {
-                    self.region_scope_tree.is_subscope_of(*sub_scope, *super_scope)
-                }
-
-                (ty::ReScope(sub_scope), ty::ReEarlyBound(ref br)) => {
-                    let fr_scope = self.region_scope_tree.early_free_scope(self.tcx, br);
-                    self.region_scope_tree.is_subscope_of(*sub_scope, fr_scope)
-                }
-
-                (ty::ReScope(sub_scope), ty::ReFree(fr)) => {
-                    let fr_scope = self.region_scope_tree.free_scope(self.tcx, fr);
-                    self.region_scope_tree.is_subscope_of(*sub_scope, fr_scope)
-                }
-
-                (ty::ReEarlyBound(_), ty::ReEarlyBound(_))
-                | (ty::ReFree(_), ty::ReEarlyBound(_))
-                | (ty::ReEarlyBound(_), ty::ReFree(_))
-                | (ty::ReFree(_), ty::ReFree(_)) => {
-                    self.free_regions.sub_free_regions(sub_region, super_region)
-                }
-
-                _ => false,
-            }
-        };
-        let result = result || self.is_static(super_region);
-        debug!(
-            "is_subregion_of(sub_region={:?}, super_region={:?}) = {:?}",
-            sub_region, super_region, result
-        );
-        result
-    }
-
-    /// Determines whether this free region is required to be `'static`.
-    fn is_static(&self, super_region: ty::Region<'tcx>) -> bool {
-        debug!("is_static(super_region={:?})", super_region);
-        match *super_region {
-            ty::ReStatic => true,
-            ty::ReEarlyBound(_) | ty::ReFree(_) => {
-                let re_static = self.tcx.mk_region(ty::ReStatic);
-                self.free_regions.sub_free_regions(&re_static, &super_region)
-            }
-            _ => false,
-        }
-    }
-
     pub fn lub_free_regions(&self, r_a: Region<'tcx>, r_b: Region<'tcx>) -> Region<'tcx> {
         self.free_regions.lub_free_regions(self.tcx, r_a, r_b)
     }
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 4e9835a52b7..f6c7174649f 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -1120,6 +1120,8 @@ pub enum TerminatorKind<'tcx> {
         value: Operand<'tcx>,
         /// Where to resume to.
         resume: BasicBlock,
+        /// The place to store the resume argument in.
+        resume_arg: Place<'tcx>,
         /// Cleanup to be done if the generator is dropped at this suspend point.
         drop: Option<BasicBlock>,
     },
@@ -2645,9 +2647,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
                 target,
                 unwind,
             },
-            Yield { ref value, resume, drop } => {
-                Yield { value: value.fold_with(folder), resume: resume, drop: drop }
-            }
+            Yield { ref value, resume, ref resume_arg, drop } => Yield {
+                value: value.fold_with(folder),
+                resume,
+                resume_arg: resume_arg.fold_with(folder),
+                drop,
+            },
             Call { ref func, ref args, ref destination, cleanup, from_hir_call } => {
                 let dest =
                     destination.as_ref().map(|&(ref loc, dest)| (loc.fold_with(folder), dest));
diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs
index 4c5db1b07d2..2f094516a35 100644
--- a/src/librustc/mir/visit.rs
+++ b/src/librustc/mir/visit.rs
@@ -516,8 +516,14 @@ macro_rules! make_mir_visitor {
                     TerminatorKind::Yield {
                         value,
                         resume: _,
+                        resume_arg,
                         drop: _,
                     } => {
+                        self.visit_place(
+                            resume_arg,
+                            PlaceContext::MutatingUse(MutatingUseContext::Store),
+                            source_location,
+                        );
                         self.visit_operand(value, source_location);
                     }
 
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs
index 228271e0c4c..d1bccb961c4 100644
--- a/src/librustc/query/mod.rs
+++ b/src/librustc/query/mod.rs
@@ -43,6 +43,18 @@ rustc_queries! {
     }
 
     Other {
+        // Represents crate as a whole (as distinct from the top-level crate module).
+        // If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
+        // we will have to assume that any change means that you need to be recompiled.
+        // This is because the `hir_crate` query gives you access to all other items.
+        // To avoid this fate, do not call `tcx.hir().krate()`; instead,
+        // prefer wrappers like `tcx.visit_all_items_in_krate()`.
+        query hir_crate(key: CrateNum) -> &'tcx Crate<'tcx> {
+            eval_always
+            no_hash
+            desc { "get the crate HIR" }
+        }
+
         /// Records the type of every item.
         query type_of(key: DefId) -> Ty<'tcx> {
             cache_on_disk_if { key.is_local() }
diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs
index 29ea47809a0..855da0367de 100644
--- a/src/librustc/traits/coherence.rs
+++ b/src/librustc/traits/coherence.rs
@@ -7,6 +7,7 @@
 use crate::infer::{CombinedSnapshot, InferOk};
 use crate::traits::select::IntercrateAmbiguityCause;
 use crate::traits::IntercrateMode;
+use crate::traits::SkipLeakCheck;
 use crate::traits::{self, Normalized, Obligation, ObligationCause, SelectionContext};
 use crate::ty::fold::TypeFoldable;
 use crate::ty::subst::Subst;
@@ -53,6 +54,7 @@ pub fn overlapping_impls<F1, F2, R>(
     impl1_def_id: DefId,
     impl2_def_id: DefId,
     intercrate_mode: IntercrateMode,
+    skip_leak_check: SkipLeakCheck,
     on_overlap: F1,
     no_overlap: F2,
 ) -> R
@@ -70,7 +72,7 @@ where
 
     let overlaps = tcx.infer_ctxt().enter(|infcx| {
         let selcx = &mut SelectionContext::intercrate(&infcx, intercrate_mode);
-        overlap(selcx, impl1_def_id, impl2_def_id).is_some()
+        overlap(selcx, skip_leak_check, impl1_def_id, impl2_def_id).is_some()
     });
 
     if !overlaps {
@@ -83,7 +85,7 @@ where
     tcx.infer_ctxt().enter(|infcx| {
         let selcx = &mut SelectionContext::intercrate(&infcx, intercrate_mode);
         selcx.enable_tracking_intercrate_ambiguity_causes();
-        on_overlap(overlap(selcx, impl1_def_id, impl2_def_id).unwrap())
+        on_overlap(overlap(selcx, skip_leak_check, impl1_def_id, impl2_def_id).unwrap())
     })
 }
 
@@ -113,12 +115,15 @@ fn with_fresh_ty_vars<'cx, 'tcx>(
 /// where-clauses)? If so, returns an `ImplHeader` that unifies the two impls.
 fn overlap<'cx, 'tcx>(
     selcx: &mut SelectionContext<'cx, 'tcx>,
+    skip_leak_check: SkipLeakCheck,
     a_def_id: DefId,
     b_def_id: DefId,
 ) -> Option<OverlapResult<'tcx>> {
     debug!("overlap(a_def_id={:?}, b_def_id={:?})", a_def_id, b_def_id);
 
-    selcx.infcx().probe(|snapshot| overlap_within_probe(selcx, a_def_id, b_def_id, snapshot))
+    selcx.infcx().probe_maybe_skip_leak_check(skip_leak_check.is_yes(), |snapshot| {
+        overlap_within_probe(selcx, a_def_id, b_def_id, snapshot)
+    })
 }
 
 fn overlap_within_probe(
@@ -146,7 +151,9 @@ fn overlap_within_probe(
         .eq_impl_headers(&a_impl_header, &b_impl_header)
     {
         Ok(InferOk { obligations, value: () }) => obligations,
-        Err(_) => return None,
+        Err(_) => {
+            return None;
+        }
     };
 
     debug!("overlap: unification check succeeded");
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index e88f4e65c7e..50068b89687 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -83,6 +83,28 @@ pub enum IntercrateMode {
     Fixed,
 }
 
+/// Whether to skip the leak check, as part of a future compatibility warning step.
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub enum SkipLeakCheck {
+    Yes,
+    No,
+}
+
+impl SkipLeakCheck {
+    fn is_yes(self) -> bool {
+        self == SkipLeakCheck::Yes
+    }
+}
+
+/// The "default" for skip-leak-check corresponds to the current
+/// behavior (do not skip the leak check) -- not the behavior we are
+/// transitioning into.
+impl Default for SkipLeakCheck {
+    fn default() -> Self {
+        SkipLeakCheck::No
+    }
+}
+
 /// The mode that trait queries run in.
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum TraitQueryMode {
diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs
index e559ea391cd..8b68d6f2603 100644
--- a/src/librustc/traits/specialize/mod.rs
+++ b/src/librustc/traits/specialize/mod.rs
@@ -19,6 +19,7 @@ use crate::ty::{self, TyCtxt, TypeFoldable};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::struct_span_err;
 use rustc_hir::def_id::DefId;
+use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK;
 use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;
 use rustc_span::DUMMY_SP;
 
@@ -97,7 +98,7 @@ pub fn translate_substs<'a, 'tcx>(
                 |_| {
                     bug!(
                         "When translating substitutions for specialization, the expected \
-                          specialization failed to hold"
+                         specialization failed to hold"
                     )
                 },
             )
@@ -268,7 +269,7 @@ fn fulfill_implication<'a, 'tcx>(
                 // no dice!
                 debug!(
                     "fulfill_implication: for impls on {:?} and {:?}, \
-                        could not fulfill: {:?} given {:?}",
+                     could not fulfill: {:?} given {:?}",
                     source_trait_ref, target_trait_ref, errors, param_env.caller_bounds
                 );
                 Err(())
@@ -342,6 +343,7 @@ pub(super) fn specialization_graph_provider(
                             FutureCompatOverlapErrorKind::Issue33140 => {
                                 ORDER_DEPENDENT_TRAIT_OBJECTS
                             }
+                            FutureCompatOverlapErrorKind::LeakCheck => COHERENCE_LEAK_CHECK,
                         };
                         tcx.struct_span_lint_hir(
                             lint,
diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs
index c90fa428001..98908e672f0 100644
--- a/src/librustc/traits/specialize/specialization_graph.rs
+++ b/src/librustc/traits/specialize/specialization_graph.rs
@@ -11,6 +11,7 @@ pub use rustc::traits::types::specialization_graph::*;
 pub enum FutureCompatOverlapErrorKind {
     Issue43355,
     Issue33140,
+    LeakCheck,
 }
 
 #[derive(Debug)]
@@ -111,6 +112,7 @@ impl<'tcx> Children {
                 possible_sibling,
                 impl_def_id,
                 traits::IntercrateMode::Issue43355,
+                traits::SkipLeakCheck::default(),
                 |overlap| {
                     if let Some(overlap_kind) =
                         tcx.impls_are_allowed_to_overlap(impl_def_id, possible_sibling)
@@ -161,6 +163,7 @@ impl<'tcx> Children {
                         possible_sibling,
                         impl_def_id,
                         traits::IntercrateMode::Fixed,
+                        traits::SkipLeakCheck::default(),
                         |overlap| {
                             last_lint = Some(FutureCompatOverlapError {
                                 error: overlap_error(overlap),
@@ -169,6 +172,23 @@ impl<'tcx> Children {
                         },
                         || (),
                     );
+
+                    if last_lint.is_none() {
+                        traits::overlapping_impls(
+                            tcx,
+                            possible_sibling,
+                            impl_def_id,
+                            traits::IntercrateMode::Fixed,
+                            traits::SkipLeakCheck::Yes,
+                            |overlap| {
+                                last_lint = Some(FutureCompatOverlapError {
+                                    error: overlap_error(overlap),
+                                    kind: FutureCompatOverlapErrorKind::LeakCheck,
+                                });
+                            },
+                            || (),
+                        );
+                    }
                 }
 
                 // no overlap (error bailed already via ?)
@@ -247,7 +267,7 @@ impl<'tcx> Graph {
         if trait_ref.references_error() {
             debug!(
                 "insert: inserting dummy node for erroneous TraitRef {:?}, \
-                    impl_def_id={:?}, trait_def_id={:?}",
+                 impl_def_id={:?}, trait_def_id={:?}",
                 trait_ref, impl_def_id, trait_def_id
             );
 
@@ -326,7 +346,7 @@ impl<'tcx> Graph {
         if self.parent.insert(child, parent).is_some() {
             bug!(
                 "When recording an impl from the crate store, information about its parent \
-                  was already present."
+                 was already present."
             );
         }
 
diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs
index ae1a5e3efa2..d4c3518260c 100644
--- a/src/librustc/traits/util.rs
+++ b/src/librustc/traits/util.rs
@@ -643,8 +643,10 @@ pub fn generator_trait_ref_and_outputs(
     self_ty: Ty<'tcx>,
     sig: ty::PolyGenSig<'tcx>,
 ) -> ty::Binder<(ty::TraitRef<'tcx>, Ty<'tcx>, Ty<'tcx>)> {
-    let trait_ref =
-        ty::TraitRef { def_id: fn_trait_def_id, substs: tcx.mk_substs_trait(self_ty, &[]) };
+    let trait_ref = ty::TraitRef {
+        def_id: fn_trait_def_id,
+        substs: tcx.mk_substs_trait(self_ty, &[sig.skip_binder().resume_ty.into()]),
+    };
     ty::Binder::bind((trait_ref, sig.skip_binder().yield_ty, sig.skip_binder().return_ty))
 }
 
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index f12032943f9..92c5600362e 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -173,8 +173,13 @@ pub struct CommonTypes<'tcx> {
 }
 
 pub struct CommonLifetimes<'tcx> {
-    pub re_empty: Region<'tcx>,
+    /// `ReEmpty` in the root universe.
+    pub re_root_empty: Region<'tcx>,
+
+    /// `ReStatic`
     pub re_static: Region<'tcx>,
+
+    /// Erased region, used after type-checking
     pub re_erased: Region<'tcx>,
 }
 
@@ -876,7 +881,7 @@ impl<'tcx> CommonLifetimes<'tcx> {
         let mk = |r| interners.region.intern(r, |r| Interned(interners.arena.alloc(r))).0;
 
         CommonLifetimes {
-            re_empty: mk(RegionKind::ReEmpty),
+            re_root_empty: mk(RegionKind::ReEmpty(ty::UniverseIndex::ROOT)),
             re_static: mk(RegionKind::ReStatic),
             re_erased: mk(RegionKind::ReErased),
         }
@@ -966,7 +971,8 @@ pub struct GlobalCtxt<'tcx> {
     /// Export map produced by name resolution.
     export_map: FxHashMap<DefId, Vec<Export<hir::HirId>>>,
 
-    hir_map: hir_map::Map<'tcx>,
+    /// This should usually be accessed with the `tcx.hir()` method.
+    pub(crate) hir_map: hir_map::Map<'tcx>,
 
     /// A map from `DefPathHash` -> `DefId`. Includes `DefId`s from the local crate
     /// as well as all upstream crates. Only populated in incremental mode.
@@ -1019,11 +1025,6 @@ pub struct GlobalCtxt<'tcx> {
 }
 
 impl<'tcx> TyCtxt<'tcx> {
-    #[inline(always)]
-    pub fn hir(self) -> &'tcx hir_map::Map<'tcx> {
-        &self.hir_map
-    }
-
     pub fn alloc_steal_mir(self, mir: BodyAndCache<'tcx>) -> &'tcx Steal<BodyAndCache<'tcx>> {
         self.arena.alloc(Steal::new(mir))
     }
@@ -1328,7 +1329,7 @@ impl<'tcx> TyCtxt<'tcx> {
 
     #[inline(always)]
     pub fn create_stable_hashing_context(self) -> StableHashingContext<'tcx> {
-        let krate = self.gcx.hir_map.forest.untracked_krate();
+        let krate = self.gcx.hir_map.untracked_krate();
 
         StableHashingContext::new(self.sess, krate, self.hir().definitions(), &*self.cstore)
     }
diff --git a/src/librustc/ty/free_region_map.rs b/src/librustc/ty/free_region_map.rs
index 42f506606e6..2ab12a4acbf 100644
--- a/src/librustc/ty/free_region_map.rs
+++ b/src/librustc/ty/free_region_map.rs
@@ -23,11 +23,61 @@ impl<'tcx> FreeRegionMap<'tcx> {
     // (with the exception that `'static: 'x` is not notable)
     pub fn relate_regions(&mut self, sub: Region<'tcx>, sup: Region<'tcx>) {
         debug!("relate_regions(sub={:?}, sup={:?})", sub, sup);
-        if is_free_or_static(sub) && is_free(sup) {
+        if self.is_free_or_static(sub) && self.is_free(sup) {
             self.relation.add(sub, sup)
         }
     }
 
+    /// Tests whether `r_a <= r_b`.
+    ///
+    /// Both regions must meet `is_free_or_static`.
+    ///
+    /// Subtle: one tricky case that this code gets correct is as
+    /// follows. If we know that `r_b: 'static`, then this function
+    /// will return true, even though we don't know anything that
+    /// directly relates `r_a` and `r_b`.
+    ///
+    /// Also available through the `FreeRegionRelations` trait below.
+    pub fn sub_free_regions(
+        &self,
+        tcx: TyCtxt<'tcx>,
+        r_a: Region<'tcx>,
+        r_b: Region<'tcx>,
+    ) -> bool {
+        assert!(self.is_free_or_static(r_a) && self.is_free_or_static(r_b));
+        let re_static = tcx.lifetimes.re_static;
+        if self.check_relation(re_static, r_b) {
+            // `'a <= 'static` is always true, and not stored in the
+            // relation explicitly, so check if `'b` is `'static` (or
+            // equivalent to it)
+            true
+        } else {
+            self.check_relation(r_a, r_b)
+        }
+    }
+
+    /// Check whether `r_a <= r_b` is found in the relation.
+    fn check_relation(&self, r_a: Region<'tcx>, r_b: Region<'tcx>) -> bool {
+        r_a == r_b || self.relation.contains(&r_a, &r_b)
+    }
+
+    /// True for free regions other than `'static`.
+    pub fn is_free(&self, r: Region<'_>) -> bool {
+        match *r {
+            ty::ReEarlyBound(_) | ty::ReFree(_) => true,
+            _ => false,
+        }
+    }
+
+    /// True if `r` is a free region or static of the sort that this
+    /// free region map can be used with.
+    pub fn is_free_or_static(&self, r: Region<'_>) -> bool {
+        match *r {
+            ty::ReStatic => true,
+            _ => self.is_free(r),
+        }
+    }
+
     /// Computes the least-upper-bound of two free regions. In some
     /// cases, this is more conservative than necessary, in order to
     /// avoid making arbitrary choices. See
@@ -39,13 +89,13 @@ impl<'tcx> FreeRegionMap<'tcx> {
         r_b: Region<'tcx>,
     ) -> Region<'tcx> {
         debug!("lub_free_regions(r_a={:?}, r_b={:?})", r_a, r_b);
-        assert!(is_free(r_a));
-        assert!(is_free(r_b));
+        assert!(self.is_free(r_a));
+        assert!(self.is_free(r_b));
         let result = if r_a == r_b {
             r_a
         } else {
             match self.relation.postdom_upper_bound(&r_a, &r_b) {
-                None => tcx.mk_region(ty::ReStatic),
+                None => tcx.lifetimes.re_static,
                 Some(r) => *r,
             }
         };
@@ -60,31 +110,18 @@ impl<'tcx> FreeRegionMap<'tcx> {
 pub trait FreeRegionRelations<'tcx> {
     /// Tests whether `r_a <= r_b`. Both must be free regions or
     /// `'static`.
-    fn sub_free_regions(&self, shorter: ty::Region<'tcx>, longer: ty::Region<'tcx>) -> bool;
+    fn sub_free_regions(
+        &self,
+        tcx: TyCtxt<'tcx>,
+        shorter: ty::Region<'tcx>,
+        longer: ty::Region<'tcx>,
+    ) -> bool;
 }
 
 impl<'tcx> FreeRegionRelations<'tcx> for FreeRegionMap<'tcx> {
-    fn sub_free_regions(&self, r_a: Region<'tcx>, r_b: Region<'tcx>) -> bool {
-        assert!(is_free_or_static(r_a) && is_free_or_static(r_b));
-        if let ty::ReStatic = r_b {
-            true // `'a <= 'static` is just always true, and not stored in the relation explicitly
-        } else {
-            r_a == r_b || self.relation.contains(&r_a, &r_b)
-        }
-    }
-}
-
-fn is_free(r: Region<'_>) -> bool {
-    match *r {
-        ty::ReEarlyBound(_) | ty::ReFree(_) => true,
-        _ => false,
-    }
-}
-
-fn is_free_or_static(r: Region<'_>) -> bool {
-    match *r {
-        ty::ReStatic => true,
-        _ => is_free(r),
+    fn sub_free_regions(&self, tcx: TyCtxt<'tcx>, r_a: Region<'tcx>, r_b: Region<'tcx>) -> bool {
+        // invoke the "inherent method"
+        self.sub_free_regions(tcx, r_a, r_b)
     }
 }
 
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs
index bda42db40b0..0a5ab790adb 100644
--- a/src/librustc/ty/layout.rs
+++ b/src/librustc/ty/layout.rs
@@ -2350,8 +2350,9 @@ impl<'tcx> ty::Instance<'tcx> {
                     ]);
                     let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
 
-                    tcx.mk_fn_sig(iter::once(env_ty),
-                        ret_ty,
+                    tcx.mk_fn_sig(
+                        [env_ty, sig.resume_ty].iter(),
+                        &ret_ty,
                         false,
                         hir::Unsafety::Normal,
                         rustc_target::spec::abi::Abi::Rust
diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs
index f5c14e73db2..0da680d1f91 100644
--- a/src/librustc/ty/print/pretty.rs
+++ b/src/librustc/ty/print/pretty.rs
@@ -1382,7 +1382,7 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
 
             ty::ReVar(_) | ty::ReScope(_) | ty::ReErased => false,
 
-            ty::ReStatic | ty::ReEmpty | ty::ReClosureBound(_) => true,
+            ty::ReStatic | ty::ReEmpty(_) | ty::ReClosureBound(_) => true,
         }
     }
 }
@@ -1464,10 +1464,14 @@ impl<F: fmt::Write> FmtPrinter<'_, '_, F> {
                 p!(write("'static"));
                 return Ok(self);
             }
-            ty::ReEmpty => {
+            ty::ReEmpty(ty::UniverseIndex::ROOT) => {
                 p!(write("'<empty>"));
                 return Ok(self);
             }
+            ty::ReEmpty(ui) => {
+                p!(write("'<empty:{:?}>", ui));
+                return Ok(self);
+            }
 
             // The user should never encounter these in unsubstituted form.
             ty::ReClosureBound(vid) => {
diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs
index 973cd810146..e7b95af103c 100644
--- a/src/librustc/ty/query/mod.rs
+++ b/src/librustc/ty/query/mod.rs
@@ -45,7 +45,7 @@ use rustc_data_structures::sync::Lrc;
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex};
-use rustc_hir::{HirIdSet, ItemLocalId, TraitCandidate};
+use rustc_hir::{Crate, HirIdSet, ItemLocalId, TraitCandidate};
 use rustc_index::vec::IndexVec;
 use rustc_target::spec::PanicStrategy;
 
diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs
index 117a38c655e..6d9fff351e9 100644
--- a/src/librustc/ty/query/plumbing.rs
+++ b/src/librustc/ty/query/plumbing.rs
@@ -1177,7 +1177,6 @@ pub fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool {
         // These are inputs that are expected to be pre-allocated and that
         // should therefore always be red or green already.
         DepKind::AllLocalTraitImpls |
-        DepKind::Krate |
         DepKind::CrateMetadata |
         DepKind::HirBody |
         DepKind::Hir |
diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs
index c1ae4d9fe17..acd6c959751 100644
--- a/src/librustc/ty/structural_impls.rs
+++ b/src/librustc/ty/structural_impls.rs
@@ -108,7 +108,7 @@ impl fmt::Debug for ty::RegionKind {
 
             ty::RePlaceholder(placeholder) => write!(f, "RePlaceholder({:?})", placeholder),
 
-            ty::ReEmpty => write!(f, "ReEmpty"),
+            ty::ReEmpty(ui) => write!(f, "ReEmpty({:?})", ui),
 
             ty::ReErased => write!(f, "ReErased"),
         }
@@ -598,8 +598,8 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> {
 impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> {
     type Lifted = ty::GenSig<'tcx>;
     fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
-        tcx.lift(&(self.yield_ty, self.return_ty))
-            .map(|(yield_ty, return_ty)| ty::GenSig { yield_ty, return_ty })
+        tcx.lift(&(self.resume_ty, self.yield_ty, self.return_ty))
+            .map(|(resume_ty, yield_ty, return_ty)| ty::GenSig { resume_ty, yield_ty, return_ty })
     }
 }
 
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index dffe86d9462..4c5bc3debde 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -346,9 +346,17 @@ static_assert_size!(TyKind<'_>, 24);
 /// ## Generators
 ///
 /// Generators are handled similarly in `GeneratorSubsts`.  The set of
-/// type parameters is similar, but the role of CK and CS are
-/// different. CK represents the "yield type" and CS represents the
-/// "return type" of the generator.
+/// type parameters is similar, but `CK` and `CS` are replaced by the
+/// following type parameters:
+///
+/// * `GS`: The generator's "resume type", which is the type of the
+///   argument passed to `resume`, and the type of `yield` expressions
+///   inside the generator.
+/// * `GY`: The "yield type", which is the type of values passed to
+///   `yield` inside the generator.
+/// * `GR`: The "return type", which is the type of value returned upon
+///   completion of the generator.
+/// * `GW`: The "generator witness".
 #[derive(Copy, Clone, Debug, TypeFoldable)]
 pub struct ClosureSubsts<'tcx> {
     /// Lifetime and type parameters from the enclosing function,
@@ -442,6 +450,7 @@ pub struct GeneratorSubsts<'tcx> {
 }
 
 struct SplitGeneratorSubsts<'tcx> {
+    resume_ty: Ty<'tcx>,
     yield_ty: Ty<'tcx>,
     return_ty: Ty<'tcx>,
     witness: Ty<'tcx>,
@@ -453,10 +462,11 @@ impl<'tcx> GeneratorSubsts<'tcx> {
         let generics = tcx.generics_of(def_id);
         let parent_len = generics.parent_count;
         SplitGeneratorSubsts {
-            yield_ty: self.substs.type_at(parent_len),
-            return_ty: self.substs.type_at(parent_len + 1),
-            witness: self.substs.type_at(parent_len + 2),
-            upvar_kinds: &self.substs[parent_len + 3..],
+            resume_ty: self.substs.type_at(parent_len),
+            yield_ty: self.substs.type_at(parent_len + 1),
+            return_ty: self.substs.type_at(parent_len + 2),
+            witness: self.substs.type_at(parent_len + 3),
+            upvar_kinds: &self.substs[parent_len + 4..],
         }
     }
 
@@ -485,6 +495,11 @@ impl<'tcx> GeneratorSubsts<'tcx> {
         })
     }
 
+    /// Returns the type representing the resume type of the generator.
+    pub fn resume_ty(self, def_id: DefId, tcx: TyCtxt<'_>) -> Ty<'tcx> {
+        self.split(def_id, tcx).resume_ty
+    }
+
     /// Returns the type representing the yield type of the generator.
     pub fn yield_ty(self, def_id: DefId, tcx: TyCtxt<'_>) -> Ty<'tcx> {
         self.split(def_id, tcx).yield_ty
@@ -505,10 +520,14 @@ impl<'tcx> GeneratorSubsts<'tcx> {
         ty::Binder::dummy(self.sig(def_id, tcx))
     }
 
-    /// Returns the "generator signature", which consists of its yield
+    /// Returns the "generator signature", which consists of its resume, yield
     /// and return types.
     pub fn sig(self, def_id: DefId, tcx: TyCtxt<'_>) -> GenSig<'tcx> {
-        ty::GenSig { yield_ty: self.yield_ty(def_id, tcx), return_ty: self.return_ty(def_id, tcx) }
+        ty::GenSig {
+            resume_ty: self.resume_ty(def_id, tcx),
+            yield_ty: self.yield_ty(def_id, tcx),
+            return_ty: self.return_ty(def_id, tcx),
+        }
     }
 }
 
@@ -1072,6 +1091,7 @@ impl<'tcx> ProjectionTy<'tcx> {
 
 #[derive(Clone, Debug, TypeFoldable)]
 pub struct GenSig<'tcx> {
+    pub resume_ty: Ty<'tcx>,
     pub yield_ty: Ty<'tcx>,
     pub return_ty: Ty<'tcx>,
 }
@@ -1079,6 +1099,9 @@ pub struct GenSig<'tcx> {
 pub type PolyGenSig<'tcx> = Binder<GenSig<'tcx>>;
 
 impl<'tcx> PolyGenSig<'tcx> {
+    pub fn resume_ty(&self) -> ty::Binder<Ty<'tcx>> {
+        self.map_bound_ref(|sig| sig.resume_ty)
+    }
     pub fn yield_ty(&self) -> ty::Binder<Ty<'tcx>> {
         self.map_bound_ref(|sig| sig.yield_ty)
     }
@@ -1269,11 +1292,67 @@ rustc_index::newtype_index! {
 
 pub type Region<'tcx> = &'tcx RegionKind;
 
-/// Representation of regions.
+/// Representation of (lexical) regions. Note that the NLL checker
+/// uses a distinct representation of regions. For this reason, it
+/// internally replaces all the regions with inference variables --
+/// the index of the variable is then used to index into internal NLL
+/// data structures. See `rustc_mir::borrow_check` module for more
+/// information.
+///
+/// ## The Region lattice within a given function
+///
+/// In general, the (lexical, and hence deprecated) region lattice
+/// looks like
+///
+/// ```
+/// static ----------+-----...------+       (greatest)
+/// |                |              |
+/// early-bound and  |              |
+/// free regions     |              |
+/// |                |              |
+/// scope regions    |              |
+/// |                |              |
+/// empty(root)   placeholder(U1)   |
+/// |            /                  |
+/// |           /         placeholder(Un)
+/// empty(U1) --         /
+/// |                   /
+/// ...                /
+/// |                 /
+/// empty(Un) --------                      (smallest)
+/// ```
+///
+/// Early-bound/free regions are the named lifetimes in scope from the
+/// function declaration. They have relationships to one another
+/// determined based on the declared relationships from the
+/// function. They all collectively outlive the scope regions. (See
+/// `RegionRelations` type, and particularly
+/// `crate::infer::outlives::free_region_map::FreeRegionMap`.)
+///
+/// The scope regions are related to one another based on the AST
+/// structure. (See `RegionRelations` type, and particularly the
+/// `rustc::middle::region::ScopeTree`.)
+///
+/// Note that inference variables and bound regions are not included
+/// in this diagram. In the case of inference variables, they should
+/// be inferred to some other region from the diagram.  In the case of
+/// bound regions, they are excluded because they don't make sense to
+/// include -- the diagram indicates the relationship between free
+/// regions.
+///
+/// ## Inference variables
+///
+/// During region inference, we sometimes create inference variables,
+/// represented as `ReVar`. These will be inferred by the code in
+/// `infer::lexical_region_resolve` to some free region from the
+/// lattice above (the minimal region that meets the
+/// constraints).
 ///
-/// Unlike types, most region variants are "fictitious", not concrete,
-/// regions. Among these, `ReStatic`, `ReEmpty` and `ReScope` are the only
-/// ones representing concrete regions.
+/// During NLL checking, where regions are defined differently, we
+/// also use `ReVar` -- in that case, the index is used to index into
+/// the NLL region checker's data structures. The variable may in fact
+/// represent either a free region or an inference variable, in that
+/// case.
 ///
 /// ## Bound Regions
 ///
@@ -1356,14 +1435,13 @@ pub enum RegionKind {
     /// Should not exist after typeck.
     RePlaceholder(ty::PlaceholderRegion),
 
-    /// Empty lifetime is for data that is never accessed.
-    /// Bottom in the region lattice. We treat ReEmpty somewhat
-    /// specially; at least right now, we do not generate instances of
-    /// it during the GLB computations, but rather
-    /// generate an error instead. This is to improve error messages.
-    /// The only way to get an instance of ReEmpty is to have a region
-    /// variable with no constraints.
-    ReEmpty,
+    /// Empty lifetime is for data that is never accessed.  We tag the
+    /// empty lifetime with a universe -- the idea is that we don't
+    /// want `exists<'a> { forall<'b> { 'b: 'a } }` to be satisfiable.
+    /// Therefore, the `'empty` in a universe `U` is less than all
+    /// regions visible from `U`, but not less than regions not visible
+    /// from `U`.
+    ReEmpty(ty::UniverseIndex),
 
     /// Erased region, used by trait selection, in MIR and during codegen.
     ReErased,
@@ -1612,7 +1690,7 @@ impl RegionKind {
             RegionKind::ReStatic => true,
             RegionKind::ReVar(..) => false,
             RegionKind::RePlaceholder(placeholder) => placeholder.name.is_named(),
-            RegionKind::ReEmpty => false,
+            RegionKind::ReEmpty(_) => false,
             RegionKind::ReErased => false,
             RegionKind::ReClosureBound(..) => false,
         }
@@ -1695,7 +1773,7 @@ impl RegionKind {
                 flags = flags | TypeFlags::HAS_FREE_REGIONS;
                 flags = flags | TypeFlags::HAS_RE_EARLY_BOUND;
             }
-            ty::ReEmpty | ty::ReStatic | ty::ReFree { .. } | ty::ReScope { .. } => {
+            ty::ReEmpty(_) | ty::ReStatic | ty::ReFree { .. } | ty::ReScope { .. } => {
                 flags = flags | TypeFlags::HAS_FREE_REGIONS;
             }
             ty::ReErased => {}
@@ -1705,7 +1783,7 @@ impl RegionKind {
         }
 
         match *self {
-            ty::ReStatic | ty::ReEmpty | ty::ReErased | ty::ReLateBound(..) => (),
+            ty::ReStatic | ty::ReEmpty(_) | ty::ReErased | ty::ReLateBound(..) => (),
             _ => flags = flags | TypeFlags::HAS_FREE_LOCAL_NAMES,
         }
 
diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs
index 5dc855e935c..dd3316979f6 100644
--- a/src/librustc_ast_lowering/expr.rs
+++ b/src/librustc_ast_lowering/expr.rs
@@ -688,12 +688,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
     ) -> Option<hir::Movability> {
         match generator_kind {
             Some(hir::GeneratorKind::Gen) => {
-                if !decl.inputs.is_empty() {
+                if decl.inputs.len() > 1 {
                     struct_span_err!(
                         self.sess,
                         fn_decl_span,
                         E0628,
-                        "generators cannot have explicit parameters"
+                        "too many parameters for a generator (expected 0 or 1 parameters)"
                     )
                     .emit();
                 }
diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs
index e3920d99c90..a9e4fdba030 100644
--- a/src/librustc_codegen_llvm/attributes.rs
+++ b/src/librustc_codegen_llvm/attributes.rs
@@ -46,6 +46,31 @@ fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
     };
 }
 
+/// Apply LLVM sanitize attributes.
+#[inline]
+pub fn sanitize(cx: &CodegenCx<'ll, '_>, codegen_fn_flags: CodegenFnAttrFlags, llfn: &'ll Value) {
+    if let Some(ref sanitizer) = cx.tcx.sess.opts.debugging_opts.sanitizer {
+        match *sanitizer {
+            Sanitizer::Address => {
+                if !codegen_fn_flags.contains(CodegenFnAttrFlags::NO_SANITIZE_ADDRESS) {
+                    llvm::Attribute::SanitizeAddress.apply_llfn(Function, llfn);
+                }
+            }
+            Sanitizer::Memory => {
+                if !codegen_fn_flags.contains(CodegenFnAttrFlags::NO_SANITIZE_MEMORY) {
+                    llvm::Attribute::SanitizeMemory.apply_llfn(Function, llfn);
+                }
+            }
+            Sanitizer::Thread => {
+                if !codegen_fn_flags.contains(CodegenFnAttrFlags::NO_SANITIZE_THREAD) {
+                    llvm::Attribute::SanitizeThread.apply_llfn(Function, llfn);
+                }
+            }
+            Sanitizer::Leak => {}
+        }
+    }
+}
+
 /// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
 #[inline]
 pub fn emit_uwtable(val: &'ll Value, emit: bool) {
@@ -288,6 +313,7 @@ pub fn from_fn_attrs(
     if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR) {
         Attribute::NoAlias.apply_llfn(llvm::AttributePlace::ReturnValue, llfn);
     }
+    sanitize(cx, codegen_fn_attrs.flags, llfn);
 
     unwind(
         llfn,
diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs
index d3b524c1a1e..04c084e459e 100644
--- a/src/librustc_codegen_llvm/base.rs
+++ b/src/librustc_codegen_llvm/base.rs
@@ -15,6 +15,7 @@
 
 use super::ModuleLlvm;
 
+use crate::attributes;
 use crate::builder::Builder;
 use crate::common;
 use crate::context::CodegenCx;
@@ -23,7 +24,7 @@ use crate::metadata;
 use crate::value::Value;
 
 use rustc::dep_graph;
-use rustc::middle::codegen_fn_attrs::CodegenFnAttrs;
+use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
 use rustc::middle::cstore::EncodedMetadata;
 use rustc::middle::exported_symbols;
 use rustc::mir::mono::{Linkage, Visibility};
@@ -131,7 +132,9 @@ pub fn compile_codegen_unit(
 
             // If this codegen unit contains the main function, also create the
             // wrapper here
-            maybe_create_entry_wrapper::<Builder<'_, '_, '_>>(&cx);
+            if let Some(entry) = maybe_create_entry_wrapper::<Builder<'_, '_, '_>>(&cx) {
+                attributes::sanitize(&cx, CodegenFnAttrFlags::empty(), entry);
+            }
 
             // Run replace-all-uses-with for statics that need it
             for &(old_g, new_g) in cx.statics_to_rauw().borrow().iter() {
diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs
index bb06b521621..691f32dd85a 100644
--- a/src/librustc_codegen_llvm/declare.rs
+++ b/src/librustc_codegen_llvm/declare.rs
@@ -19,7 +19,6 @@ use crate::llvm::AttributePlace::Function;
 use crate::type_::Type;
 use crate::value::Value;
 use log::debug;
-use rustc::session::config::Sanitizer;
 use rustc::ty::Ty;
 use rustc_codegen_ssa::traits::*;
 use rustc_data_structures::small_c_str::SmallCStr;
@@ -47,21 +46,6 @@ fn declare_raw_fn(
         llvm::Attribute::NoRedZone.apply_llfn(Function, llfn);
     }
 
-    if let Some(ref sanitizer) = cx.tcx.sess.opts.debugging_opts.sanitizer {
-        match *sanitizer {
-            Sanitizer::Address => {
-                llvm::Attribute::SanitizeAddress.apply_llfn(Function, llfn);
-            }
-            Sanitizer::Memory => {
-                llvm::Attribute::SanitizeMemory.apply_llfn(Function, llfn);
-            }
-            Sanitizer::Thread => {
-                llvm::Attribute::SanitizeThread.apply_llfn(Function, llfn);
-            }
-            _ => {}
-        }
-    }
-
     attributes::default_optimisation_attrs(cx.tcx.sess, llfn);
     attributes::non_lazy_bind(cx.sess(), llfn);
     llfn
diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs
index 1f43a4027c5..90015091384 100644
--- a/src/librustc_codegen_ssa/base.rs
+++ b/src/librustc_codegen_ssa/base.rs
@@ -391,10 +391,12 @@ pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
 
 /// Creates the `main` function which will initialize the rust runtime and call
 /// users main function.
-pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'a Bx::CodegenCx) {
+pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
+    cx: &'a Bx::CodegenCx,
+) -> Option<Bx::Function> {
     let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) {
         Some((def_id, _)) => (def_id, cx.tcx().def_span(def_id)),
-        None => return,
+        None => return None,
     };
 
     let instance = Instance::mono(cx.tcx(), main_def_id);
@@ -402,17 +404,15 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'
     if !cx.codegen_unit().contains_item(&MonoItem::Fn(instance)) {
         // We want to create the wrapper in the same codegen unit as Rust's main
         // function.
-        return;
+        return None;
     }
 
     let main_llfn = cx.get_fn_addr(instance);
 
-    let et = cx.tcx().entry_fn(LOCAL_CRATE).map(|e| e.1);
-    match et {
-        Some(EntryFnType::Main) => create_entry_fn::<Bx>(cx, span, main_llfn, main_def_id, true),
-        Some(EntryFnType::Start) => create_entry_fn::<Bx>(cx, span, main_llfn, main_def_id, false),
-        None => {} // Do nothing.
-    }
+    return cx.tcx().entry_fn(LOCAL_CRATE).map(|(_, et)| {
+        let use_start_lang_item = EntryFnType::Start != et;
+        create_entry_fn::<Bx>(cx, span, main_llfn, main_def_id, use_start_lang_item)
+    });
 
     fn create_entry_fn<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
         cx: &'a Bx::CodegenCx,
@@ -420,7 +420,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'
         rust_main: Bx::Value,
         rust_main_def_id: DefId,
         use_start_lang_item: bool,
-    ) {
+    ) -> Bx::Function {
         // The entry function is either `int main(void)` or `int main(int argc, char **argv)`,
         // depending on whether the target needs `argc` and `argv` to be passed in.
         let llfty = if cx.sess().target.target.options.main_needs_argc_argv {
@@ -481,6 +481,8 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'
         let result = bx.call(start_fn, &args, None);
         let cast = bx.intcast(result, cx.type_int(), true);
         bx.ret(cast);
+
+        llfn
     }
 }
 
diff --git a/src/librustc_data_structures/box_region.rs b/src/librustc_data_structures/box_region.rs
index 94abb89503c..dbc54291f40 100644
--- a/src/librustc_data_structures/box_region.rs
+++ b/src/librustc_data_structures/box_region.rs
@@ -25,6 +25,7 @@ pub struct PinnedGenerator<I, A, R> {
 }
 
 impl<I, A, R> PinnedGenerator<I, A, R> {
+    #[cfg(bootstrap)]
     pub fn new<T: Generator<Yield = YieldType<I, A>, Return = R> + 'static>(
         generator: T,
     ) -> (I, Self) {
@@ -39,6 +40,22 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
         (init, result)
     }
 
+    #[cfg(not(bootstrap))]
+    pub fn new<T: Generator<Yield = YieldType<I, A>, Return = R> + 'static>(
+        generator: T,
+    ) -> (I, Self) {
+        let mut result = PinnedGenerator { generator: Box::pin(generator) };
+
+        // Run it to the first yield to set it up
+        let init = match Pin::new(&mut result.generator).resume(()) {
+            GeneratorState::Yielded(YieldType::Initial(y)) => y,
+            _ => panic!(),
+        };
+
+        (init, result)
+    }
+
+    #[cfg(bootstrap)]
     pub unsafe fn access(&mut self, closure: *mut dyn FnMut()) {
         BOX_REGION_ARG.with(|i| {
             i.set(Action::Access(AccessAction(closure)));
@@ -50,6 +67,19 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
         }
     }
 
+    #[cfg(not(bootstrap))]
+    pub unsafe fn access(&mut self, closure: *mut dyn FnMut()) {
+        BOX_REGION_ARG.with(|i| {
+            i.set(Action::Access(AccessAction(closure)));
+        });
+
+        // Call the generator, which in turn will call the closure in BOX_REGION_ARG
+        if let GeneratorState::Complete(_) = Pin::new(&mut self.generator).resume(()) {
+            panic!()
+        }
+    }
+
+    #[cfg(bootstrap)]
     pub fn complete(&mut self) -> R {
         // Tell the generator we want it to complete, consuming it and yielding a result
         BOX_REGION_ARG.with(|i| i.set(Action::Complete));
@@ -57,6 +87,15 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
         let result = Pin::new(&mut self.generator).resume();
         if let GeneratorState::Complete(r) = result { r } else { panic!() }
     }
+
+    #[cfg(not(bootstrap))]
+    pub fn complete(&mut self) -> R {
+        // Tell the generator we want it to complete, consuming it and yielding a result
+        BOX_REGION_ARG.with(|i| i.set(Action::Complete));
+
+        let result = Pin::new(&mut self.generator).resume(());
+        if let GeneratorState::Complete(r) = result { r } else { panic!() }
+    }
 }
 
 #[derive(PartialEq)]
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs
index 345b03e6db2..d4f01490499 100644
--- a/src/librustc_driver/pretty.rs
+++ b/src/librustc_driver/pretty.rs
@@ -69,19 +69,19 @@ where
     match *ppmode {
         PpmNormal => {
             let annotation = NoAnn { sess: tcx.sess, tcx: Some(tcx) };
-            f(&annotation, tcx.hir().forest.krate())
+            f(&annotation, tcx.hir().krate())
         }
 
         PpmIdentified => {
             let annotation = IdentifiedAnnotation { sess: tcx.sess, tcx: Some(tcx) };
-            f(&annotation, tcx.hir().forest.krate())
+            f(&annotation, tcx.hir().krate())
         }
         PpmTyped => {
             abort_on_err(tcx.analysis(LOCAL_CRATE), tcx.sess);
 
             let empty_tables = ty::TypeckTables::empty(None);
             let annotation = TypedAnnotation { tcx, tables: Cell::new(&empty_tables) };
-            tcx.dep_graph.with_ignore(|| f(&annotation, tcx.hir().forest.krate()))
+            tcx.dep_graph.with_ignore(|| f(&annotation, tcx.hir().krate()))
         }
         _ => panic!("Should use call_with_pp_support"),
     }
@@ -143,7 +143,7 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> {
     }
 
     fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
-        self.tcx.map(|tcx| tcx.hir())
+        self.tcx.map(|tcx| *tcx.hir())
     }
 
     fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
@@ -155,7 +155,7 @@ impl<'hir> pprust::PpAnn for NoAnn<'hir> {}
 impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> {
     fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
         if let Some(tcx) = self.tcx {
-            pprust_hir::PpAnn::nested(tcx.hir(), state, nested)
+            pprust_hir::PpAnn::nested(*tcx.hir(), state, nested)
         }
     }
 }
@@ -217,7 +217,7 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
     }
 
     fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> {
-        self.tcx.map(|tcx| tcx.hir())
+        self.tcx.map(|tcx| *tcx.hir())
     }
 
     fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn {
@@ -228,7 +228,7 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
 impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> {
     fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
         if let Some(ref tcx) = self.tcx {
-            pprust_hir::PpAnn::nested(tcx.hir(), state, nested)
+            pprust_hir::PpAnn::nested(*tcx.hir(), state, nested)
         }
     }
     fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
@@ -334,7 +334,7 @@ impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> {
         if let pprust_hir::Nested::Body(id) = nested {
             self.tables.set(self.tcx.body_tables(id));
         }
-        pprust_hir::PpAnn::nested(self.tcx.hir(), state, nested);
+        pprust_hir::PpAnn::nested(*self.tcx.hir(), state, nested);
         self.tables.set(old_tables);
     }
     fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
diff --git a/src/librustc_error_codes/error_codes/E0276.md b/src/librustc_error_codes/error_codes/E0276.md
index 0e3a613bf9c..ad76968c589 100644
--- a/src/librustc_error_codes/error_codes/E0276.md
+++ b/src/librustc_error_codes/error_codes/E0276.md
@@ -1,5 +1,6 @@
-This error occurs when a bound in an implementation of a trait does not match
-the bounds specified in the original trait. For example:
+A trait implementation has stricter requirements than the trait definition.
+
+Erroneous code example:
 
 ```compile_fail,E0276
 trait Foo {
diff --git a/src/librustc_error_codes/error_codes/E0511.md b/src/librustc_error_codes/error_codes/E0511.md
index 2d6ff8241e6..4f6644f3582 100644
--- a/src/librustc_error_codes/error_codes/E0511.md
+++ b/src/librustc_error_codes/error_codes/E0511.md
@@ -1,7 +1,7 @@
 Invalid monomorphization of an intrinsic function was used. Erroneous code
 example:
 
-```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
+```compile_fail,E0511
 #![feature(platform_intrinsics)]
 
 extern "platform-intrinsic" {
diff --git a/src/librustc_error_codes/error_codes/E0534.md b/src/librustc_error_codes/error_codes/E0534.md
index e50b84764b4..0afa4a8c958 100644
--- a/src/librustc_error_codes/error_codes/E0534.md
+++ b/src/librustc_error_codes/error_codes/E0534.md
@@ -2,7 +2,7 @@ The `inline` attribute was malformed.
 
 Erroneous code example:
 
-```ignore (compile_fail not working here; see Issue #43707)
+```compile_fail,E0534
 #[inline()] // error: expected one argument
 pub fn something() {}
 
diff --git a/src/librustc_error_codes/error_codes/E0535.md b/src/librustc_error_codes/error_codes/E0535.md
index e9abfe5dda1..035d395b76f 100644
--- a/src/librustc_error_codes/error_codes/E0535.md
+++ b/src/librustc_error_codes/error_codes/E0535.md
@@ -2,7 +2,7 @@ An unknown argument was given to the `inline` attribute.
 
 Erroneous code example:
 
-```ignore (compile_fail not working here; see Issue #43707)
+```compile_fail,E0535
 #[inline(unknown)] // error: invalid argument
 pub fn something() {}
 
diff --git a/src/librustc_error_codes/error_codes/E0565.md b/src/librustc_error_codes/error_codes/E0565.md
index 1faedf45932..d5bba941c1d 100644
--- a/src/librustc_error_codes/error_codes/E0565.md
+++ b/src/librustc_error_codes/error_codes/E0565.md
@@ -2,9 +2,11 @@ A literal was used in a built-in attribute that doesn't support literals.
 
 Erroneous code example:
 
-```ignore (compile_fail not working here; see Issue #43707)
-#[inline("always")] // error: unsupported literal
-pub fn something() {}
+```compile_fail,E0565
+#[repr("C")] // error: meta item in `repr` must be an identifier
+struct Repr {}
+
+fn main() {}
 ```
 
 Literals in attributes are new and largely unsupported in built-in attributes.
@@ -12,6 +14,8 @@ Work to support literals where appropriate is ongoing. Try using an unquoted
 name instead:
 
 ```
-#[inline(always)]
-pub fn something() {}
+#[repr(C)] // ok!
+struct Repr {}
+
+fn main() {}
 ```
diff --git a/src/librustc_error_codes/error_codes/E0626.md b/src/librustc_error_codes/error_codes/E0626.md
index db50bd7ac4f..cc6e03d1ca7 100644
--- a/src/librustc_error_codes/error_codes/E0626.md
+++ b/src/librustc_error_codes/error_codes/E0626.md
@@ -12,7 +12,7 @@ let mut b = || {
     yield (); // ...is still in scope here, when the yield occurs.
     println!("{}", a);
 };
-Pin::new(&mut b).resume();
+Pin::new(&mut b).resume(());
 ```
 
 At present, it is not permitted to have a yield that occurs while a
@@ -31,7 +31,7 @@ let mut b = || {
     yield ();
     println!("{}", a);
 };
-Pin::new(&mut b).resume();
+Pin::new(&mut b).resume(());
 ```
 
 This is a very simple case, of course. In more complex cases, we may
@@ -50,7 +50,7 @@ let mut b = || {
     yield x; // ...when this yield occurs.
   }
 };
-Pin::new(&mut b).resume();
+Pin::new(&mut b).resume(());
 ```
 
 Such cases can sometimes be resolved by iterating "by value" (or using
@@ -66,7 +66,7 @@ let mut b = || {
     yield x; // <-- Now yield is OK.
   }
 };
-Pin::new(&mut b).resume();
+Pin::new(&mut b).resume(());
 ```
 
 If taking ownership is not an option, using indices can work too:
@@ -83,7 +83,7 @@ let mut b = || {
     yield x; // <-- Now yield is OK.
   }
 };
-Pin::new(&mut b).resume();
+Pin::new(&mut b).resume(());
 
 // (*) -- Unfortunately, these temporaries are currently required.
 // See <https://github.com/rust-lang/rust/issues/43122>.
diff --git a/src/librustc_error_codes/error_codes/E0633.md b/src/librustc_error_codes/error_codes/E0633.md
index 65cdf90036a..7f488cde664 100644
--- a/src/librustc_error_codes/error_codes/E0633.md
+++ b/src/librustc_error_codes/error_codes/E0633.md
@@ -2,7 +2,9 @@ The `unwind` attribute was malformed.
 
 Erroneous code example:
 
-```ignore (compile_fail not working here; see Issue #43707)
+```compile_fail,E0633
+#![feature(unwind_attributes)]
+
 #[unwind()] // error: expected one argument
 pub extern fn something() {}
 
diff --git a/src/librustc_error_codes/error_codes/E0668.md b/src/librustc_error_codes/error_codes/E0668.md
index 2621a31a9e0..f5d26244fb9 100644
--- a/src/librustc_error_codes/error_codes/E0668.md
+++ b/src/librustc_error_codes/error_codes/E0668.md
@@ -6,7 +6,7 @@ assembly call.
 
 In particular, it can happen if you forgot the closing bracket of a register
 constraint (see issue #51430):
-```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail)
+```compile_fail,E0668
 #![feature(asm)]
 
 fn main() {
diff --git a/src/librustc_errors/annotate_snippet_emitter_writer.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs
index 009ab6ac5b1..d83175694f4 100644
--- a/src/librustc_errors/annotate_snippet_emitter_writer.rs
+++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs
@@ -23,7 +23,7 @@ pub struct AnnotateSnippetEmitterWriter {
     /// If true, will normalize line numbers with `LL` to prevent noise in UI test diffs.
     ui_testing: bool,
 
-    external_macro_backtrace: bool,
+    macro_backtrace: bool,
 }
 
 impl Emitter for AnnotateSnippetEmitterWriter {
@@ -32,12 +32,12 @@ impl Emitter for AnnotateSnippetEmitterWriter {
         let mut children = diag.children.clone();
         let (mut primary_span, suggestions) = self.primary_span_formatted(&diag);
 
-        self.fix_multispans_in_std_macros(
+        self.fix_multispans_in_extern_macros_and_render_macro_backtrace(
             &self.source_map,
             &mut primary_span,
             &mut children,
             &diag.level,
-            self.external_macro_backtrace,
+            self.macro_backtrace,
         );
 
         self.emit_messages_default(
@@ -172,9 +172,9 @@ impl AnnotateSnippetEmitterWriter {
     pub fn new(
         source_map: Option<Lrc<SourceMap>>,
         short_message: bool,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> Self {
-        Self { source_map, short_message, ui_testing: false, external_macro_backtrace }
+        Self { source_map, short_message, ui_testing: false, macro_backtrace }
     }
 
     /// Allows to modify `Self` to enable or disable the `ui_testing` flag.
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 1fcb36a2a30..f3653da4be6 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -14,7 +14,6 @@ use rustc_span::{MultiSpan, SourceFile, Span};
 
 use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, Style, StyledString};
 use crate::styled_buffer::StyledBuffer;
-use crate::Level::Error;
 use crate::{
     pluralize, CodeSuggestion, Diagnostic, DiagnosticId, Level, SubDiagnostic, SuggestionStyle,
 };
@@ -27,6 +26,7 @@ use std::borrow::Cow;
 use std::cmp::{max, min, Reverse};
 use std::io;
 use std::io::prelude::*;
+use std::iter;
 use std::path::Path;
 use termcolor::{Ansi, BufferWriter, ColorChoice, ColorSpec, StandardStream};
 use termcolor::{Buffer, Color, WriteColor};
@@ -54,19 +54,11 @@ impl HumanReadableErrorType {
         source_map: Option<Lrc<SourceMap>>,
         teach: bool,
         terminal_width: Option<usize>,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> EmitterWriter {
         let (short, color_config) = self.unzip();
         let color = color_config.suggests_using_colors();
-        EmitterWriter::new(
-            dst,
-            source_map,
-            short,
-            teach,
-            color,
-            terminal_width,
-            external_macro_backtrace,
-        )
+        EmitterWriter::new(dst, source_map, short, teach, color, terminal_width, macro_backtrace)
     }
 }
 
@@ -280,10 +272,7 @@ pub trait Emitter {
         }
     }
 
-    // This does a small "fix" for multispans by looking to see if it can find any that
-    // point directly at <*macros>. Since these are often difficult to read, this
-    // will change the span to point at the use site.
-    fn fix_multispans_in_std_macros(
+    fn fix_multispans_in_extern_macros_and_render_macro_backtrace(
         &self,
         source_map: &Option<Lrc<SourceMap>>,
         span: &mut MultiSpan,
@@ -291,127 +280,187 @@ pub trait Emitter {
         level: &Level,
         backtrace: bool,
     ) {
-        let mut spans_updated = self.fix_multispan_in_std_macros(source_map, span, backtrace);
-        for child in children.iter_mut() {
-            spans_updated |=
-                self.fix_multispan_in_std_macros(source_map, &mut child.span, backtrace);
+        // Check for spans in macros, before `fix_multispans_in_extern_macros`
+        // has a chance to replace them.
+        let has_macro_spans = iter::once(&*span)
+            .chain(children.iter().map(|child| &child.span))
+            .flat_map(|span| span.primary_spans())
+            .copied()
+            .flat_map(|sp| {
+                sp.macro_backtrace().filter_map(|expn_data| {
+                    match expn_data.kind {
+                        ExpnKind::Root => None,
+
+                        // Skip past non-macro entries, just in case there
+                        // are some which do actually involve macros.
+                        ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None,
+
+                        ExpnKind::Macro(macro_kind, _) => Some(macro_kind),
+                    }
+                })
+            })
+            .next();
+
+        if !backtrace {
+            self.fix_multispans_in_extern_macros(source_map, span, children);
         }
-        let msg = if level == &Error {
-            "this error originates in a macro outside of the current crate \
-             (in Nightly builds, run with -Z external-macro-backtrace \
-              for more info)"
-                .to_string()
-        } else {
-            "this warning originates in a macro outside of the current crate \
-             (in Nightly builds, run with -Z external-macro-backtrace \
-              for more info)"
-                .to_string()
-        };
 
-        if spans_updated {
-            children.push(SubDiagnostic {
-                level: Level::Note,
-                message: vec![(msg, Style::NoStyle)],
-                span: MultiSpan::new(),
-                render_span: None,
-            });
+        self.render_multispans_macro_backtrace(span, children, backtrace);
+
+        if !backtrace {
+            if let Some(macro_kind) = has_macro_spans {
+                let msg = format!(
+                    "this {} originates in {} {} \
+                    (in Nightly builds, run with -Z macro-backtrace for more info)",
+                    level,
+                    macro_kind.article(),
+                    macro_kind.descr(),
+                );
+
+                children.push(SubDiagnostic {
+                    level: Level::Note,
+                    message: vec![(msg, Style::NoStyle)],
+                    span: MultiSpan::new(),
+                    render_span: None,
+                });
+            }
         }
     }
 
-    // This "fixes" MultiSpans that contain Spans that are pointing to locations inside of
-    // <*macros>. Since these locations are often difficult to read, we move these Spans from
-    // <*macros> to their corresponding use site.
-    fn fix_multispan_in_std_macros(
+    fn render_multispans_macro_backtrace(
         &self,
-        source_map: &Option<Lrc<SourceMap>>,
         span: &mut MultiSpan,
-        always_backtrace: bool,
-    ) -> bool {
-        let sm = match source_map {
-            Some(ref sm) => sm,
-            None => return false,
-        };
+        children: &mut Vec<SubDiagnostic>,
+        backtrace: bool,
+    ) {
+        for span in iter::once(span).chain(children.iter_mut().map(|child| &mut child.span)) {
+            self.render_multispan_macro_backtrace(span, backtrace);
+        }
+    }
 
-        let mut before_after: Vec<(Span, Span)> = vec![];
+    fn render_multispan_macro_backtrace(&self, span: &mut MultiSpan, always_backtrace: bool) {
         let mut new_labels: Vec<(Span, String)> = vec![];
 
-        // First, find all the spans in <*macros> and point instead at their use site
-        for sp in span.primary_spans() {
+        for &sp in span.primary_spans() {
             if sp.is_dummy() {
                 continue;
             }
-            let call_sp = sm.call_span_if_macro(*sp);
-            if call_sp != *sp && !always_backtrace {
-                before_after.push((*sp, call_sp));
-            }
+
+            // FIXME(eddyb) use `retain` on `macro_backtrace` to remove all the
+            // entries we don't want to print, to make sure the indices being
+            // printed are contiguous (or omitted if there's only one entry).
             let macro_backtrace: Vec<_> = sp.macro_backtrace().collect();
-            let backtrace_len = macro_backtrace.len();
             for (i, trace) in macro_backtrace.iter().rev().enumerate() {
-                // Only show macro locations that are local
-                // and display them like a span_note
                 if trace.def_site.is_dummy() {
                     continue;
                 }
+
                 if always_backtrace {
                     new_labels.push((
                         trace.def_site,
                         format!(
                             "in this expansion of `{}`{}",
                             trace.kind.descr(),
-                            if backtrace_len > 2 {
-                                // if backtrace_len == 1 it'll be pointed
-                                // at by "in this macro invocation"
+                            if macro_backtrace.len() > 2 {
+                                // if macro_backtrace.len() == 1 it'll be
+                                // pointed at by "in this macro invocation"
                                 format!(" (#{})", i + 1)
                             } else {
                                 String::new()
-                            }
+                            },
                         ),
                     ));
                 }
-                // Check to make sure we're not in any <*macros>
-                if !sm.span_to_filename(trace.def_site).is_macros()
-                    && matches!(trace.kind, ExpnKind::Macro(MacroKind::Bang, _))
+
+                // Don't add a label on the call site if the diagnostic itself
+                // already points to (a part of) that call site, as the label
+                // is meant for showing the relevant invocation when the actual
+                // diagnostic is pointing to some part of macro definition.
+                //
+                // This also handles the case where an external span got replaced
+                // with the call site span by `fix_multispans_in_extern_macros`.
+                //
+                // NB: `-Zmacro-backtrace` overrides this, for uniformity, as the
+                // "in this expansion of" label above is always added in that mode,
+                // and it needs an "in this macro invocation" label to match that.
+                let redundant_span = trace.call_site.contains(sp);
+
+                if !redundant_span && matches!(trace.kind, ExpnKind::Macro(MacroKind::Bang, _))
                     || always_backtrace
                 {
                     new_labels.push((
                         trace.call_site,
                         format!(
                             "in this macro invocation{}",
-                            if backtrace_len > 2 && always_backtrace {
+                            if macro_backtrace.len() > 2 && always_backtrace {
                                 // only specify order when the macro
                                 // backtrace is multiple levels deep
                                 format!(" (#{})", i + 1)
                             } else {
                                 String::new()
-                            }
+                            },
                         ),
                     ));
-                    if !always_backtrace {
-                        break;
-                    }
+                }
+                if !always_backtrace {
+                    break;
                 }
             }
         }
+
         for (label_span, label_text) in new_labels {
             span.push_span_label(label_span, label_text);
         }
-        for sp_label in span.span_labels() {
-            if sp_label.span.is_dummy() {
-                continue;
-            }
-            if sm.span_to_filename(sp_label.span.clone()).is_macros() && !always_backtrace {
-                if let Some(use_site) = sp_label.span.macro_backtrace().last() {
-                    before_after.push((sp_label.span, use_site.call_site));
-                }
-            }
+    }
+
+    // This does a small "fix" for multispans by looking to see if it can find any that
+    // point directly at <*macros>. Since these are often difficult to read, this
+    // will change the span to point at the use site.
+    fn fix_multispans_in_extern_macros(
+        &self,
+        source_map: &Option<Lrc<SourceMap>>,
+        span: &mut MultiSpan,
+        children: &mut Vec<SubDiagnostic>,
+    ) {
+        for span in iter::once(span).chain(children.iter_mut().map(|child| &mut child.span)) {
+            self.fix_multispan_in_extern_macros(source_map, span);
         }
+    }
+
+    // This "fixes" MultiSpans that contain Spans that are pointing to locations inside of
+    // <*macros>. Since these locations are often difficult to read, we move these Spans from
+    // <*macros> to their corresponding use site.
+    fn fix_multispan_in_extern_macros(
+        &self,
+        source_map: &Option<Lrc<SourceMap>>,
+        span: &mut MultiSpan,
+    ) {
+        let sm = match source_map {
+            Some(ref sm) => sm,
+            None => return,
+        };
+
+        // First, find all the spans in <*macros> and point instead at their use site
+        let replacements: Vec<(Span, Span)> = span
+            .primary_spans()
+            .iter()
+            .copied()
+            .chain(span.span_labels().iter().map(|sp_label| sp_label.span))
+            .filter_map(|sp| {
+                if !sp.is_dummy() && sm.span_to_filename(sp).is_macros() {
+                    let maybe_callsite = sp.source_callsite();
+                    if sp != maybe_callsite {
+                        return Some((sp, maybe_callsite));
+                    }
+                }
+                None
+            })
+            .collect();
+
         // After we have them, make sure we replace these 'bad' def sites with their use sites
-        let spans_updated = !before_after.is_empty();
-        for (before, after) in before_after {
-            span.replace(before, after);
+        for (from, to) in replacements {
+            span.replace(from, to);
         }
-
-        spans_updated
     }
 }
 
@@ -424,12 +473,12 @@ impl Emitter for EmitterWriter {
         let mut children = diag.children.clone();
         let (mut primary_span, suggestions) = self.primary_span_formatted(&diag);
 
-        self.fix_multispans_in_std_macros(
+        self.fix_multispans_in_extern_macros_and_render_macro_backtrace(
             &self.sm,
             &mut primary_span,
             &mut children,
             &diag.level,
-            self.external_macro_backtrace,
+            self.macro_backtrace,
         );
 
         self.emit_messages_default(
@@ -508,7 +557,7 @@ pub struct EmitterWriter {
     ui_testing: bool,
     terminal_width: Option<usize>,
 
-    external_macro_backtrace: bool,
+    macro_backtrace: bool,
 }
 
 #[derive(Debug)]
@@ -525,7 +574,7 @@ impl EmitterWriter {
         short_message: bool,
         teach: bool,
         terminal_width: Option<usize>,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> EmitterWriter {
         let dst = Destination::from_stderr(color_config);
         EmitterWriter {
@@ -535,7 +584,7 @@ impl EmitterWriter {
             teach,
             ui_testing: false,
             terminal_width,
-            external_macro_backtrace,
+            macro_backtrace,
         }
     }
 
@@ -546,7 +595,7 @@ impl EmitterWriter {
         teach: bool,
         colored: bool,
         terminal_width: Option<usize>,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> EmitterWriter {
         EmitterWriter {
             dst: Raw(dst, colored),
@@ -555,7 +604,7 @@ impl EmitterWriter {
             teach,
             ui_testing: false,
             terminal_width,
-            external_macro_backtrace,
+            macro_backtrace,
         }
     }
 
diff --git a/src/librustc_errors/json.rs b/src/librustc_errors/json.rs
index 3ddf9b09893..ffdff6acec5 100644
--- a/src/librustc_errors/json.rs
+++ b/src/librustc_errors/json.rs
@@ -36,7 +36,7 @@ pub struct JsonEmitter {
     pretty: bool,
     ui_testing: bool,
     json_rendered: HumanReadableErrorType,
-    external_macro_backtrace: bool,
+    macro_backtrace: bool,
 }
 
 impl JsonEmitter {
@@ -45,7 +45,7 @@ impl JsonEmitter {
         source_map: Lrc<SourceMap>,
         pretty: bool,
         json_rendered: HumanReadableErrorType,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> JsonEmitter {
         JsonEmitter {
             dst: Box::new(io::stderr()),
@@ -54,14 +54,14 @@ impl JsonEmitter {
             pretty,
             ui_testing: false,
             json_rendered,
-            external_macro_backtrace,
+            macro_backtrace,
         }
     }
 
     pub fn basic(
         pretty: bool,
         json_rendered: HumanReadableErrorType,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> JsonEmitter {
         let file_path_mapping = FilePathMapping::empty();
         JsonEmitter::stderr(
@@ -69,7 +69,7 @@ impl JsonEmitter {
             Lrc::new(SourceMap::new(file_path_mapping)),
             pretty,
             json_rendered,
-            external_macro_backtrace,
+            macro_backtrace,
         )
     }
 
@@ -79,7 +79,7 @@ impl JsonEmitter {
         source_map: Lrc<SourceMap>,
         pretty: bool,
         json_rendered: HumanReadableErrorType,
-        external_macro_backtrace: bool,
+        macro_backtrace: bool,
     ) -> JsonEmitter {
         JsonEmitter {
             dst,
@@ -88,7 +88,7 @@ impl JsonEmitter {
             pretty,
             ui_testing: false,
             json_rendered,
-            external_macro_backtrace,
+            macro_backtrace,
         }
     }
 
@@ -245,13 +245,7 @@ impl Diagnostic {
         let buf = BufWriter::default();
         let output = buf.clone();
         je.json_rendered
-            .new_emitter(
-                Box::new(buf),
-                Some(je.sm.clone()),
-                false,
-                None,
-                je.external_macro_backtrace,
-            )
+            .new_emitter(Box::new(buf), Some(je.sm.clone()), false, None, je.macro_backtrace)
             .ui_testing(je.ui_testing)
             .emit_diagnostic(diag);
         let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index 17b293401f8..97667febc3c 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -336,9 +336,9 @@ pub struct HandlerFlags {
     /// If true, immediately print bugs registered with `delay_span_bug`.
     /// (rustc: see `-Z report-delayed-bugs`)
     pub report_delayed_bugs: bool,
-    /// show macro backtraces even for non-local macros.
-    /// (rustc: see `-Z external-macro-backtrace`)
-    pub external_macro_backtrace: bool,
+    /// Show macro backtraces.
+    /// (rustc: see `-Z macro-backtrace`)
+    pub macro_backtrace: bool,
     /// If true, identical diagnostics are reported only once.
     pub deduplicate_diagnostics: bool,
 }
@@ -385,7 +385,7 @@ impl Handler {
             false,
             false,
             None,
-            flags.external_macro_backtrace,
+            flags.macro_backtrace,
         ));
         Self::with_emitter_and_flags(emitter, flags)
     }
diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs
index 4ae79f9ccaa..d7fd15a8a7b 100644
--- a/src/librustc_feature/active.rs
+++ b/src/librustc_feature/active.rs
@@ -541,6 +541,9 @@ declare_features! (
     /// Allows `T: ?const Trait` syntax in bounds.
     (active, const_trait_bound_opt_out, "1.42.0", Some(67794), None),
 
+    /// Allows the use of `no_sanitize` attribute.
+    (active, no_sanitize, "1.42.0", Some(39699), None),
+
     // -------------------------------------------------------------------------
     // feature-group-end: actual feature gates
     // -------------------------------------------------------------------------
diff --git a/src/librustc_feature/builtin_attrs.rs b/src/librustc_feature/builtin_attrs.rs
index a38726e3de8..e2e061c185c 100644
--- a/src/librustc_feature/builtin_attrs.rs
+++ b/src/librustc_feature/builtin_attrs.rs
@@ -261,6 +261,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     ungated!(cold, Whitelisted, template!(Word)),
     ungated!(no_builtins, Whitelisted, template!(Word)),
     ungated!(target_feature, Whitelisted, template!(List: r#"enable = "name""#)),
+    gated!(
+        no_sanitize, Whitelisted,
+        template!(List: "address, memory, thread"),
+        experimental!(no_sanitize)
+    ),
 
     // FIXME: #14408 whitelist docs since rustdoc looks at them
     ungated!(doc, Whitelisted, template!(List: "hidden|inline|...", NameValueStr: "string")),
diff --git a/src/librustc_index/vec.rs b/src/librustc_index/vec.rs
index d14bafb44fd..1dfe97238a3 100644
--- a/src/librustc_index/vec.rs
+++ b/src/librustc_index/vec.rs
@@ -574,6 +574,14 @@ impl<I: Idx, T> IndexVec<I, T> {
         IndexVec { raw: vec![elem; n], _marker: PhantomData }
     }
 
+    /// Create an `IndexVec` with `n` elements, where the value of each
+    /// element is the result of `func(i)`
+    #[inline]
+    pub fn from_fn_n(func: impl FnMut(I) -> T, n: usize) -> Self {
+        let indices = (0..n).map(I::new);
+        Self::from_raw(indices.map(func).collect())
+    }
+
     #[inline]
     pub fn push(&mut self, d: T) -> I {
         let idx = I::new(self.len());
diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs
index bf8bcd71efa..6224c4654d6 100644
--- a/src/librustc_interface/passes.rs
+++ b/src/librustc_interface/passes.rs
@@ -25,6 +25,7 @@ use rustc_data_structures::{box_region_allow_access, declare_box_region_type, pa
 use rustc_errors::PResult;
 use rustc_expand::base::ExtCtxt;
 use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
+use rustc_hir::Crate;
 use rustc_lint::LintStore;
 use rustc_mir as mir;
 use rustc_mir_build as mir_build;
@@ -422,7 +423,7 @@ pub fn lower_to_hir<'res, 'tcx>(
     dep_graph: &'res DepGraph,
     krate: &'res ast::Crate,
     arena: &'tcx Arena<'tcx>,
-) -> Result<map::Forest<'tcx>> {
+) -> Crate<'tcx> {
     // Lower AST to HIR.
     let hir_crate = rustc_ast_lowering::lower_crate(
         sess,
@@ -437,8 +438,6 @@ pub fn lower_to_hir<'res, 'tcx>(
         hir_stats::print_hir_stats(&hir_crate);
     }
 
-    let hir_forest = map::Forest::new(hir_crate, &dep_graph);
-
     sess.time("early_lint_checks", || {
         rustc_lint::check_ast_crate(
             sess,
@@ -455,7 +454,7 @@ pub fn lower_to_hir<'res, 'tcx>(
         rustc_span::hygiene::clear_syntax_context_map();
     }
 
-    Ok(hir_forest)
+    hir_crate
 }
 
 // Returns all the paths that correspond to generated files.
@@ -705,7 +704,8 @@ impl<'tcx> QueryContext<'tcx> {
 pub fn create_global_ctxt<'tcx>(
     compiler: &'tcx Compiler,
     lint_store: Lrc<LintStore>,
-    hir_forest: &'tcx map::Forest<'tcx>,
+    krate: &'tcx Crate<'tcx>,
+    dep_graph: DepGraph,
     mut resolver_outputs: ResolverOutputs,
     outputs: OutputFilenames,
     crate_name: &str,
@@ -716,7 +716,7 @@ pub fn create_global_ctxt<'tcx>(
     let defs = mem::take(&mut resolver_outputs.definitions);
 
     // Construct the HIR map.
-    let hir_map = map::map_crate(sess, &*resolver_outputs.cstore, &hir_forest, defs);
+    let hir_map = map::map_crate(sess, &*resolver_outputs.cstore, krate, dep_graph, defs);
 
     let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess);
 
diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs
index 2ac2845be91..720d162ac81 100644
--- a/src/librustc_interface/queries.rs
+++ b/src/librustc_interface/queries.rs
@@ -3,7 +3,6 @@ use crate::passes::{self, BoxedResolver, QueryContext};
 
 use rustc::arena::Arena;
 use rustc::dep_graph::DepGraph;
-use rustc::hir::map;
 use rustc::session::config::{OutputFilenames, OutputType};
 use rustc::session::Session;
 use rustc::ty::steal::Steal;
@@ -12,6 +11,7 @@ use rustc::util::common::ErrorReported;
 use rustc_codegen_utils::codegen_backend::CodegenBackend;
 use rustc_data_structures::sync::{Lrc, Once, WorkerLocal};
 use rustc_hir::def_id::LOCAL_CRATE;
+use rustc_hir::Crate;
 use rustc_incremental::DepGraphFuture;
 use rustc_lint::LintStore;
 use std::any::Any;
@@ -74,7 +74,7 @@ pub struct Queries<'tcx> {
     register_plugins: Query<(ast::Crate, Lrc<LintStore>)>,
     expansion: Query<(ast::Crate, Steal<Rc<RefCell<BoxedResolver>>>, Lrc<LintStore>)>,
     dep_graph: Query<DepGraph>,
-    lower_to_hir: Query<(&'tcx map::Forest<'tcx>, Steal<ResolverOutputs>)>,
+    lower_to_hir: Query<(&'tcx Crate<'tcx>, Steal<ResolverOutputs>)>,
     prepare_outputs: Query<OutputFilenames>,
     global_ctxt: Query<QueryContext<'tcx>>,
     ongoing_codegen: Query<Box<dyn Any>>,
@@ -207,9 +207,7 @@ impl<'tcx> Queries<'tcx> {
         })
     }
 
-    pub fn lower_to_hir(
-        &'tcx self,
-    ) -> Result<&Query<(&'tcx map::Forest<'tcx>, Steal<ResolverOutputs>)>> {
+    pub fn lower_to_hir(&'tcx self) -> Result<&Query<(&'tcx Crate<'tcx>, Steal<ResolverOutputs>)>> {
         self.lower_to_hir.compute(|| {
             let expansion_result = self.expansion()?;
             let peeked = expansion_result.peek();
@@ -217,14 +215,14 @@ impl<'tcx> Queries<'tcx> {
             let resolver = peeked.1.steal();
             let lint_store = &peeked.2;
             let hir = resolver.borrow_mut().access(|resolver| {
-                passes::lower_to_hir(
+                Ok(passes::lower_to_hir(
                     self.session(),
                     lint_store,
                     resolver,
                     &*self.dep_graph()?.peek(),
                     &krate,
                     &self.arena,
-                )
+                ))
             })?;
             let hir = self.arena.alloc(hir);
             Ok((hir, Steal::new(BoxedResolver::to_resolver_outputs(resolver))))
@@ -253,12 +251,14 @@ impl<'tcx> Queries<'tcx> {
             let outputs = self.prepare_outputs()?.peek().clone();
             let lint_store = self.expansion()?.peek().2.clone();
             let hir = self.lower_to_hir()?.peek();
-            let (ref hir_forest, ref resolver_outputs) = &*hir;
+            let dep_graph = self.dep_graph()?.peek().clone();
+            let (ref krate, ref resolver_outputs) = &*hir;
             let _timer = self.session().timer("create_global_ctxt");
             Ok(passes::create_global_ctxt(
                 self.compiler,
                 lint_store,
-                hir_forest,
+                krate,
+                dep_graph,
                 resolver_outputs.steal(),
                 outputs,
                 &crate_name,
diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs
index 54fbdb14010..4133047af78 100644
--- a/src/librustc_metadata/rmeta/encoder.rs
+++ b/src/librustc_metadata/rmeta/encoder.rs
@@ -796,7 +796,7 @@ impl EncodeContext<'tcx> {
         record!(self.per_def.kind[def_id] <- match trait_item.kind {
             ty::AssocKind::Const => {
                 let rendered =
-                    hir::print::to_string(self.tcx.hir(), |s| s.print_trait_item(ast_item));
+                    hir::print::to_string(&self.tcx.hir(), |s| s.print_trait_item(ast_item));
                 let rendered_const = self.lazy(RenderedConst(rendered));
 
                 EntryKind::AssocConst(
@@ -1009,7 +1009,7 @@ impl EncodeContext<'tcx> {
 
     fn encode_rendered_const_for_body(&mut self, body_id: hir::BodyId) -> Lazy<RenderedConst> {
         let body = self.tcx.hir().body(body_id);
-        let rendered = hir::print::to_string(self.tcx.hir(), |s| s.print_expr(&body.value));
+        let rendered = hir::print::to_string(&self.tcx.hir(), |s| s.print_expr(&body.value));
         let rendered_const = &RenderedConst(rendered);
         self.lazy(rendered_const)
     }
diff --git a/src/librustc_mir/borrow_check/diagnostics/region_name.rs b/src/librustc_mir/borrow_check/diagnostics/region_name.rs
index 47eb2d8940a..09d61d9ad9a 100644
--- a/src/librustc_mir/borrow_check/diagnostics/region_name.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/region_name.rs
@@ -291,7 +291,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
             | ty::ReScope(..)
             | ty::ReVar(..)
             | ty::RePlaceholder(..)
-            | ty::ReEmpty
+            | ty::ReEmpty(_)
             | ty::ReErased
             | ty::ReClosureBound(..) => None,
         }
diff --git a/src/librustc_mir/borrow_check/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs
index bb56c11872a..392f164d314 100644
--- a/src/librustc_mir/borrow_check/invalidation.rs
+++ b/src/librustc_mir/borrow_check/invalidation.rs
@@ -159,7 +159,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
                     self.consume_operand(location, index);
                 }
             }
-            TerminatorKind::Yield { ref value, resume, drop: _ } => {
+            TerminatorKind::Yield { ref value, resume, resume_arg, drop: _ } => {
                 self.consume_operand(location, value);
 
                 // Invalidate all borrows of local places
@@ -170,6 +170,8 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
                         self.all_facts.invalidates.push((resume, i));
                     }
                 }
+
+                self.mutate_place(location, resume_arg, Deep, JustWrite);
             }
             TerminatorKind::Resume | TerminatorKind::Return | TerminatorKind::GeneratorDrop => {
                 // Invalidate all borrows of local places
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 717359d75c3..e528159fcef 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -684,7 +684,7 @@ impl<'cx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx
                 }
             }
 
-            TerminatorKind::Yield { ref value, resume: _, drop: _ } => {
+            TerminatorKind::Yield { ref value, resume: _, ref resume_arg, drop: _ } => {
                 self.consume_operand(loc, (value, span), flow_state);
 
                 if self.movable_generator {
@@ -697,6 +697,8 @@ impl<'cx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx
                         }
                     });
                 }
+
+                self.mutate_place(loc, (resume_arg, span), Deep, JustWrite, flow_state);
             }
 
             TerminatorKind::Resume | TerminatorKind::Return | TerminatorKind::GeneratorDrop => {
diff --git a/src/librustc_mir/borrow_check/region_infer/mod.rs b/src/librustc_mir/borrow_check/region_infer/mod.rs
index 26d9cf2e045..6abca481eac 100644
--- a/src/librustc_mir/borrow_check/region_infer/mod.rs
+++ b/src/librustc_mir/borrow_check/region_infer/mod.rs
@@ -1108,6 +1108,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
                 self.eval_if_eq(tcx, body, generic_ty, lower_bound, test_ty, verify_bound1)
             }
 
+            VerifyBound::IsEmpty => {
+                let lower_bound_scc = self.constraint_sccs.scc(lower_bound);
+                self.scc_values.elements_contained_in(lower_bound_scc).next().is_none()
+            }
+
             VerifyBound::OutlivedBy(r) => {
                 let r_vid = self.to_region_vid(r);
                 self.eval_outlives(r_vid, lower_bound)
diff --git a/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
index 8f65a0f01c6..a3e38cd7a5f 100644
--- a/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
+++ b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
@@ -160,7 +160,8 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
         a: ty::Region<'tcx>,
         b: ty::Region<'tcx>,
     ) {
-        if let ty::ReEmpty = a {
+        // FIXME -- this is not the fix I would prefer
+        if let ty::ReEmpty(ty::UniverseIndex::ROOT) = a {
             return;
         }
         let b = self.to_region_vid(b);
@@ -175,7 +176,8 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
         a: ty::Region<'tcx>,
         bound: VerifyBound<'tcx>,
     ) {
-        if let ty::ReEmpty = a {
+        // FIXME: I'd prefer if NLL had a notion of empty
+        if let ty::ReEmpty(ty::UniverseIndex::ROOT) = a {
             return;
         }
         let type_test = self.verify_to_type_test(kind, a, bound);
diff --git a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
index f0dc94f417c..cf8c3449d66 100644
--- a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
+++ b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
@@ -5,7 +5,7 @@ use rustc::mir::ConstraintCategory;
 use rustc::traits::query::outlives_bounds::{self, OutlivesBound};
 use rustc::traits::query::type_op::{self, TypeOp};
 use rustc::ty::free_region_map::FreeRegionRelations;
-use rustc::ty::{self, RegionVid, Ty};
+use rustc::ty::{self, RegionVid, Ty, TyCtxt};
 use rustc_data_structures::transitive_relation::TransitiveRelation;
 use rustc_span::DUMMY_SP;
 use std::rc::Rc;
@@ -333,7 +333,7 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
                     // `where Type:` is lowered to `where Type: 'empty` so that
                     // we check `Type` is well formed, but there's no use for
                     // this bound here.
-                    if let ty::ReEmpty = r1 {
+                    if let ty::ReEmpty(_) = r1 {
                         return;
                     }
 
@@ -359,7 +359,12 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
 /// over the `FreeRegionMap` from lexical regions and
 /// `UniversalRegions` (from NLL)`.
 impl<'tcx> FreeRegionRelations<'tcx> for UniversalRegionRelations<'tcx> {
-    fn sub_free_regions(&self, shorter: ty::Region<'tcx>, longer: ty::Region<'tcx>) -> bool {
+    fn sub_free_regions(
+        &self,
+        _tcx: TyCtxt<'tcx>,
+        shorter: ty::Region<'tcx>,
+        longer: ty::Region<'tcx>,
+    ) -> bool {
         let shorter = shorter.to_region_vid();
         assert!(self.universal_regions.is_universal_region(shorter));
         let longer = longer.to_region_vid();
diff --git a/src/librustc_mir/borrow_check/universal_regions.rs b/src/librustc_mir/borrow_check/universal_regions.rs
index 6e36508ed60..f6e3ca2f809 100644
--- a/src/librustc_mir/borrow_check/universal_regions.rs
+++ b/src/librustc_mir/borrow_check/universal_regions.rs
@@ -581,9 +581,11 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
 
             DefiningTy::Generator(def_id, substs, movability) => {
                 assert_eq!(self.mir_def_id, def_id);
+                let resume_ty = substs.as_generator().resume_ty(def_id, tcx);
                 let output = substs.as_generator().return_ty(def_id, tcx);
                 let generator_ty = tcx.mk_generator(def_id, substs, movability);
-                let inputs_and_output = self.infcx.tcx.intern_type_list(&[generator_ty, output]);
+                let inputs_and_output =
+                    self.infcx.tcx.intern_type_list(&[generator_ty, resume_ty, output]);
                 ty::Binder::dummy(inputs_and_output)
             }
 
diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs
index 6a48d1e9803..040c13e8210 100644
--- a/src/librustc_mir/dataflow/impls/storage_liveness.rs
+++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs
@@ -31,10 +31,12 @@ impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> {
         self.body.local_decls.len()
     }
 
-    fn start_block_effect(&self, _on_entry: &mut BitSet<Local>) {
-        // Nothing is live on function entry (generators only have a self
-        // argument, and we don't care about that)
-        assert_eq!(1, self.body.arg_count);
+    fn start_block_effect(&self, on_entry: &mut BitSet<Local>) {
+        // The resume argument is live on function entry (we don't care about
+        // the `self` argument)
+        for arg in self.body.args_iter().skip(1) {
+            on_entry.insert(arg);
+        }
     }
 
     fn statement_effect(&self, trans: &mut GenKillSet<Local>, loc: Location) {
@@ -100,10 +102,12 @@ impl<'mir, 'tcx> BitDenotation<'tcx> for RequiresStorage<'mir, 'tcx> {
         self.body.local_decls.len()
     }
 
-    fn start_block_effect(&self, _sets: &mut BitSet<Local>) {
-        // Nothing is live on function entry (generators only have a self
-        // argument, and we don't care about that)
-        assert_eq!(1, self.body.arg_count);
+    fn start_block_effect(&self, on_entry: &mut BitSet<Local>) {
+        // The resume argument is live on function entry (we don't care about
+        // the `self` argument)
+        for arg in self.body.args_iter().skip(1) {
+            on_entry.insert(arg);
+        }
     }
 
     fn before_statement_effect(&self, sets: &mut GenKillSet<Self::Idx>, loc: Location) {
diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs
index 62af196174f..6f8caca5e21 100644
--- a/src/librustc_mir/dataflow/move_paths/builder.rs
+++ b/src/librustc_mir/dataflow/move_paths/builder.rs
@@ -380,7 +380,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
                 self.gather_operand(discr);
             }
 
-            TerminatorKind::Yield { ref value, .. } => {
+            TerminatorKind::Yield { ref value, resume_arg: ref place, .. } => {
+                self.create_move_path(place);
+                self.gather_init(place.as_ref(), InitKind::Deep);
                 self.gather_operand(value);
             }
 
diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs
index 1c86d6f3f65..a6fc6573178 100644
--- a/src/librustc_mir/transform/generator.rs
+++ b/src/librustc_mir/transform/generator.rs
@@ -192,9 +192,10 @@ const RETURNED: usize = GeneratorSubsts::RETURNED;
 /// Generator has been poisoned
 const POISONED: usize = GeneratorSubsts::POISONED;
 
-struct SuspensionPoint {
+struct SuspensionPoint<'tcx> {
     state: usize,
     resume: BasicBlock,
+    resume_arg: Place<'tcx>,
     drop: Option<BasicBlock>,
     storage_liveness: liveness::LiveVarSet,
 }
@@ -216,7 +217,7 @@ struct TransformVisitor<'tcx> {
     storage_liveness: FxHashMap<BasicBlock, liveness::LiveVarSet>,
 
     // A list of suspension points, generated during the transform
-    suspension_points: Vec<SuspensionPoint>,
+    suspension_points: Vec<SuspensionPoint<'tcx>>,
 
     // The original RETURN_PLACE local
     new_ret_local: Local,
@@ -303,8 +304,8 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> {
                 Operand::Move(Place::from(self.new_ret_local)),
                 None,
             )),
-            TerminatorKind::Yield { ref value, resume, drop } => {
-                Some((VariantIdx::new(0), Some(resume), value.clone(), drop))
+            TerminatorKind::Yield { ref value, resume, resume_arg, drop } => {
+                Some((VariantIdx::new(0), Some((resume, resume_arg)), value.clone(), drop))
             }
             _ => None,
         };
@@ -319,13 +320,14 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> {
                     self.make_state(state_idx, v),
                 )),
             });
-            let state = if let Some(resume) = resume {
+            let state = if let Some((resume, resume_arg)) = resume {
                 // Yield
                 let state = 3 + self.suspension_points.len();
 
                 self.suspension_points.push(SuspensionPoint {
                     state,
                     resume,
+                    resume_arg,
                     drop,
                     storage_liveness: self.storage_liveness.get(&block).unwrap().clone(),
                 });
@@ -378,28 +380,35 @@ fn make_generator_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body
     PinArgVisitor { ref_gen_ty, tcx }.visit_body(body);
 }
 
-fn replace_result_variable<'tcx>(
-    ret_ty: Ty<'tcx>,
+/// Allocates a new local and replaces all references of `local` with it. Returns the new local.
+///
+/// `local` will be changed to a new local decl with type `ty`.
+///
+/// Note that the new local will be uninitialized. It is the caller's responsibility to assign some
+/// valid value to it before its first use.
+fn replace_local<'tcx>(
+    local: Local,
+    ty: Ty<'tcx>,
     body: &mut BodyAndCache<'tcx>,
     tcx: TyCtxt<'tcx>,
 ) -> Local {
     let source_info = source_info(body);
-    let new_ret = LocalDecl {
+    let new_decl = LocalDecl {
         mutability: Mutability::Mut,
-        ty: ret_ty,
+        ty,
         user_ty: UserTypeProjections::none(),
         source_info,
         internal: false,
         is_block_tail: None,
         local_info: LocalInfo::Other,
     };
-    let new_ret_local = Local::new(body.local_decls.len());
-    body.local_decls.push(new_ret);
-    body.local_decls.swap(RETURN_PLACE, new_ret_local);
+    let new_local = Local::new(body.local_decls.len());
+    body.local_decls.push(new_decl);
+    body.local_decls.swap(local, new_local);
 
-    RenameLocalVisitor { from: RETURN_PLACE, to: new_ret_local, tcx }.visit_body(body);
+    RenameLocalVisitor { from: local, to: new_local, tcx }.visit_body(body);
 
-    new_ret_local
+    new_local
 }
 
 struct StorageIgnored(liveness::LiveVarSet);
@@ -792,6 +801,10 @@ fn compute_layout<'tcx>(
     (remap, layout, storage_liveness)
 }
 
+/// Replaces the entry point of `body` with a block that switches on the generator discriminant and
+/// dispatches to blocks according to `cases`.
+///
+/// After this function, the former entry point of the function will be bb1.
 fn insert_switch<'tcx>(
     body: &mut BodyAndCache<'tcx>,
     cases: Vec<(usize, BasicBlock)>,
@@ -885,10 +898,11 @@ fn create_generator_drop_shim<'tcx>(
     drop_clean: BasicBlock,
 ) -> BodyAndCache<'tcx> {
     let mut body = body.clone();
+    body.arg_count = 1; // make sure the resume argument is not included here
 
     let source_info = source_info(&body);
 
-    let mut cases = create_cases(&mut body, transform, |point| point.drop);
+    let mut cases = create_cases(&mut body, transform, Operation::Drop);
 
     cases.insert(0, (UNRESUMED, drop_clean));
 
@@ -1006,7 +1020,7 @@ fn create_generator_resume_function<'tcx>(
         }
     }
 
-    let mut cases = create_cases(body, &transform, |point| Some(point.resume));
+    let mut cases = create_cases(body, &transform, Operation::Resume);
 
     use rustc::mir::interpret::PanicInfo::{ResumedAfterPanic, ResumedAfterReturn};
 
@@ -1056,14 +1070,27 @@ fn insert_clean_drop(body: &mut BodyAndCache<'_>) -> BasicBlock {
     drop_clean
 }
 
-fn create_cases<'tcx, F>(
+/// An operation that can be performed on a generator.
+#[derive(PartialEq, Copy, Clone)]
+enum Operation {
+    Resume,
+    Drop,
+}
+
+impl Operation {
+    fn target_block(self, point: &SuspensionPoint<'_>) -> Option<BasicBlock> {
+        match self {
+            Operation::Resume => Some(point.resume),
+            Operation::Drop => point.drop,
+        }
+    }
+}
+
+fn create_cases<'tcx>(
     body: &mut BodyAndCache<'tcx>,
     transform: &TransformVisitor<'tcx>,
-    target: F,
-) -> Vec<(usize, BasicBlock)>
-where
-    F: Fn(&SuspensionPoint) -> Option<BasicBlock>,
-{
+    operation: Operation,
+) -> Vec<(usize, BasicBlock)> {
     let source_info = source_info(body);
 
     transform
@@ -1071,12 +1098,19 @@ where
         .iter()
         .filter_map(|point| {
             // Find the target for this suspension point, if applicable
-            target(point).map(|target| {
+            operation.target_block(point).map(|target| {
                 let block = BasicBlock::new(body.basic_blocks().len());
                 let mut statements = Vec::new();
 
                 // Create StorageLive instructions for locals with live storage
                 for i in 0..(body.local_decls.len()) {
+                    if i == 2 {
+                        // The resume argument is live on function entry. Don't insert a
+                        // `StorageLive`, or the following `Assign` will read from uninitialized
+                        // memory.
+                        continue;
+                    }
+
                     let l = Local::new(i);
                     if point.storage_liveness.contains(l) && !transform.remap.contains_key(&l) {
                         statements
@@ -1084,6 +1118,18 @@ where
                     }
                 }
 
+                if operation == Operation::Resume {
+                    // Move the resume argument to the destination place of the `Yield` terminator
+                    let resume_arg = Local::new(2); // 0 = return, 1 = self
+                    statements.push(Statement {
+                        source_info,
+                        kind: StatementKind::Assign(box (
+                            point.resume_arg,
+                            Rvalue::Use(Operand::Move(resume_arg.into())),
+                        )),
+                    });
+                }
+
                 // Then jump to the real target
                 body.basic_blocks_mut().push(BasicBlockData {
                     statements,
@@ -1138,7 +1184,29 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
 
         // We rename RETURN_PLACE which has type mir.return_ty to new_ret_local
         // RETURN_PLACE then is a fresh unused local with type ret_ty.
-        let new_ret_local = replace_result_variable(ret_ty, body, tcx);
+        let new_ret_local = replace_local(RETURN_PLACE, ret_ty, body, tcx);
+
+        // We also replace the resume argument and insert an `Assign`.
+        // This is needed because the resume argument `_2` might be live across a `yield`, in which
+        // case there is no `Assign` to it that the transform can turn into a store to the generator
+        // state. After the yield the slot in the generator state would then be uninitialized.
+        let resume_local = Local::new(2);
+        let new_resume_local =
+            replace_local(resume_local, body.local_decls[resume_local].ty, body, tcx);
+
+        // When first entering the generator, move the resume argument into its new local.
+        let source_info = source_info(body);
+        let stmts = &mut body.basic_blocks_mut()[BasicBlock::new(0)].statements;
+        stmts.insert(
+            0,
+            Statement {
+                source_info,
+                kind: StatementKind::Assign(box (
+                    new_resume_local.into(),
+                    Rvalue::Use(Operand::Move(resume_local.into())),
+                )),
+            },
+        );
 
         // Extract locals which are live across suspension point into `layout`
         // `remap` gives a mapping from local indices onto generator struct indices
@@ -1162,9 +1230,9 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
         };
         transform.visit_body(body);
 
-        // Update our MIR struct to reflect the changed we've made
+        // Update our MIR struct to reflect the changes we've made
         body.yield_ty = None;
-        body.arg_count = 1;
+        body.arg_count = 2; // self, resume arg
         body.spread_arg = None;
         body.generator_layout = Some(layout);
 
diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs
index a3cafcb5763..b6802505df7 100644
--- a/src/librustc_mir/transform/inline.rs
+++ b/src/librustc_mir/transform/inline.rs
@@ -8,6 +8,7 @@ use rustc_index::vec::{Idx, IndexVec};
 use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
 use rustc::mir::visit::*;
 use rustc::mir::*;
+use rustc::session::config::Sanitizer;
 use rustc::ty::subst::{InternalSubsts, Subst, SubstsRef};
 use rustc::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt, TypeFoldable};
 
@@ -228,6 +229,28 @@ impl Inliner<'tcx> {
             return false;
         }
 
+        // Avoid inlining functions marked as no_sanitize if sanitizer is enabled,
+        // since instrumentation might be enabled and performed on the caller.
+        match self.tcx.sess.opts.debugging_opts.sanitizer {
+            Some(Sanitizer::Address) => {
+                if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_SANITIZE_ADDRESS) {
+                    return false;
+                }
+            }
+            Some(Sanitizer::Memory) => {
+                if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_SANITIZE_MEMORY) {
+                    return false;
+                }
+            }
+            Some(Sanitizer::Thread) => {
+                if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_SANITIZE_THREAD) {
+                    return false;
+                }
+            }
+            Some(Sanitizer::Leak) => {}
+            None => {}
+        }
+
         let hinted = match codegen_fn_attrs.inline {
             // Just treat inline(always) as a hint for now,
             // there are cases that prevent inlining that we
diff --git a/src/librustc_mir_build/build/expr/as_rvalue.rs b/src/librustc_mir_build/build/expr/as_rvalue.rs
index 16795b459b6..6f5c5f0dd4c 100644
--- a/src/librustc_mir_build/build/expr/as_rvalue.rs
+++ b/src/librustc_mir_build/build/expr/as_rvalue.rs
@@ -230,18 +230,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 block = unpack!(this.stmt_expr(block, expr, None));
                 block.and(this.unit_rvalue())
             }
-            ExprKind::Yield { value } => {
-                let value = unpack!(block = this.as_operand(block, scope, value));
-                let resume = this.cfg.start_new_block();
-                let cleanup = this.generator_drop_cleanup();
-                this.cfg.terminate(
-                    block,
-                    source_info,
-                    TerminatorKind::Yield { value: value, resume: resume, drop: cleanup },
-                );
-                resume.and(this.unit_rvalue())
-            }
-            ExprKind::Literal { .. }
+            ExprKind::Yield { .. }
+            | ExprKind::Literal { .. }
             | ExprKind::StaticRef { .. }
             | ExprKind::Block { .. }
             | ExprKind::Match { .. }
diff --git a/src/librustc_mir_build/build/expr/category.rs b/src/librustc_mir_build/build/expr/category.rs
index c4d340953c9..cc139dee63f 100644
--- a/src/librustc_mir_build/build/expr/category.rs
+++ b/src/librustc_mir_build/build/expr/category.rs
@@ -50,6 +50,7 @@ impl Category {
             | ExprKind::Adt { .. }
             | ExprKind::Borrow { .. }
             | ExprKind::AddressOf { .. }
+            | ExprKind::Yield { .. }
             | ExprKind::Call { .. } => Some(Category::Rvalue(RvalueFunc::Into)),
 
             ExprKind::Array { .. }
@@ -63,7 +64,6 @@ impl Category {
             | ExprKind::Repeat { .. }
             | ExprKind::Assign { .. }
             | ExprKind::AssignOp { .. }
-            | ExprKind::Yield { .. }
             | ExprKind::InlineAsm { .. } => Some(Category::Rvalue(RvalueFunc::AsRvalue)),
 
             ExprKind::Literal { .. } | ExprKind::StaticRef { .. } => Some(Category::Constant),
diff --git a/src/librustc_mir_build/build/expr/into.rs b/src/librustc_mir_build/build/expr/into.rs
index 5ef338c624d..51b0b5bc7cb 100644
--- a/src/librustc_mir_build/build/expr/into.rs
+++ b/src/librustc_mir_build/build/expr/into.rs
@@ -365,6 +365,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 block.unit()
             }
 
+            ExprKind::Yield { value } => {
+                let scope = this.local_scope();
+                let value = unpack!(block = this.as_operand(block, scope, value));
+                let resume = this.cfg.start_new_block();
+                let cleanup = this.generator_drop_cleanup();
+                this.cfg.terminate(
+                    block,
+                    source_info,
+                    TerminatorKind::Yield {
+                        value,
+                        resume,
+                        resume_arg: destination.clone(),
+                        drop: cleanup,
+                    },
+                );
+                resume.unit()
+            }
+
             // these are the cases that are more naturally handled by some other mode
             ExprKind::Unary { .. }
             | ExprKind::Binary { .. }
@@ -376,8 +394,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             | ExprKind::Tuple { .. }
             | ExprKind::Closure { .. }
             | ExprKind::Literal { .. }
-            | ExprKind::StaticRef { .. }
-            | ExprKind::Yield { .. } => {
+            | ExprKind::StaticRef { .. } => {
                 debug_assert!(match Category::of(&expr.kind).unwrap() {
                     // should be handled above
                     Category::Rvalue(RvalueFunc::Into) => false,
diff --git a/src/librustc_mir_build/build/mod.rs b/src/librustc_mir_build/build/mod.rs
index 7e51f7aafe4..32b1f2b6e13 100644
--- a/src/librustc_mir_build/build/mod.rs
+++ b/src/librustc_mir_build/build/mod.rs
@@ -68,6 +68,12 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
             let fn_sig = cx.tables().liberated_fn_sigs()[id];
             let fn_def_id = tcx.hir().local_def_id(id);
 
+            let safety = match fn_sig.unsafety {
+                hir::Unsafety::Normal => Safety::Safe,
+                hir::Unsafety::Unsafe => Safety::FnUnsafe,
+            };
+
+            let body = tcx.hir().body(body_id);
             let ty = tcx.type_of(fn_def_id);
             let mut abi = fn_sig.abi;
             let implicit_argument = match ty.kind {
@@ -75,21 +81,25 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
                     // HACK(eddyb) Avoid having RustCall on closures,
                     // as it adds unnecessary (and wrong) auto-tupling.
                     abi = Abi::Rust;
-                    Some(ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None))
+                    vec![ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None)]
                 }
                 ty::Generator(..) => {
                     let gen_ty = tcx.body_tables(body_id).node_type(id);
-                    Some(ArgInfo(gen_ty, None, None, None))
-                }
-                _ => None,
-            };
 
-            let safety = match fn_sig.unsafety {
-                hir::Unsafety::Normal => Safety::Safe,
-                hir::Unsafety::Unsafe => Safety::FnUnsafe,
+                    // The resume argument may be missing, in that case we need to provide it here.
+                    // It will always be `()` in this case.
+                    if body.params.is_empty() {
+                        vec![
+                            ArgInfo(gen_ty, None, None, None),
+                            ArgInfo(tcx.mk_unit(), None, None, None),
+                        ]
+                    } else {
+                        vec![ArgInfo(gen_ty, None, None, None)]
+                    }
+                }
+                _ => vec![],
             };
 
-            let body = tcx.hir().body(body_id);
             let explicit_arguments = body.params.iter().enumerate().map(|(index, arg)| {
                 let owner_id = tcx.hir().body_owner(body_id);
                 let opt_ty_info;
diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs
index faa85f68fab..b178110f4f9 100644
--- a/src/librustc_passes/check_const.rs
+++ b/src/librustc_passes/check_const.rs
@@ -8,6 +8,7 @@
 //! through, but errors for structured control flow in a `const` should be emitted here.
 
 use rustc::hir::map::Map;
+use rustc::hir::Hir;
 use rustc::session::config::nightly_options;
 use rustc::session::parse::feature_err;
 use rustc::ty::query::Providers;
@@ -74,7 +75,7 @@ enum ConstKind {
 }
 
 impl ConstKind {
-    fn for_body(body: &hir::Body<'_>, hir_map: &Map<'_>) -> Option<Self> {
+    fn for_body(body: &hir::Body<'_>, hir_map: Hir<'_>) -> Option<Self> {
         let is_const_fn = |id| hir_map.fn_sig_by_hir_id(id).unwrap().header.is_const();
 
         let owner = hir_map.body_owner(body.id());
diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs
index d36114fd3b5..ebd93e9ab85 100644
--- a/src/librustc_passes/entry.rs
+++ b/src/librustc_passes/entry.rs
@@ -1,4 +1,4 @@
-use rustc::hir::map as hir_map;
+use rustc::hir::Hir;
 use rustc::session::config::EntryFnType;
 use rustc::session::{config, Session};
 use rustc::ty::query::Providers;
@@ -15,7 +15,7 @@ use syntax::entry::EntryPointType;
 struct EntryContext<'a, 'tcx> {
     session: &'a Session,
 
-    map: &'a hir_map::Map<'tcx>,
+    map: Hir<'tcx>,
 
     /// The top-level function called `main`.
     main_fn: Option<(HirId, Span)>,
diff --git a/src/librustc_resolve/lifetimes.rs b/src/librustc_resolve/lifetimes.rs
index 0ba9b4f1706..87522d28d1e 100644
--- a/src/librustc_resolve/lifetimes.rs
+++ b/src/librustc_resolve/lifetimes.rs
@@ -612,7 +612,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
                                 let parent_id = self.tcx.hir().get_parent_node(hir_id);
                                 let parent_impl_id = hir::ImplItemId { hir_id: parent_id };
                                 let parent_trait_id = hir::TraitItemId { hir_id: parent_id };
-                                let krate = self.tcx.hir().forest.krate();
+                                let krate = self.tcx.hir().krate();
 
                                 if !(krate.items.contains_key(&parent_id)
                                     || krate.impl_items.contains_key(&parent_impl_id)
diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs
index ad1a6c4906e..75b5e37b2df 100644
--- a/src/librustc_session/config.rs
+++ b/src/librustc_session/config.rs
@@ -624,7 +624,7 @@ impl DebuggingOptions {
             treat_err_as_bug: self.treat_err_as_bug,
             dont_buffer_diagnostics: self.dont_buffer_diagnostics,
             report_delayed_bugs: self.report_delayed_bugs,
-            external_macro_backtrace: self.external_macro_backtrace,
+            macro_backtrace: self.macro_backtrace,
             deduplicate_diagnostics: self.deduplicate_diagnostics.unwrap_or(true),
         }
     }
diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs
index c326061100b..5a360b40d61 100644
--- a/src/librustc_session/lint/builtin.rs
+++ b/src/librustc_session/lint/builtin.rs
@@ -261,6 +261,16 @@ declare_lint! {
 }
 
 declare_lint! {
+    pub COHERENCE_LEAK_CHECK,
+    Warn,
+    "distinct impls distinguished only by the leak-check code",
+    @future_incompatible = FutureIncompatibleInfo {
+        reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
+        edition: None,
+    };
+}
+
+declare_lint! {
     pub DEPRECATED,
     Warn,
     "detects use of deprecated items",
@@ -474,6 +484,12 @@ declare_lint! {
     };
 }
 
+declare_lint! {
+    pub INLINE_NO_SANITIZE,
+    Warn,
+    "detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`",
+}
+
 declare_lint_pass! {
     /// Does nothing as a lint pass, but registers some `Lint`s
     /// that are used by other parts of the compiler.
@@ -509,6 +525,7 @@ declare_lint_pass! {
         MISSING_FRAGMENT_SPECIFIER,
         LATE_BOUND_LIFETIME_ARGUMENTS,
         ORDER_DEPENDENT_TRAIT_OBJECTS,
+        COHERENCE_LEAK_CHECK,
         DEPRECATED,
         UNUSED_UNSAFE,
         UNUSED_MUT,
@@ -537,5 +554,6 @@ declare_lint_pass! {
         MUTABLE_BORROW_RESERVATION_CONFLICT,
         INDIRECT_STRUCTURAL_MATCH,
         SOFT_UNSTABLE,
+        INLINE_NO_SANITIZE,
     ]
 }
diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs
index d6b71641da5..0250c40bcdc 100644
--- a/src/librustc_session/options.rs
+++ b/src/librustc_session/options.rs
@@ -776,8 +776,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "treat error number `val` that occurs as bug"),
     report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
         "immediately print bugs registered with `delay_span_bug`"),
-    external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
-        "show macro backtraces even for non-local macros"),
+    macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
+        "show macro backtraces"),
     teach: bool = (false, parse_bool, [TRACKED],
         "show extended diagnostic help"),
     terminal_width: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
diff --git a/src/librustc_session/session.rs b/src/librustc_session/session.rs
index 70984917d7c..648dd6ad32a 100644
--- a/src/librustc_session/session.rs
+++ b/src/librustc_session/session.rs
@@ -858,7 +858,7 @@ fn default_emitter(
     source_map: &Lrc<source_map::SourceMap>,
     emitter_dest: Option<Box<dyn Write + Send>>,
 ) -> Box<dyn Emitter + sync::Send> {
-    let external_macro_backtrace = sopts.debugging_opts.external_macro_backtrace;
+    let macro_backtrace = sopts.debugging_opts.macro_backtrace;
     match (sopts.error_format, emitter_dest) {
         (config::ErrorOutputType::HumanReadable(kind), dst) => {
             let (short, color_config) = kind.unzip();
@@ -867,7 +867,7 @@ fn default_emitter(
                 let emitter = AnnotateSnippetEmitterWriter::new(
                     Some(source_map.clone()),
                     short,
-                    external_macro_backtrace,
+                    macro_backtrace,
                 );
                 Box::new(emitter.ui_testing(sopts.debugging_opts.ui_testing()))
             } else {
@@ -878,7 +878,7 @@ fn default_emitter(
                         short,
                         sopts.debugging_opts.teach,
                         sopts.debugging_opts.terminal_width,
-                        external_macro_backtrace,
+                        macro_backtrace,
                     ),
                     Some(dst) => EmitterWriter::new(
                         dst,
@@ -887,7 +887,7 @@ fn default_emitter(
                         false, // no teach messages when writing to a buffer
                         false, // no colors when writing to a buffer
                         None,  // no terminal width
-                        external_macro_backtrace,
+                        macro_backtrace,
                     ),
                 };
                 Box::new(emitter.ui_testing(sopts.debugging_opts.ui_testing()))
@@ -899,7 +899,7 @@ fn default_emitter(
                 source_map.clone(),
                 pretty,
                 json_rendered,
-                external_macro_backtrace,
+                macro_backtrace,
             )
             .ui_testing(sopts.debugging_opts.ui_testing()),
         ),
@@ -910,7 +910,7 @@ fn default_emitter(
                 source_map.clone(),
                 pretty,
                 json_rendered,
-                external_macro_backtrace,
+                macro_backtrace,
             )
             .ui_testing(sopts.debugging_opts.ui_testing()),
         ),
diff --git a/src/librustc_span/source_map.rs b/src/librustc_span/source_map.rs
index c250df43a27..45c4d6dbc6c 100644
--- a/src/librustc_span/source_map.rs
+++ b/src/librustc_span/source_map.rs
@@ -945,14 +945,6 @@ impl SourceMap {
             _ => None,
         })
     }
-    pub fn call_span_if_macro(&self, sp: Span) -> Span {
-        if self.span_to_filename(sp.clone()).is_macros() {
-            if let Some(use_site) = sp.macro_backtrace().last() {
-                return use_site.call_site;
-            }
-        }
-        sp
-    }
 }
 
 #[derive(Clone)]
diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs
index c060e8948e3..931a3c15cf0 100644
--- a/src/librustc_span/symbol.rs
+++ b/src/librustc_span/symbol.rs
@@ -120,6 +120,7 @@ symbols! {
         abi_vectorcall,
         abi_x86_interrupt,
         aborts,
+        address,
         add_with_overflow,
         advanced_slice_patterns,
         adx_target_feature,
@@ -445,6 +446,7 @@ symbols! {
         mem_uninitialized,
         mem_zeroed,
         member_constraints,
+        memory,
         message,
         meta,
         min_align_of,
@@ -487,6 +489,7 @@ symbols! {
         None,
         non_exhaustive,
         non_modrs_mods,
+        no_sanitize,
         no_stack_check,
         no_start,
         no_std,
@@ -721,6 +724,7 @@ symbols! {
         test_removed_feature,
         test_runner,
         then_with,
+        thread,
         thread_local,
         tool_attributes,
         tool_lints,
diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs
index 70e3c4c7ab1..301ebf8adc5 100644
--- a/src/librustc_traits/chalk_context/resolvent_ops.rs
+++ b/src/librustc_traits/chalk_context/resolvent_ops.rs
@@ -246,9 +246,11 @@ impl TypeRelation<'tcx> for AnswerSubstitutor<'cx, 'tcx> {
                 assert_eq!(a_bound.assert_bound_var(), b_bound.assert_bound_var());
             }
 
-            (ty::ReStatic, ty::ReStatic)
-            | (ty::ReErased, ty::ReErased)
-            | (ty::ReEmpty, ty::ReEmpty) => (),
+            (ty::ReStatic, ty::ReStatic) | (ty::ReErased, ty::ReErased) => (),
+
+            (ty::ReEmpty(a_ui), ty::ReEmpty(b_ui)) => {
+                assert_eq!(a_ui, b_ui);
+            }
 
             (&ty::ReFree(a_free), &ty::ReFree(b_free)) => {
                 assert_eq!(a_free, b_free);
diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs
index bc4d03cca7f..346d2a931d1 100644
--- a/src/librustc_traits/dropck_outlives.rs
+++ b/src/librustc_traits/dropck_outlives.rs
@@ -227,8 +227,8 @@ fn dtorck_constraint_for_ty<'tcx>(
             // In particular, skipping over `_interior` is safe
             // because any side-effects from dropping `_interior` can
             // only take place through references with lifetimes
-            // derived from lifetimes attached to the upvars, and we
-            // *do* incorporate the upvars here.
+            // derived from lifetimes attached to the upvars and resume
+            // argument, and we *do* incorporate those here.
 
             constraints.outlives.extend(
                 substs
@@ -236,6 +236,7 @@ fn dtorck_constraint_for_ty<'tcx>(
                     .upvar_tys(def_id, tcx)
                     .map(|t| -> ty::subst::GenericArg<'tcx> { t.into() }),
             );
+            constraints.outlives.push(substs.as_generator().resume_ty(def_id, tcx).into());
         }
 
         ty::Adt(def, substs) => {
diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs
index 084e6c8d083..26777b3b010 100644
--- a/src/librustc_typeck/check/closure.rs
+++ b/src/librustc_typeck/check/closure.rs
@@ -92,10 +92,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 .into(),
             GenericParamDefKind::Const => span_bug!(expr.span, "closure has const param"),
         });
-        if let Some(GeneratorTypes { yield_ty, interior, movability }) = generator_types {
+        if let Some(GeneratorTypes { resume_ty, yield_ty, interior, movability }) = generator_types
+        {
             let generator_substs = substs.as_generator();
             self.demand_eqtype(
                 expr.span,
+                resume_ty,
+                generator_substs.resume_ty(expr_def_id, self.tcx),
+            );
+            self.demand_eqtype(
+                expr.span,
                 yield_ty,
                 generator_substs.yield_ty(expr_def_id, self.tcx),
             );
@@ -259,8 +265,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 _ => return None,
             }
         } else {
-            // Generators cannot have explicit arguments.
-            vec![]
+            // Generators with a `()` resume type may be defined with 0 or 1 explicit arguments,
+            // else they must have exactly 1 argument. For now though, just give up in this case.
+            return None;
         };
 
         let ret_param_ty = projection.skip_binder().ty;
diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs
index b4c2b85241f..9ce89bd6363 100644
--- a/src/librustc_typeck/check/expr.rs
+++ b/src/librustc_typeck/check/expr.rs
@@ -1796,9 +1796,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         expr: &'tcx hir::Expr<'tcx>,
         src: &'tcx hir::YieldSource,
     ) -> Ty<'tcx> {
-        match self.yield_ty {
-            Some(ty) => {
-                self.check_expr_coercable_to_type(&value, ty);
+        match self.resume_yield_tys {
+            Some((resume_ty, yield_ty)) => {
+                self.check_expr_coercable_to_type(&value, yield_ty);
+
+                resume_ty
             }
             // Given that this `yield` expression was generated as a result of lowering a `.await`,
             // we know that the yield type must be `()`; however, the context won't contain this
@@ -1806,6 +1808,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             // value's type against `()` (this check should always hold).
             None if src == &hir::YieldSource::Await => {
                 self.check_expr_coercable_to_type(&value, self.tcx.mk_unit());
+                self.tcx.mk_unit()
             }
             _ => {
                 struct_span_err!(
@@ -1815,9 +1818,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     "yield expression outside of generator literal"
                 )
                 .emit();
+                self.tcx.mk_unit()
             }
         }
-        self.tcx.mk_unit()
     }
 }
 
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index d0275429747..7e5d27d93b3 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -573,7 +573,7 @@ pub struct FnCtxt<'a, 'tcx> {
     /// First span of a return site that we find. Used in error messages.
     ret_coercion_span: RefCell<Option<Span>>,
 
-    yield_ty: Option<Ty<'tcx>>,
+    resume_yield_tys: Option<(Ty<'tcx>, Ty<'tcx>)>,
 
     ps: RefCell<UnsafetyState>,
 
@@ -1251,6 +1251,9 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
 /// includes yield), it returns back some information about the yield
 /// points.
 struct GeneratorTypes<'tcx> {
+    /// Type of generator argument / values returned by `yield`.
+    resume_ty: Ty<'tcx>,
+
     /// Type of value that is yielded.
     yield_ty: Ty<'tcx>,
 
@@ -1311,7 +1314,11 @@ fn check_fn<'a, 'tcx>(
         let yield_ty = fcx
             .next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::TypeInference, span });
         fcx.require_type_is_sized(yield_ty, span, traits::SizedYieldType);
-        fcx.yield_ty = Some(yield_ty);
+
+        // Resume type defaults to `()` if the generator has no argument.
+        let resume_ty = fn_sig.inputs().get(0).map(|ty| *ty).unwrap_or_else(|| tcx.mk_unit());
+
+        fcx.resume_yield_tys = Some((resume_ty, yield_ty));
     }
 
     let outer_def_id = tcx.closure_base_def_id(hir.local_def_id(fn_id));
@@ -1364,8 +1371,11 @@ fn check_fn<'a, 'tcx>(
         let interior = fcx
             .next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::MiscVariable, span });
         fcx.deferred_generator_interiors.borrow_mut().push((body.id(), interior, gen_kind));
+
+        let (resume_ty, yield_ty) = fcx.resume_yield_tys.unwrap();
         Some(GeneratorTypes {
-            yield_ty: fcx.yield_ty.unwrap(),
+            resume_ty,
+            yield_ty,
             interior,
             movability: can_be_generator.unwrap(),
         })
@@ -2588,7 +2598,7 @@ fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span, qpath: &
         E0533,
         "expected unit struct, unit variant or constant, found {} `{}`",
         res.descr(),
-        hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false))
+        hir::print::to_string(&tcx.hir(), |s| s.print_qpath(qpath, false))
     )
     .emit();
 }
@@ -2767,7 +2777,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             err_count_on_creation: inh.tcx.sess.err_count(),
             ret_coercion: None,
             ret_coercion_span: RefCell::new(None),
-            yield_ty: None,
+            resume_yield_tys: None,
             ps: RefCell::new(UnsafetyState::function(hir::Unsafety::Normal, hir::CRATE_HIR_ID)),
             diverges: Cell::new(Diverges::Maybe),
             has_errors: Cell::new(false),
diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs
index f9dee0e477f..47baae68608 100644
--- a/src/librustc_typeck/check/pat.rs
+++ b/src/librustc_typeck/check/pat.rs
@@ -693,7 +693,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             let msg = format!(
                 "expected tuple struct or tuple variant, found {} `{}`",
                 res.descr(),
-                hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false)),
+                hir::print::to_string(&tcx.hir(), |s| s.print_qpath(qpath, false)),
             );
             let mut err = struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg);
             match (res, &pat.kind) {
diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs
index d60c3cfba9a..3e17b661cf4 100644
--- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs
+++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs
@@ -1,5 +1,5 @@
 use crate::namespace::Namespace;
-use rustc::traits::{self, IntercrateMode};
+use rustc::traits::{self, IntercrateMode, SkipLeakCheck};
 use rustc::ty::TyCtxt;
 use rustc_errors::struct_span_err;
 use rustc_hir as hir;
@@ -76,6 +76,9 @@ impl InherentOverlapChecker<'tcx> {
                     impl1_def_id,
                     impl2_def_id,
                     IntercrateMode::Issue43355,
+                    // We go ahead and just skip the leak check for
+                    // inherent impls without warning.
+                    SkipLeakCheck::Yes,
                     |overlap| {
                         self.check_for_common_items_in_impls(impl1_def_id, impl2_def_id, overlap);
                         false
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 4d812d2621c..2a450f4b4e8 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -1,3 +1,5 @@
+// ignore-tidy-filelength
+
 //! "Collection" is the process of determining the type and other external
 //! details of each item in Rust. Collection is specifically concerned
 //! with *inter-procedural* things -- for example, for a function
@@ -1189,7 +1191,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
     // and we don't do that for closures.
     if let Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(.., gen), .. }) = node {
         let dummy_args = if gen.is_some() {
-            &["<yield_ty>", "<return_ty>", "<witness>"][..]
+            &["<resume_ty>", "<yield_ty>", "<return_ty>", "<witness>"][..]
         } else {
             &["<closure_kind>", "<closure_signature>"][..]
         };
@@ -2322,7 +2324,8 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
                         // compiler/tooling bugs from not handling WF predicates.
                     } else {
                         let span = bound_pred.bounded_ty.span;
-                        let predicate = ty::OutlivesPredicate(ty, tcx.mk_region(ty::ReEmpty));
+                        let re_root_empty = tcx.lifetimes.re_root_empty;
+                        let predicate = ty::OutlivesPredicate(ty, re_root_empty);
                         predicates.push((
                             ty::Predicate::TypeOutlives(ty::Binder::dummy(predicate)),
                             span,
@@ -2743,6 +2746,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
 
     let mut inline_span = None;
     let mut link_ordinal_span = None;
+    let mut no_sanitize_span = None;
     for attr in attrs.iter() {
         if attr.check_name(sym::cold) {
             codegen_fn_attrs.flags |= CodegenFnAttrFlags::COLD;
@@ -2832,6 +2836,24 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
             if let ordinal @ Some(_) = check_link_ordinal(tcx, attr) {
                 codegen_fn_attrs.link_ordinal = ordinal;
             }
+        } else if attr.check_name(sym::no_sanitize) {
+            no_sanitize_span = Some(attr.span);
+            if let Some(list) = attr.meta_item_list() {
+                for item in list.iter() {
+                    if item.check_name(sym::address) {
+                        codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_SANITIZE_ADDRESS;
+                    } else if item.check_name(sym::memory) {
+                        codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_SANITIZE_MEMORY;
+                    } else if item.check_name(sym::thread) {
+                        codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_SANITIZE_THREAD;
+                    } else {
+                        tcx.sess
+                            .struct_span_err(item.span(), "invalid argument for `no_sanitize`")
+                            .note("expected one of: `address`, `memory` or `thread`")
+                            .emit();
+                    }
+                }
+            }
         }
     }
 
@@ -2911,7 +2933,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
     // purpose functions as they wouldn't have the right target features
     // enabled. For that reason we also forbid #[inline(always)] as it can't be
     // respected.
-
     if codegen_fn_attrs.target_features.len() > 0 {
         if codegen_fn_attrs.inline == InlineAttr::Always {
             if let Some(span) = inline_span {
@@ -2924,6 +2945,22 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
         }
     }
 
+    if codegen_fn_attrs.flags.intersects(CodegenFnAttrFlags::NO_SANITIZE_ANY) {
+        if codegen_fn_attrs.inline == InlineAttr::Always {
+            if let (Some(no_sanitize_span), Some(inline_span)) = (no_sanitize_span, inline_span) {
+                let hir_id = tcx.hir().as_local_hir_id(id).unwrap();
+                tcx.struct_span_lint_hir(
+                    lint::builtin::INLINE_NO_SANITIZE,
+                    hir_id,
+                    no_sanitize_span,
+                    "`no_sanitize` will have no effect after inlining",
+                )
+                .span_note(inline_span, "inlining requested here")
+                .emit();
+            }
+        }
+    }
+
     // Weak lang items have the same semantics as "std internal" symbols in the
     // sense that they're preserved through all our LTO passes and only
     // strippable by the linker.
diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs
index 2d7fc9d62e5..0cc322f8c2d 100644
--- a/src/librustc_typeck/outlives/utils.rs
+++ b/src/librustc_typeck/outlives/utils.rs
@@ -166,7 +166,7 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
         //
         //     struct Bar<T>(<Self as Foo>::Type) where Self: ;
         //     struct Baz<'a>(&'a Self) where Self: ;
-        RegionKind::ReEmpty => false,
+        RegionKind::ReEmpty(_) => false,
 
         // These regions don't appear in types from type declarations:
         RegionKind::ReErased
diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs
index 5ca961ed344..6f5caea250b 100644
--- a/src/librustc_typeck/variance/constraints.rs
+++ b/src/librustc_typeck/variance/constraints.rs
@@ -453,7 +453,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
             | ty::ReScope(..)
             | ty::ReVar(..)
             | ty::RePlaceholder(..)
-            | ty::ReEmpty
+            | ty::ReEmpty(_)
             | ty::ReErased => {
                 // We don't expect to see anything but 'static or bound
                 // regions when visiting member types or method types.
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 2a35ab812a5..f140f11b090 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -447,7 +447,7 @@ impl Clean<Option<Lifetime>> for ty::RegionKind {
             | ty::ReScope(..)
             | ty::ReVar(..)
             | ty::RePlaceholder(..)
-            | ty::ReEmpty
+            | ty::ReEmpty(_)
             | ty::ReClosureBound(_)
             | ty::ReErased => {
                 debug!("cannot clean region {:?}", self);
@@ -521,7 +521,7 @@ impl<'tcx> Clean<Option<WherePredicate>>
         let ty::OutlivesPredicate(ref a, ref b) = *self;
 
         match (a, b) {
-            (ty::ReEmpty, ty::ReEmpty) => {
+            (ty::ReEmpty(_), ty::ReEmpty(_)) => {
                 return None;
             }
             _ => {}
@@ -539,7 +539,7 @@ impl<'tcx> Clean<Option<WherePredicate>> for ty::OutlivesPredicate<Ty<'tcx>, ty:
         let ty::OutlivesPredicate(ref ty, ref lt) = *self;
 
         match lt {
-            ty::ReEmpty => return None,
+            ty::ReEmpty(_) => return None,
             _ => {}
         }
 
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 556dab302b8..0c7dfa1417a 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -87,7 +87,7 @@ pub fn run(options: Options) -> i32 {
         compiler.enter(|queries| {
             let lower_to_hir = queries.lower_to_hir()?;
 
-            let mut opts = scrape_test_config(lower_to_hir.peek().0.krate());
+            let mut opts = scrape_test_config(lower_to_hir.peek().0);
             opts.display_warnings |= options.display_warnings;
             let enable_per_target_ignores = options.enable_per_target_ignores;
             let mut collector = Collector::new(
@@ -107,7 +107,7 @@ pub fn run(options: Options) -> i32 {
                 let mut hir_collector = HirCollector {
                     sess: compiler.session(),
                     collector: &mut collector,
-                    map: tcx.hir(),
+                    map: *tcx.hir(),
                     codes: ErrorCodes::from(
                         compiler.session().opts.unstable_features.is_nightly_build(),
                     ),
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index 9c7422c2b20..f74c84e6dfd 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -40,7 +40,10 @@ impl<T: Generator<Yield = ()>> Future for GenFuture<T> {
         // Safe because we're !Unpin + !Drop mapping to a ?Unpin value
         let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };
         let _guard = unsafe { set_task_context(cx) };
-        match gen.resume() {
+        match gen.resume(
+            #[cfg(not(bootstrap))]
+            (),
+        ) {
             GeneratorState::Yielded(()) => Poll::Pending,
             GeneratorState::Complete(x) => Poll::Ready(x),
         }
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index e99473177e8..de001cacbe1 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -63,8 +63,7 @@ use std::{
     env, io,
     io::prelude::Write,
     panic::{self, catch_unwind, AssertUnwindSafe, PanicInfo},
-    process,
-    process::{Command, Termination},
+    process::{self, Command, Termination},
     sync::mpsc::{channel, Sender},
     sync::{Arc, Mutex},
     thread,
@@ -457,9 +456,13 @@ pub fn run_test(
                 monitor_ch,
                 opts.time,
             ),
-            RunStrategy::SpawnPrimary => {
-                spawn_test_subprocess(desc, opts.time.is_some(), monitor_ch, opts.time)
-            }
+            RunStrategy::SpawnPrimary => spawn_test_subprocess(
+                desc,
+                opts.nocapture,
+                opts.time.is_some(),
+                monitor_ch,
+                opts.time,
+            ),
         };
 
         // If the platform is single-threaded we're just going to run
@@ -558,6 +561,7 @@ fn run_test_in_process(
 
 fn spawn_test_subprocess(
     desc: TestDesc,
+    nocapture: bool,
     report_time: bool,
     monitor_ch: Sender<CompletedTest>,
     time_opts: Option<time::TestTimeOptions>,
@@ -566,11 +570,15 @@ fn spawn_test_subprocess(
         let args = env::args().collect::<Vec<_>>();
         let current_exe = &args[0];
 
+        let mut command = Command::new(current_exe);
+        command.env(SECONDARY_TEST_INVOKER_VAR, desc.name.as_slice());
+        if nocapture {
+            command.stdout(process::Stdio::inherit());
+            command.stderr(process::Stdio::inherit());
+        }
+
         let start = report_time.then(Instant::now);
-        let output = match Command::new(current_exe)
-            .env(SECONDARY_TEST_INVOKER_VAR, desc.name.as_slice())
-            .output()
-        {
+        let output = match command.output() {
             Ok(out) => out,
             Err(e) => {
                 let err = format!("Failed to spawn {} as child for test: {:?}", args[0], e);
diff --git a/src/test/codegen/sanitizer-no-sanitize-inlining.rs b/src/test/codegen/sanitizer-no-sanitize-inlining.rs
new file mode 100644
index 00000000000..d96e76618d3
--- /dev/null
+++ b/src/test/codegen/sanitizer-no-sanitize-inlining.rs
@@ -0,0 +1,32 @@
+// Verifies that no_sanitize attribute prevents inlining when
+// given sanitizer is enabled, but has no effect on inlining otherwise.
+//
+// needs-sanitizer-support
+// only-x86_64
+//
+// revisions: ASAN LSAN
+//
+//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=3
+//[LSAN] compile-flags: -Zsanitizer=leak    -C opt-level=3 -Z mir-opt-level=3
+
+#![crate_type="lib"]
+#![feature(no_sanitize)]
+
+// ASAN-LABEL: define void @test
+// ASAN:         tail call fastcc void @random_inline
+// ASAN:       }
+//
+// LSAN-LABEL: define void @test
+// LSAN-NO:      call
+// LSAN:       }
+#[no_mangle]
+pub fn test(n: &mut u32) {
+    random_inline(n);
+}
+
+#[no_sanitize(address)]
+#[inline]
+#[no_mangle]
+pub fn random_inline(n: &mut u32) {
+    *n = 42;
+}
diff --git a/src/test/codegen/sanitizer-no-sanitize.rs b/src/test/codegen/sanitizer-no-sanitize.rs
new file mode 100644
index 00000000000..dfceb28c8dd
--- /dev/null
+++ b/src/test/codegen/sanitizer-no-sanitize.rs
@@ -0,0 +1,29 @@
+// Verifies that no_sanitze attribute can be used to
+// selectively disable sanitizer instrumentation.
+//
+// needs-sanitizer-support
+// compile-flags: -Zsanitizer=address
+
+#![crate_type="lib"]
+#![feature(no_sanitize)]
+
+// CHECK-LABEL: ; sanitizer_no_sanitize::unsanitized
+// CHECK-NEXT:  ; Function Attrs:
+// CHECK-NOT:   sanitize_address
+// CHECK:       start:
+// CHECK-NOT:   call void @__asan_report_load
+// CHECK:       }
+#[no_sanitize(address)]
+pub fn unsanitized(b: &mut u8) -> u8 {
+    *b
+}
+
+// CHECK-LABEL: ; sanitizer_no_sanitize::sanitized
+// CHECK-NEXT:  ; Function Attrs:
+// CHECK:       sanitize_address
+// CHECK:       start:
+// CHECK:       call void @__asan_report_load
+// CHECK:       }
+pub fn sanitized(b: &mut u8) -> u8 {
+    *b
+}
diff --git a/src/test/debuginfo/generator-locals.rs b/src/test/debuginfo/generator-locals.rs
index 59dbfecc39f..fd46c1a8b4d 100644
--- a/src/test/debuginfo/generator-locals.rs
+++ b/src/test/debuginfo/generator-locals.rs
@@ -78,9 +78,9 @@ fn main() {
         _zzz(); // #break
         a = c;
     };
-    Pin::new(&mut b).resume();
-    Pin::new(&mut b).resume();
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
+    Pin::new(&mut b).resume(());
+    Pin::new(&mut b).resume(());
     _zzz(); // #break
 }
 
diff --git a/src/test/debuginfo/generator-objects.rs b/src/test/debuginfo/generator-objects.rs
index bfa7a05cad0..f19a3c71dd8 100644
--- a/src/test/debuginfo/generator-objects.rs
+++ b/src/test/debuginfo/generator-objects.rs
@@ -57,11 +57,11 @@ fn main() {
         println!("{} {} {}", a, c, d);
     };
     _zzz(); // #break
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
     _zzz(); // #break
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
     _zzz(); // #break
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
     _zzz(); // #break
 }
 
diff --git a/src/test/debuginfo/issue-57822.rs b/src/test/debuginfo/issue-57822.rs
index f18e41db0e6..4de88e9dae6 100644
--- a/src/test/debuginfo/issue-57822.rs
+++ b/src/test/debuginfo/issue-57822.rs
@@ -45,7 +45,7 @@ fn main() {
         yield;
     };
     let mut b = move || {
-        Pin::new(&mut a).resume();
+        Pin::new(&mut a).resume(());
         yield;
     };
 
diff --git a/src/test/incremental/crate_hash_reorder.rs b/src/test/incremental/crate_hash_reorder.rs
index 5aba2a67037..6e06e67b668 100644
--- a/src/test/incremental/crate_hash_reorder.rs
+++ b/src/test/incremental/crate_hash_reorder.rs
@@ -7,11 +7,9 @@
 
 // Check that reordering otherwise identical items is not considered a
 // change at all.
-#[rustc_clean(label="Krate", cfg="rpass2")]
-
+#[rustc_clean(label = "hir_crate", cfg = "rpass2")]
 // But removing an item, naturally, is.
-#[rustc_dirty(label="Krate", cfg="rpass3")]
-
+#[rustc_dirty(label = "hir_crate", cfg = "rpass3")]
 #[cfg(rpass1)]
 pub struct X {
     pub x: u32,
@@ -26,4 +24,4 @@ pub struct X {
     pub x: u32,
 }
 
-pub fn main() { }
+pub fn main() {}
diff --git a/src/test/incremental/issue-38222.rs b/src/test/incremental/issue-38222.rs
index df08661c150..20d4d4200bc 100644
--- a/src/test/incremental/issue-38222.rs
+++ b/src/test/incremental/issue-38222.rs
@@ -1,18 +1,14 @@
-// Test that debuginfo does not introduce a dependency edge to the Krate
+// Test that debuginfo does not introduce a dependency edge to the hir_crate
 // dep-node.
 
 // revisions:rpass1 rpass2
 // compile-flags: -Z query-dep-graph
 
-
 #![feature(rustc_attrs)]
-
-
-#![rustc_partition_reused(module="issue_38222-mod1", cfg="rpass2")]
-
-// If codegen had added a dependency edge to the Krate dep-node, nothing would
+#![rustc_partition_reused(module = "issue_38222-mod1", cfg = "rpass2")]
+// If codegen had added a dependency edge to the hir_crate dep-node, nothing would
 // be re-used, so checking that this module was re-used is sufficient.
-#![rustc_partition_reused(module="issue_38222", cfg="rpass2")]
+#![rustc_partition_reused(module = "issue_38222", cfg = "rpass2")]
 
 //[rpass1] compile-flags: -C debuginfo=1
 //[rpass2] compile-flags: -C debuginfo=1
diff --git a/src/test/incremental/krate-inherent.rs b/src/test/incremental/krate-inherent.rs
index 6e791eacdf3..2c04e110525 100644
--- a/src/test/incremental/krate-inherent.rs
+++ b/src/test/incremental/krate-inherent.rs
@@ -4,20 +4,20 @@
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
-#![rustc_partition_reused(module="krate_inherent-x", cfg="cfail2")]
+#![rustc_partition_reused(module = "krate_inherent-x", cfg = "cfail2")]
 #![crate_type = "rlib"]
 
 pub mod x {
     pub struct Foo;
     impl Foo {
-        pub fn foo(&self) { }
+        pub fn foo(&self) {}
     }
 
     pub fn method() {
         let x: Foo = Foo;
-        x.foo(); // inherent methods used to add an edge from Krate
+        x.foo(); // inherent methods used to add an edge from hir_crate
     }
 }
 
 #[cfg(cfail1)]
-pub fn bar() { } // remove this unrelated fn in cfail2, which should not affect `x::method`
+pub fn bar() {} // remove this unrelated fn in cfail2, which should not affect `x::method`
diff --git a/src/test/incremental/krate-inlined.rs b/src/test/incremental/krate-inlined.rs
index dfb18166ae9..6b1db74a37c 100644
--- a/src/test/incremental/krate-inlined.rs
+++ b/src/test/incremental/krate-inlined.rs
@@ -1,5 +1,5 @@
 // Regr. test that using HIR inlined from another krate does *not* add
-// a dependency from the local Krate node. We can't easily test that
+// a dependency from the local hir_crate node. We can't easily test that
 // directly anymore, so now we test that we get reuse.
 
 // revisions: rpass1 rpass2
@@ -7,7 +7,7 @@
 
 #![allow(warnings)]
 #![feature(rustc_attrs)]
-#![rustc_partition_reused(module="krate_inlined-x", cfg="rpass2")]
+#![rustc_partition_reused(module = "krate_inlined-x", cfg = "rpass2")]
 
 fn main() {
     x::method();
diff --git a/src/test/mir-opt/generator-drop-cleanup.rs b/src/test/mir-opt/generator-drop-cleanup.rs
index f97e1ba6c89..278dc49c926 100644
--- a/src/test/mir-opt/generator-drop-cleanup.rs
+++ b/src/test/mir-opt/generator-drop-cleanup.rs
@@ -13,12 +13,12 @@ fn main() {
 
 // START rustc.main-{{closure}}.generator_drop.0.mir
 // bb0: {
-//     _5 = discriminant((*_1));
-//     switchInt(move _5) -> [0u32: bb4, 3u32: bb7, otherwise: bb8];
+//     _7 = discriminant((*_1));
+//     switchInt(move _7) -> [0u32: bb4, 3u32: bb7, otherwise: bb8];
 // }
 // bb1: {
+//     StorageDead(_4);
 //     StorageDead(_3);
-//     StorageDead(_2);
 //     goto -> bb5;
 // }
 // bb2: {
@@ -37,8 +37,8 @@ fn main() {
 //     goto -> bb3;
 // }
 // bb7: {
-//     StorageLive(_2);
 //     StorageLive(_3);
+//     StorageLive(_4);
 //     goto -> bb1;
 // }
 // bb8: {
diff --git a/src/test/mir-opt/generator-storage-dead-unwind.rs b/src/test/mir-opt/generator-storage-dead-unwind.rs
index ecce0a08c7b..4442fa5f521 100644
--- a/src/test/mir-opt/generator-storage-dead-unwind.rs
+++ b/src/test/mir-opt/generator-storage-dead-unwind.rs
@@ -31,81 +31,81 @@ fn main() {
 
 // START rustc.main-{{closure}}.StateTransform.before.mir
 // ...
-// let _2: Foo;
+// let _3: Foo;
 // ...
-// let mut _7: Foo;
+// let mut _8: Foo;
 // ...
-// let mut _9: Bar;
+// let mut _10: Bar;
 // scope 1 {
-//     debug a => _2;
-//     let _3: Bar;
+//     debug a => _3;
+//     let _4: Bar;
 //     scope 2 {
-//         debug b => _3;
+//         debug b => _4;
 //     }
 // }
 // bb0: {
-//     StorageLive(_2);
-//     _2 = Foo(const 5i32,);
 //     StorageLive(_3);
-//     _3 = Bar(const 6i32,);
+//     _3 = Foo(const 5i32,);
+//     StorageLive(_4);
+//     _4 = Bar(const 6i32,);
 //     ...
-//     _1 = suspend(move _5) -> [resume: bb2, drop: bb4];
+//     _1 = suspend(move _6) -> [resume: bb2, drop: bb4];
 // }
 // bb1 (cleanup): {
 //     resume;
 // }
 // bb2: {
 //     ...
-//     StorageLive(_6);
 //     StorageLive(_7);
-//     _7 = move _2;
-//     _6 = const take::<Foo>(move _7) -> [return: bb7, unwind: bb9];
+//     StorageLive(_8);
+//     _8 = move _3;
+//     _7 = const take::<Foo>(move _8) -> [return: bb7, unwind: bb9];
 // }
 // bb3 (cleanup): {
-//     StorageDead(_2);
+//     StorageDead(_3);
 //     drop(_1) -> bb1;
 // }
 // bb4: {
 //     ...
-//     StorageDead(_3);
-//     drop(_2) -> [return: bb5, unwind: bb3];
+//     StorageDead(_4);
+//     drop(_3) -> [return: bb5, unwind: bb3];
 // }
 // bb5: {
-//     StorageDead(_2);
+//     StorageDead(_3);
 //     drop(_1) -> [return: bb6, unwind: bb1];
 // }
 // bb6: {
 //     generator_drop;
 // }
 // bb7: {
+//     StorageDead(_8);
 //     StorageDead(_7);
-//     StorageDead(_6);
-//     StorageLive(_8);
 //     StorageLive(_9);
-//     _9 = move _3;
-//     _8 = const take::<Bar>(move _9) -> [return: bb10, unwind: bb11];
+//     StorageLive(_10);
+//     _10 = move _4;
+//     _9 = const take::<Bar>(move _10) -> [return: bb10, unwind: bb11];
 // }
 // bb8 (cleanup): {
+//     StorageDead(_4);
 //     StorageDead(_3);
-//     StorageDead(_2);
 //     drop(_1) -> bb1;
 // }
 // bb9 (cleanup): {
+//     StorageDead(_8);
 //     StorageDead(_7);
-//     StorageDead(_6);
 //     goto -> bb8;
 // }
 // bb10: {
+//     StorageDead(_10);
 //     StorageDead(_9);
-//     StorageDead(_8);
 //     ...
+//     StorageDead(_4);
 //     StorageDead(_3);
-//     StorageDead(_2);
 //     drop(_1) -> [return: bb12, unwind: bb1];
 // }
 // bb11 (cleanup): {
+//     StorageDead(_10);
 //     StorageDead(_9);
-//     StorageDead(_8);
 //     goto -> bb8;
 // }
 // bb12: {
diff --git a/src/test/run-fail/generator-resume-after-panic.rs b/src/test/run-fail/generator-resume-after-panic.rs
index 910b4903bf6..1a7c2e80629 100644
--- a/src/test/run-fail/generator-resume-after-panic.rs
+++ b/src/test/run-fail/generator-resume-after-panic.rs
@@ -16,7 +16,7 @@ fn main() {
         yield;
     };
     panic::catch_unwind(panic::AssertUnwindSafe(|| {
-        let x = Pin::new(&mut g).resume();
+        let x = Pin::new(&mut g).resume(());
     }));
-    Pin::new(&mut g).resume();
+    Pin::new(&mut g).resume(());
 }
diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr
index 5f1c9cfbc36..91b1fff5a3a 100644
--- a/src/test/rustdoc-ui/intra-links-warning.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning.stderr
@@ -175,4 +175,5 @@ LL | f!("Foo\nbar [BarF] bar\nbaz");
            bar [BarF] bar
                 ^^^^
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr
index e2dc0c3be72..73b48013de6 100644
--- a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr
+++ b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr
@@ -42,6 +42,7 @@ LL | #[derive(HashStable)]
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/27812
    = help: add `#![feature(rustc_private)]` to the crate attributes to enable
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr
index 966a747a1c9..fe920dba397 100644
--- a/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr
+++ b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr
@@ -21,6 +21,7 @@ LL | custom_lint_pass_macro!();
    | -------------------------- in this macro invocation
    |
    = help: try using `declare_lint_pass!` or `impl_lint_pass!` instead
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/allocator/not-an-allocator.stderr b/src/test/ui/allocator/not-an-allocator.stderr
index dd2cf36ff1b..0d52a23c1f3 100644
--- a/src/test/ui/allocator/not-an-allocator.stderr
+++ b/src/test/ui/allocator/not-an-allocator.stderr
@@ -5,6 +5,7 @@ LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
    |
    = note: required by `std::alloc::GlobalAlloc::alloc`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
   --> $DIR/not-an-allocator.rs:2:1
@@ -13,6 +14,7 @@ LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
    |
    = note: required by `std::alloc::GlobalAlloc::dealloc`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
   --> $DIR/not-an-allocator.rs:2:1
@@ -21,6 +23,7 @@ LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
    |
    = note: required by `std::alloc::GlobalAlloc::realloc`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
   --> $DIR/not-an-allocator.rs:2:1
@@ -29,6 +32,7 @@ LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
    |
    = note: required by `std::alloc::GlobalAlloc::alloc_zeroed`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/allocator/two-allocators.stderr b/src/test/ui/allocator/two-allocators.stderr
index da636a5a567..1b46825c542 100644
--- a/src/test/ui/allocator/two-allocators.stderr
+++ b/src/test/ui/allocator/two-allocators.stderr
@@ -6,6 +6,8 @@ LL | static A: System = System;
 LL | #[global_allocator]
 LL | static B: System = System;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
+   |
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs b/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
index 23e3483e01c..9fc5667d684 100644
--- a/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
+++ b/src/test/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
@@ -19,7 +19,7 @@ fn main() {
     let mut g = || {
         yield;
     };
-    Pin::new(&mut g).resume(); // Yields once.
-    Pin::new(&mut g).resume(); // Completes here.
-    Pin::new(&mut g).resume(); // Panics here.
+    Pin::new(&mut g).resume(()); // Yields once.
+    Pin::new(&mut g).resume(()); // Completes here.
+    Pin::new(&mut g).resume(()); // Panics here.
 }
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
index 1dd18c12fc8..bdb073cdcbc 100644
--- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
@@ -9,7 +9,7 @@ LL |     x.x[0];
    |     ------ borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/issue-64453.stderr b/src/test/ui/borrowck/issue-64453.stderr
index 0b66426aa2a..edc496aa2f8 100644
--- a/src/test/ui/borrowck/issue-64453.stderr
+++ b/src/test/ui/borrowck/issue-64453.stderr
@@ -6,7 +6,7 @@ LL | static settings_dir: String = format!("");
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/move-error-snippets.stderr b/src/test/ui/borrowck/move-error-snippets.stderr
index 77463c48591..e0acd459571 100644
--- a/src/test/ui/borrowck/move-error-snippets.stderr
+++ b/src/test/ui/borrowck/move-error-snippets.stderr
@@ -9,6 +9,8 @@ LL |               aaa!(D);
 ...
 LL |   sss!();
    |   ------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr
index 17d4df2a223..96d7b07b0e2 100644
--- a/src/test/ui/codemap_tests/bad-format-args.stderr
+++ b/src/test/ui/codemap_tests/bad-format-args.stderr
@@ -4,7 +4,7 @@ error: requires at least a format string argument
 LL |     format!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected token: `,`
   --> $DIR/bad-format-args.rs:3:16
diff --git a/src/test/ui/codemap_tests/issue-28308.stderr b/src/test/ui/codemap_tests/issue-28308.stderr
index d44c157003d..f8820b9efed 100644
--- a/src/test/ui/codemap_tests/issue-28308.stderr
+++ b/src/test/ui/codemap_tests/issue-28308.stderr
@@ -3,6 +3,8 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str`
    |
 LL |     assert!("foo");
    |     ^^^^^^^^^^^^^^^ cannot apply unary operator `!`
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/coherence/coherence-inherited-subtyping.old.stderr b/src/test/ui/coherence/coherence-inherited-subtyping.old.stderr
new file mode 100644
index 00000000000..6ea0b89be74
--- /dev/null
+++ b/src/test/ui/coherence/coherence-inherited-subtyping.old.stderr
@@ -0,0 +1,14 @@
+error[E0592]: duplicate definitions with name `method1`
+  --> $DIR/coherence-inherited-subtyping.rs:14:5
+   |
+LL |     fn method1(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `method1`
+...
+LL |     fn method1(&self) {}
+   |     -------------------- other definition for `method1`
+   |
+   = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/src/test/ui/coherence/coherence-inherited-subtyping.re.stderr b/src/test/ui/coherence/coherence-inherited-subtyping.re.stderr
new file mode 100644
index 00000000000..6ea0b89be74
--- /dev/null
+++ b/src/test/ui/coherence/coherence-inherited-subtyping.re.stderr
@@ -0,0 +1,14 @@
+error[E0592]: duplicate definitions with name `method1`
+  --> $DIR/coherence-inherited-subtyping.rs:14:5
+   |
+LL |     fn method1(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `method1`
+...
+LL |     fn method1(&self) {}
+   |     -------------------- other definition for `method1`
+   |
+   = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/src/test/ui/coherence/coherence-inherited-subtyping.rs b/src/test/ui/coherence/coherence-inherited-subtyping.rs
new file mode 100644
index 00000000000..8587eb77950
--- /dev/null
+++ b/src/test/ui/coherence/coherence-inherited-subtyping.rs
@@ -0,0 +1,21 @@
+// Test that two distinct impls which match subtypes of one another
+// yield coherence errors (or not) depending on the variance.
+//
+// Note: This scenario is currently accepted, but as part of the
+// universe transition (#56105) may eventually become an error.
+
+// revisions: old re
+
+struct Foo<T> {
+    t: T,
+}
+
+impl Foo<for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8> {
+    fn method1(&self) {} //~ ERROR duplicate definitions with name `method1`
+}
+
+impl Foo<for<'a> fn(&'a u8, &'a u8) -> &'a u8> {
+    fn method1(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/coherence-subtyping.old.stderr b/src/test/ui/coherence/coherence-subtyping.old.stderr
new file mode 100644
index 00000000000..76f5cc1b782
--- /dev/null
+++ b/src/test/ui/coherence/coherence-subtyping.old.stderr
@@ -0,0 +1,14 @@
+warning: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
+  --> $DIR/coherence-subtyping.rs:16:1
+   |
+LL | impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {}
+   | ---------------------------------------------------------- first implementation here
+LL | 
+LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+   |
+   = note: `#[warn(coherence_leak_check)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
+   = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
+
diff --git a/src/test/ui/coherence/coherence-subtyping.re.stderr b/src/test/ui/coherence/coherence-subtyping.re.stderr
new file mode 100644
index 00000000000..76f5cc1b782
--- /dev/null
+++ b/src/test/ui/coherence/coherence-subtyping.re.stderr
@@ -0,0 +1,14 @@
+warning: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`:
+  --> $DIR/coherence-subtyping.rs:16:1
+   |
+LL | impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {}
+   | ---------------------------------------------------------- first implementation here
+LL | 
+LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+   |
+   = note: `#[warn(coherence_leak_check)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
+   = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
+
diff --git a/src/test/ui/coherence/coherence-subtyping.rs b/src/test/ui/coherence/coherence-subtyping.rs
index a742bf2884e..f5c1d92411b 100644
--- a/src/test/ui/coherence/coherence-subtyping.rs
+++ b/src/test/ui/coherence/coherence-subtyping.rs
@@ -5,16 +5,19 @@
 // universe transition (#56105) may eventually become an error.
 
 // revisions: old re
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 
 trait TheTrait {
-    fn foo(&self) { }
+    fn foo(&self) {}
 }
 
-impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 {
-}
+impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {}
 
 impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
+    //[re]~^ WARNING conflicting implementation
+    //[re]~^^ WARNING this was previously accepted by the compiler but is being phased out
+    //[old]~^^^ WARNING conflicting implementation
+    //[old]~^^^^ WARNING this was previously accepted by the compiler but is being phased out
 }
 
-fn main() { }
+fn main() {}
diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
index 5bfe9e902da..44063dd1d65 100644
--- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
+++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
@@ -60,6 +60,8 @@ LL |         #[cfg(feature = $expr)]
 ...
 LL | generate_s10!(concat!("nonexistent"));
    | -------------------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 10 previous errors
 
diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr
index ef434ec8261..330ce2bd2e1 100644
--- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr
+++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr
@@ -6,6 +6,8 @@ LL |         #[cfg_attr(all(), unknown)]
 ...
 LL | foo!();
    | ------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr
index d885c98dcb2..cba71db86a9 100644
--- a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr
+++ b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr
@@ -6,6 +6,7 @@ LL |     println!("{:?}", [0_usize; 33]);
    |
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `[usize; 33]`
    = note: required by `std::fmt::Debug::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
   --> $DIR/core-traits-no-impls-length-33.rs:10:16
diff --git a/src/test/ui/const-generics/broken-mir-2.stderr b/src/test/ui/const-generics/broken-mir-2.stderr
index b72bc6a46a0..7d95b46790d 100644
--- a/src/test/ui/const-generics/broken-mir-2.stderr
+++ b/src/test/ui/const-generics/broken-mir-2.stderr
@@ -15,6 +15,7 @@ LL | struct S<T: Debug, const N: usize>([T; N]);
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `[T; _]`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&[T; _]`
    = note: required for the cast to the object type `dyn std::fmt::Debug`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/derive-debug-array-wrapper.stderr b/src/test/ui/const-generics/derive-debug-array-wrapper.stderr
index 08a9037a207..c4aef4c9d47 100644
--- a/src/test/ui/const-generics/derive-debug-array-wrapper.stderr
+++ b/src/test/ui/const-generics/derive-debug-array-wrapper.stderr
@@ -15,6 +15,7 @@ LL |     a: [u32; N],
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `[u32; _]`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u32; _]`
    = note: required for the cast to the object type `dyn std::fmt::Debug`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
index f99505c3090..4c3ebece0a8 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
+++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
@@ -12,7 +12,7 @@ LL |     assert_eq!(Y, 4);
    |                |
    |                referenced constant has errors
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant expression failed
   --> $DIR/const_fn_ptr_fail2.rs:22:5
@@ -22,7 +22,7 @@ LL |     assert_eq!(Z, 4);
    |                |
    |                referenced constant has errors
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr
index 1b006c69cfd..679d8f280cc 100644
--- a/src/test/ui/consts/const-eval/const_panic.stderr
+++ b/src/test/ui/consts/const-eval/const_panic.stderr
@@ -7,7 +7,7 @@ LL | pub const Z: () = panic!("cheese");
    |                   the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:19
    |
    = note: `#[deny(const_err)]` on by default
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/const_panic.rs:7:19
@@ -17,7 +17,7 @@ LL | pub const Y: () = unreachable!();
    |                   |
    |                   the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:7:19
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/const_panic.rs:10:19
@@ -27,7 +27,7 @@ LL | pub const X: () = unimplemented!();
    |                   |
    |                   the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:10:19
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore.stderr b/src/test/ui/consts/const-eval/const_panic_libcore.stderr
index abc844e9842..2abf158aade 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore.stderr
+++ b/src/test/ui/consts/const-eval/const_panic_libcore.stderr
@@ -7,7 +7,7 @@ LL | const Z: () = panic!("cheese");
    |               the evaluated program panicked at 'cheese', $DIR/const_panic_libcore.rs:5:15
    |
    = note: `#[deny(const_err)]` on by default
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/const_panic_libcore.rs:8:15
@@ -17,7 +17,7 @@ LL | const Y: () = unreachable!();
    |               |
    |               the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore.rs:8:15
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/const_panic_libcore.rs:11:15
@@ -27,7 +27,7 @@ LL | const X: () = unimplemented!();
    |               |
    |               the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore.rs:11:15
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr
index 24ddefe01b5..c5887ff8c56 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr
+++ b/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr
@@ -7,7 +7,7 @@ LL | const Z: () = panic!("cheese");
    |               the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:9:15
    |
    = note: `#[deny(const_err)]` on by default
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/const_panic_libcore_main.rs:12:15
@@ -17,7 +17,7 @@ LL | const Y: () = unreachable!();
    |               |
    |               the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:12:15
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/const_panic_libcore_main.rs:15:15
@@ -27,7 +27,7 @@ LL | const X: () = unimplemented!();
    |               |
    |               the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_main.rs:15:15
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr b/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr
index ac0ff7025d1..82edcefb86e 100644
--- a/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr
+++ b/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr
@@ -6,7 +6,7 @@ LL | const Z: () = panic!("cheese");
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/51999
    = help: add `#![feature(const_panic)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: panicking in constants is unstable
   --> $DIR/feature-gate-const_panic.rs:9:15
@@ -16,7 +16,7 @@ LL | const X: () = unimplemented!();
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/51999
    = help: add `#![feature(const_panic)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: panicking in constants is unstable
   --> $DIR/feature-gate-const_panic.rs:6:15
@@ -26,7 +26,7 @@ LL | const Y: () = unreachable!();
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/51999
    = help: add `#![feature(const_panic)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
index d09a295264c..ea4eba89eb7 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![warn(const_err)]
    |         ^^^^^^^^^
-   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: erroneous constant used
   --> $DIR/panic-assoc-never-type.rs:16:13
diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr
index 3daad0a2fdd..28333c511dc 100644
--- a/src/test/ui/consts/const-eval/panic-never-type.stderr
+++ b/src/test/ui/consts/const-eval/panic-never-type.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![warn(const_err)]
    |         ^^^^^^^^^
-   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: erroneous constant used
   --> $DIR/panic-never-type.rs:12:13
diff --git a/src/test/ui/consts/const-external-macro-const-err.stderr b/src/test/ui/consts/const-external-macro-const-err.stderr
index 237c4d792c9..06a630d82d8 100644
--- a/src/test/ui/consts/const-external-macro-const-err.stderr
+++ b/src/test/ui/consts/const-external-macro-const-err.stderr
@@ -5,7 +5,7 @@ LL |     static_assert!(2 + 2 == 5);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1
    |
    = note: `#[deny(const_err)]` on by default
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/control-flow/assert.both.stderr b/src/test/ui/consts/control-flow/assert.both.stderr
index 44769175f0e..7dd60cfb545 100644
--- a/src/test/ui/consts/control-flow/assert.both.stderr
+++ b/src/test/ui/consts/control-flow/assert.both.stderr
@@ -7,7 +7,7 @@ LL | const _: () = assert!(false);
    |               the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:12:15
    |
    = note: `#[deny(const_err)]` on by default
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/control-flow/assert.if_match.stderr b/src/test/ui/consts/control-flow/assert.if_match.stderr
index 9c8963f6c7b..476cf89edf0 100644
--- a/src/test/ui/consts/control-flow/assert.if_match.stderr
+++ b/src/test/ui/consts/control-flow/assert.if_match.stderr
@@ -6,7 +6,7 @@ LL | const _: () = assert!(true);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/51999
    = help: add `#![feature(const_panic)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: panicking in constants is unstable
   --> $DIR/assert.rs:12:15
@@ -16,7 +16,7 @@ LL | const _: () = assert!(false);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/51999
    = help: add `#![feature(const_panic)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/control-flow/assert.panic.stderr b/src/test/ui/consts/control-flow/assert.panic.stderr
index 11550bf801a..043efa038aa 100644
--- a/src/test/ui/consts/control-flow/assert.panic.stderr
+++ b/src/test/ui/consts/control-flow/assert.panic.stderr
@@ -6,6 +6,7 @@ LL | const _: () = assert!(true);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: `if` is not allowed in a `const`
   --> $DIR/assert.rs:12:15
@@ -15,6 +16,7 @@ LL | const _: () = assert!(false);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/control-flow/assert.stock.stderr b/src/test/ui/consts/control-flow/assert.stock.stderr
index 11550bf801a..043efa038aa 100644
--- a/src/test/ui/consts/control-flow/assert.stock.stderr
+++ b/src/test/ui/consts/control-flow/assert.stock.stderr
@@ -6,6 +6,7 @@ LL | const _: () = assert!(true);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: `if` is not allowed in a `const`
   --> $DIR/assert.rs:12:15
@@ -15,6 +16,7 @@ LL | const _: () = assert!(false);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/control-flow/issue-50577.if_match.stderr b/src/test/ui/consts/control-flow/issue-50577.if_match.stderr
index 6771224e6cf..831360d5652 100644
--- a/src/test/ui/consts/control-flow/issue-50577.if_match.stderr
+++ b/src/test/ui/consts/control-flow/issue-50577.if_match.stderr
@@ -9,7 +9,7 @@ LL |         Drop = assert_eq!(1, 1)
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/control-flow/issue-50577.stock.stderr b/src/test/ui/consts/control-flow/issue-50577.stock.stderr
index 7d637f5aa96..523bd23258f 100644
--- a/src/test/ui/consts/control-flow/issue-50577.stock.stderr
+++ b/src/test/ui/consts/control-flow/issue-50577.stock.stderr
@@ -6,7 +6,7 @@ LL |         Drop = assert_eq!(1, 1)
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: `if` is not allowed in a `const`
   --> $DIR/issue-50577.rs:7:16
@@ -16,7 +16,7 @@ LL |         Drop = assert_eq!(1, 1)
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: `match` is not allowed in a `const`
   --> $DIR/issue-50577.rs:7:16
@@ -26,7 +26,7 @@ LL |         Drop = assert_eq!(1, 1)
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49146
    = help: add `#![feature(const_if_match)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0317]: `if` may be missing an `else` clause
   --> $DIR/issue-50577.rs:7:16
@@ -39,7 +39,7 @@ LL |         Drop = assert_eq!(1, 1)
    |
    = note: `if` expressions without `else` evaluate to `()`
    = help: consider adding an `else` block that evaluates to the expected type
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/consts/control-flow/short-circuit.stock.stderr b/src/test/ui/consts/control-flow/short-circuit.stock.stderr
index cf0de929593..f32f248af45 100644
--- a/src/test/ui/consts/control-flow/short-circuit.stock.stderr
+++ b/src/test/ui/consts/control-flow/short-circuit.stock.stderr
@@ -7,7 +7,7 @@ LL | const _: bool = true || panic!();
    |                         the evaluated program panicked at 'explicit panic', $DIR/short-circuit.rs:10:25
    |
    = note: `#[deny(const_err)]` on by default
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: any use of this value will cause an error
   --> $DIR/short-circuit.rs:11:26
@@ -17,7 +17,7 @@ LL | const _: bool = false && panic!();
    |                          |
    |                          the evaluated program panicked at 'explicit panic', $DIR/short-circuit.rs:11:26
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/enum-discr-type-err.stderr b/src/test/ui/consts/enum-discr-type-err.stderr
index 9935f88e5b5..492b79e2e60 100644
--- a/src/test/ui/consts/enum-discr-type-err.stderr
+++ b/src/test/ui/consts/enum-discr-type-err.stderr
@@ -10,6 +10,7 @@ LL | |     B = T,
 LL | | }
    | |_- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
    |
 LL |             $( $v = $s::V.try_into().unwrap(), )*
@@ -27,6 +28,7 @@ LL | |     B = T,
 LL | | }
    | |_- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
    |
 LL |             $( $v = $s::V.try_into().unwrap(), )*
diff --git a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
index ecfd30e7b44..2c68ddd8c9a 100644
--- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
+++ b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
@@ -6,7 +6,7 @@ LL |     vec![1, 2, 3]
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr
index b6ebe0ff1fc..9f58f16c1a0 100644
--- a/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr
+++ b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr
@@ -4,7 +4,7 @@ error: 1 positional argument in format string, but no arguments were given
 LL |     myprintln!("{}");
    |     ^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/cross/cross-file-errors/main.stderr b/src/test/ui/cross/cross-file-errors/main.stderr
index 7fd91eb1d66..f9101d8a583 100644
--- a/src/test/ui/cross/cross-file-errors/main.stderr
+++ b/src/test/ui/cross/cross-file-errors/main.stderr
@@ -8,6 +8,8 @@ LL |         _
    |
 LL |     underscore!();
    |     -------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/custom_test_frameworks/mismatch.stderr b/src/test/ui/custom_test_frameworks/mismatch.stderr
index 9e2688c6393..420ddbc3def 100644
--- a/src/test/ui/custom_test_frameworks/mismatch.stderr
+++ b/src/test/ui/custom_test_frameworks/mismatch.stderr
@@ -5,6 +5,7 @@ LL | fn wrong_kind(){}
    | ^^^^^^^^^^^^^^^^^ the trait `example_runner::Testable` is not implemented for `test::TestDescAndFn`
    |
    = note: required for the cast to the object type `dyn example_runner::Testable`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.rs b/src/test/ui/dep-graph/dep-graph-variance-alias.rs
index 95645687307..927ea559778 100644
--- a/src/test/ui/dep-graph/dep-graph-variance-alias.rs
+++ b/src/test/ui/dep-graph/dep-graph-variance-alias.rs
@@ -6,17 +6,16 @@
 #![feature(rustc_attrs)]
 #![allow(dead_code)]
 #![allow(unused_variables)]
-
-fn main() { }
+#![rustc_if_this_changed(hir_crate)]
+fn main() {}
 
 struct Foo<T> {
-    f: T
+    f: T,
 }
 
-#[rustc_if_this_changed(Krate)]
 type TypeAlias<T> = Foo<T>;
 
 #[rustc_then_this_would_need(variances_of)] //~ ERROR OK
 struct Use<T> {
-    x: TypeAlias<T>
+    x: TypeAlias<T>,
 }
diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr
index 554ff455a20..2422cb9bb2f 100644
--- a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr
+++ b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr
@@ -1,5 +1,5 @@
 error: OK
-  --> $DIR/dep-graph-variance-alias.rs:19:1
+  --> $DIR/dep-graph-variance-alias.rs:18:1
    |
 LL | #[rustc_then_this_would_need(variances_of)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/deprecation/deprecation-lint-2.stderr b/src/test/ui/deprecation/deprecation-lint-2.stderr
index e8c2156742f..65152a2f9ab 100644
--- a/src/test/ui/deprecation/deprecation-lint-2.stderr
+++ b/src/test/ui/deprecation/deprecation-lint-2.stderr
@@ -9,7 +9,7 @@ note: the lint level is defined here
    |
 LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/deprecation/deprecation-lint-3.stderr b/src/test/ui/deprecation/deprecation-lint-3.stderr
index 7cc06a23b0f..b450f74d7f3 100644
--- a/src/test/ui/deprecation/deprecation-lint-3.stderr
+++ b/src/test/ui/deprecation/deprecation-lint-3.stderr
@@ -9,7 +9,7 @@ note: the lint level is defined here
    |
 LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr
index 226f6fb620f..89fd7aae3be 100644
--- a/src/test/ui/deref-suggestion.stderr
+++ b/src/test/ui/deref-suggestion.stderr
@@ -42,6 +42,8 @@ LL |     ($x:expr) => { &$x }
 ...
 LL |     foo3(borrow!(0));
    |          ---------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/deref-suggestion.rs:36:5
@@ -49,7 +51,7 @@ error[E0308]: mismatched types
 LL |     assert_eq!(3i32, &3i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/deref-suggestion.rs:39:17
diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr
index 5ddc5b5708c..8ef2d3d3023 100644
--- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr
@@ -5,6 +5,7 @@ LL |      x: Error
    |      ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
    |
    = note: required by `std::clone::Clone::clone`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr
index 80ef9238f47..8c740733e2f 100644
--- a/src/test/ui/derives/derives-span-Clone-enum.stderr
+++ b/src/test/ui/derives/derives-span-Clone-enum.stderr
@@ -5,6 +5,7 @@ LL |      Error
    |      ^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
    |
    = note: required by `std::clone::Clone::clone`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr
index 17f3925107b..75a59fbf035 100644
--- a/src/test/ui/derives/derives-span-Clone-struct.stderr
+++ b/src/test/ui/derives/derives-span-Clone-struct.stderr
@@ -5,6 +5,7 @@ LL |     x: Error
    |     ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
    |
    = note: required by `std::clone::Clone::clone`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr
index e98212f3618..1860c5f2ff6 100644
--- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr
@@ -5,6 +5,7 @@ LL |     Error
    |     ^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
    |
    = note: required by `std::clone::Clone::clone`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr
index 233c4c54983..ab3c5ef3c1d 100644
--- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr
@@ -8,6 +8,7 @@ LL |      x: Error
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
    = note: required for the cast to the object type `dyn std::fmt::Debug`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr
index fbda3980cfc..e0a76d52515 100644
--- a/src/test/ui/derives/derives-span-Debug-enum.stderr
+++ b/src/test/ui/derives/derives-span-Debug-enum.stderr
@@ -8,6 +8,7 @@ LL |      Error
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
    = note: required for the cast to the object type `dyn std::fmt::Debug`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr
index b56d223b34b..2f5cba09e4c 100644
--- a/src/test/ui/derives/derives-span-Debug-struct.stderr
+++ b/src/test/ui/derives/derives-span-Debug-struct.stderr
@@ -8,6 +8,7 @@ LL |     x: Error
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
    = note: required for the cast to the object type `dyn std::fmt::Debug`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr
index 76dd6e31e60..58ec131d541 100644
--- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr
@@ -8,6 +8,7 @@ LL |     Error
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
    = note: required for the cast to the object type `dyn std::fmt::Debug`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr
index 784be7fede3..b97dda719ab 100644
--- a/src/test/ui/derives/derives-span-Default-struct.stderr
+++ b/src/test/ui/derives/derives-span-Default-struct.stderr
@@ -5,6 +5,7 @@ LL |     x: Error
    |     ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error`
    |
    = note: required by `std::default::Default::default`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr
index a93fa058f8d..d976891f41f 100644
--- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr
@@ -5,6 +5,7 @@ LL |     Error
    |     ^^^^^ the trait `std::default::Default` is not implemented for `Error`
    |
    = note: required by `std::default::Default::default`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr
index bad0ce31f70..f886c29c4db 100644
--- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr
@@ -5,6 +5,7 @@ LL |      x: Error
    |      ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
    |
    = note: required by `std::cmp::AssertParamIsEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr
index a7cc19d4c0f..0b5470138a5 100644
--- a/src/test/ui/derives/derives-span-Eq-enum.stderr
+++ b/src/test/ui/derives/derives-span-Eq-enum.stderr
@@ -5,6 +5,7 @@ LL |      Error
    |      ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
    |
    = note: required by `std::cmp::AssertParamIsEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr
index 10631cb12bf..76904d67235 100644
--- a/src/test/ui/derives/derives-span-Eq-struct.stderr
+++ b/src/test/ui/derives/derives-span-Eq-struct.stderr
@@ -5,6 +5,7 @@ LL |     x: Error
    |     ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
    |
    = note: required by `std::cmp::AssertParamIsEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr
index 117ed62cf7a..ff94b989d26 100644
--- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr
@@ -5,6 +5,7 @@ LL |     Error
    |     ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
    |
    = note: required by `std::cmp::AssertParamIsEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr
index 00b033004ec..889c725c843 100644
--- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr
@@ -8,6 +8,8 @@ LL |      x: Error
    |
 LL |     fn hash<H: Hasher>(&self, state: &mut H);
    |             - required by this bound in `std::hash::Hash::hash`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr
index 004cabf207a..70b8a85d107 100644
--- a/src/test/ui/derives/derives-span-Hash-enum.stderr
+++ b/src/test/ui/derives/derives-span-Hash-enum.stderr
@@ -8,6 +8,8 @@ LL |      Error
    |
 LL |     fn hash<H: Hasher>(&self, state: &mut H);
    |             - required by this bound in `std::hash::Hash::hash`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr
index 27b8ff3d114..61897392a72 100644
--- a/src/test/ui/derives/derives-span-Hash-struct.stderr
+++ b/src/test/ui/derives/derives-span-Hash-struct.stderr
@@ -8,6 +8,8 @@ LL |     x: Error
    |
 LL |     fn hash<H: Hasher>(&self, state: &mut H);
    |             - required by this bound in `std::hash::Hash::hash`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr
index f1142bc5033..fb929ad985b 100644
--- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr
@@ -8,6 +8,8 @@ LL |     Error
    |
 LL |     fn hash<H: Hasher>(&self, state: &mut H);
    |             - required by this bound in `std::hash::Hash::hash`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr
index 1d9d1332b57..7e73392fd51 100644
--- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr
@@ -5,6 +5,7 @@ LL |      x: Error
    |      ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr
index acc8b0c6948..68df309e046 100644
--- a/src/test/ui/derives/derives-span-Ord-enum.stderr
+++ b/src/test/ui/derives/derives-span-Ord-enum.stderr
@@ -5,6 +5,7 @@ LL |      Error
    |      ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr
index e4dcf29545f..5e1ed335094 100644
--- a/src/test/ui/derives/derives-span-Ord-struct.stderr
+++ b/src/test/ui/derives/derives-span-Ord-struct.stderr
@@ -5,6 +5,7 @@ LL |     x: Error
    |     ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr
index c21dfc26cb0..d9692e56431 100644
--- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr
@@ -5,6 +5,7 @@ LL |     Error
    |     ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
index eb4b1c84a60..c669636c850 100644
--- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
@@ -5,6 +5,7 @@ LL |      x: Error
    |      ^^^^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0369]: binary operation `!=` cannot be applied to type `Error`
   --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:13:6
@@ -13,6 +14,7 @@ LL |      x: Error
    |      ^^^^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr
index b63e374d89b..ff98edea4dc 100644
--- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr
+++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr
@@ -5,6 +5,7 @@ LL |      Error
    |      ^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0369]: binary operation `!=` cannot be applied to type `Error`
   --> $DIR/derives-span-PartialEq-enum.rs:13:6
@@ -13,6 +14,7 @@ LL |      Error
    |      ^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr
index a147f409639..200b8e2d503 100644
--- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr
+++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr
@@ -5,6 +5,7 @@ LL |     x: Error
    |     ^^^^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0369]: binary operation `!=` cannot be applied to type `Error`
   --> $DIR/derives-span-PartialEq-struct.rs:12:5
@@ -13,6 +14,7 @@ LL |     x: Error
    |     ^^^^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr
index fefbf5f9ec9..9e3d1309c22 100644
--- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr
@@ -5,6 +5,7 @@ LL |     Error
    |     ^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0369]: binary operation `!=` cannot be applied to type `Error`
   --> $DIR/derives-span-PartialEq-tuple-struct.rs:12:5
@@ -13,6 +14,7 @@ LL |     Error
    |     ^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
index 80b896f4f04..6433d1f5e27 100644
--- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
+++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
@@ -6,6 +6,7 @@ LL |      x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:13:6
@@ -15,6 +16,7 @@ LL |      x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:13:6
@@ -24,6 +26,7 @@ LL |      x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:13:6
@@ -33,6 +36,7 @@ LL |      x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:13:6
@@ -42,6 +46,7 @@ LL |      x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr
index f12038fb867..b1be7dd05f9 100644
--- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr
+++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr
@@ -6,6 +6,7 @@ LL |      Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum.rs:13:6
@@ -15,6 +16,7 @@ LL |      Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum.rs:13:6
@@ -24,6 +26,7 @@ LL |      Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum.rs:13:6
@@ -33,6 +36,7 @@ LL |      Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-enum.rs:13:6
@@ -42,6 +46,7 @@ LL |      Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr
index dbb014752ec..064c91fd7dd 100644
--- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr
+++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr
@@ -6,6 +6,7 @@ LL |     x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-struct.rs:12:5
@@ -15,6 +16,7 @@ LL |     x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-struct.rs:12:5
@@ -24,6 +26,7 @@ LL |     x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-struct.rs:12:5
@@ -33,6 +36,7 @@ LL |     x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-struct.rs:12:5
@@ -42,6 +46,7 @@ LL |     x: Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
index f6f1694bbf0..5b627022cca 100644
--- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
+++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
@@ -6,6 +6,7 @@ LL |     Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-tuple-struct.rs:12:5
@@ -15,6 +16,7 @@ LL |     Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-tuple-struct.rs:12:5
@@ -24,6 +26,7 @@ LL |     Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-tuple-struct.rs:12:5
@@ -33,6 +36,7 @@ LL |     Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Error` with `Error`
   --> $DIR/derives-span-PartialOrd-tuple-struct.rs:12:5
@@ -42,6 +46,7 @@ LL |     Error
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr
index 3b480f00df6..d4995c1d50c 100644
--- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr
+++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr
@@ -5,6 +5,7 @@ LL |     x: NoCloneOrEq
    |     ^^^^^^^^^^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq`
   --> $DIR/deriving-no-inner-impl-error-message.rs:5:5
@@ -13,6 +14,7 @@ LL |     x: NoCloneOrEq
    |     ^^^^^^^^^^^^^^
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `NoCloneOrEq: std::clone::Clone` is not satisfied
   --> $DIR/deriving-no-inner-impl-error-message.rs:10:5
@@ -21,6 +23,7 @@ LL |     x: NoCloneOrEq
    |     ^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `NoCloneOrEq`
    |
    = note: required by `std::clone::Clone::clone`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/derives/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr
index 8ab2e4cba74..d739257c8de 100644
--- a/src/test/ui/derives/deriving-with-repr-packed.stderr
+++ b/src/test/ui/derives/deriving-with-repr-packed.stderr
@@ -11,6 +11,7 @@ LL | #![deny(safe_packed_borrows)]
    |         ^^^^^^^^^^^^^^^^^^^
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `#[derive]` can't be used on a `#[repr(packed)]` struct with type or const parameters (error E0133)
   --> $DIR/deriving-with-repr-packed.rs:8:23
@@ -20,6 +21,7 @@ LL | #[derive(Copy, Clone, PartialEq, Eq)]
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
   --> $DIR/deriving-with-repr-packed.rs:16:10
@@ -29,6 +31,7 @@ LL | #[derive(PartialEq, Eq)]
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
   --> $DIR/deriving-with-repr-packed.rs:25:10
@@ -38,6 +41,7 @@ LL | #[derive(PartialEq)]
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.stderr b/src/test/ui/did_you_mean/bad-assoc-expr.stderr
index 2024564b911..fe3fb43730a 100644
--- a/src/test/ui/did_you_mean/bad-assoc-expr.stderr
+++ b/src/test/ui/did_you_mean/bad-assoc-expr.stderr
@@ -54,6 +54,8 @@ LL |     ($ty: ty) => ($ty::clone(&0))
 ...
 LL |     expr!(u8);
    |     ---------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 9 previous errors
 
diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.stderr b/src/test/ui/did_you_mean/bad-assoc-pat.stderr
index 3f1946b94f6..924a5d75643 100644
--- a/src/test/ui/did_you_mean/bad-assoc-pat.stderr
+++ b/src/test/ui/did_you_mean/bad-assoc-pat.stderr
@@ -36,6 +36,8 @@ LL |     ($ty: ty) => ($ty::AssocItem)
 ...
 LL |         pat!(u8) => {}
    |         -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope
   --> $DIR/bad-assoc-pat.rs:3:15
@@ -69,6 +71,8 @@ LL |     ($ty: ty) => ($ty::AssocItem)
 ...
 LL |         pat!(u8) => {}
    |         -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0599]: no associated item named `AssocItem` found for type `u8` in the current scope
   --> $DIR/bad-assoc-pat.rs:32:16
diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr
index 7d3c99bda6b..64e49934d87 100644
--- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr
@@ -54,6 +54,8 @@ LL |     ($ty: ty) => ($ty::AssocTy);
 ...
 LL | type J = ty!(u8);
    |          ------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:1:10
@@ -111,6 +113,8 @@ LL |     ($ty: ty) => ($ty::AssocTy);
 ...
 LL | type J = ty!(u8);
    |          ------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:44:10
diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.stderr b/src/test/ui/did_you_mean/recursion_limit_macro.stderr
index 18d321c24d8..4935c698f20 100644
--- a/src/test/ui/did_you_mean/recursion_limit_macro.stderr
+++ b/src/test/ui/did_you_mean/recursion_limit_macro.stderr
@@ -8,6 +8,7 @@ LL |     recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9);
    |     -------------------------------------------------- in this macro invocation
    |
    = help: consider adding a `#![recursion_limit="20"]` attribute to your crate (`recursion_limit_macro`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr
index 55261a5e6ae..2aad57dee7d 100644
--- a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr
+++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr
@@ -6,6 +6,8 @@ LL |         use a::$crate::b;
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0432]: unresolved import `a::$crate`
   --> $DIR/dollar-crate-is-keyword-2.rs:5:13
@@ -15,6 +17,8 @@ LL |         use a::$crate;
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
   --> $DIR/dollar-crate-is-keyword-2.rs:7:21
@@ -24,6 +28,8 @@ LL |         type A = a::$crate;
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr
index f5a5f13f912..d424bd2f285 100644
--- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr
+++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr
@@ -6,6 +6,8 @@ LL |             struct $crate {}
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected identifier, found reserved identifier `$crate`
   --> $DIR/dollar-crate-is-keyword.rs:10:23
@@ -15,6 +17,8 @@ LL |         use $crate as $crate;
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `$crate` may not be imported
   --> $DIR/dollar-crate-is-keyword.rs:9:9
@@ -24,6 +28,8 @@ LL |         use $crate;
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `$crate` may not be imported
   --> $DIR/dollar-crate-is-keyword.rs:10:9
@@ -33,6 +39,8 @@ LL |         use $crate as $crate;
 ...
 LL | m!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/drop/dynamic-drop.rs b/src/test/ui/drop/dynamic-drop.rs
index b4406204a5d..659e520d4cd 100644
--- a/src/test/ui/drop/dynamic-drop.rs
+++ b/src/test/ui/drop/dynamic-drop.rs
@@ -184,7 +184,7 @@ fn generator(a: &Allocator, run_count: usize) {
          );
     };
     for _ in 0..run_count {
-        Pin::new(&mut gen).resume();
+        Pin::new(&mut gen).resume(());
     }
 }
 
diff --git a/src/test/ui/editions/edition-imports-2015.stderr b/src/test/ui/editions/edition-imports-2015.stderr
index 4aba5323cc5..ec8b88ecba2 100644
--- a/src/test/ui/editions/edition-imports-2015.stderr
+++ b/src/test/ui/editions/edition-imports-2015.stderr
@@ -4,7 +4,7 @@ error: cannot glob-import all possible crates
 LL |     gen_glob!();
    |     ^^^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/editions/edition-imports-2018.stderr b/src/test/ui/editions/edition-imports-2018.stderr
index 6ef49b62560..087d2e33954 100644
--- a/src/test/ui/editions/edition-imports-2018.stderr
+++ b/src/test/ui/editions/edition-imports-2018.stderr
@@ -4,7 +4,7 @@ error: cannot glob-import all possible crates
 LL |     gen_glob!();
    |     ^^^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr
index e6d0f18a677..56cbd882cca 100644
--- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr
+++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr
@@ -4,7 +4,7 @@ error[E0432]: unresolved import `E`
 LL |     gen_gated!();
    |     ^^^^^^^^^^^^^ could not find `E` in `{{root}}`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
index 04a70cf9830..f44f81fce71 100644
--- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
+++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
@@ -4,7 +4,7 @@ error: expected identifier, found keyword `async`
 LL |     produces_async! {}
    |     ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can escape reserved keywords to use them as identifiers
    |
 LL | () => (pub fn r#async () { })
diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
index fb12051eed4..a8fc58fc0cb 100644
--- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
+++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
@@ -4,7 +4,7 @@ error: expected identifier, found keyword `async`
 LL |     produces_async! {}
    |     ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can escape reserved keywords to use them as identifiers
    |
 LL | () => (pub fn r#async () { })
diff --git a/src/test/ui/error-codes/E0184.stderr b/src/test/ui/error-codes/E0184.stderr
index b4128b95606..591ea29ff8c 100644
--- a/src/test/ui/error-codes/E0184.stderr
+++ b/src/test/ui/error-codes/E0184.stderr
@@ -3,6 +3,8 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type ha
    |
 LL | #[derive(Copy)]
    |          ^^^^ Copy not allowed on types with destructors
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0665.stderr b/src/test/ui/error-codes/E0665.stderr
index 2c2b498e39a..3cb69492eb7 100644
--- a/src/test/ui/error-codes/E0665.stderr
+++ b/src/test/ui/error-codes/E0665.stderr
@@ -3,6 +3,8 @@ error[E0665]: `Default` cannot be derived for enums, only structs
    |
 LL | #[derive(Default)]
    |          ^^^^^^^
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/exclusive-drop-and-copy.stderr b/src/test/ui/exclusive-drop-and-copy.stderr
index 9983aac4f9c..f1e725ec342 100644
--- a/src/test/ui/exclusive-drop-and-copy.stderr
+++ b/src/test/ui/exclusive-drop-and-copy.stderr
@@ -3,12 +3,16 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type ha
    |
 LL | #[derive(Copy, Clone)]
    |          ^^^^ Copy not allowed on types with destructors
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
   --> $DIR/exclusive-drop-and-copy.rs:10:10
    |
 LL | #[derive(Copy, Clone)]
    |          ^^^^ Copy not allowed on types with destructors
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr
index 72f5642e72a..89c99b89ca8 100644
--- a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr
+++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr
@@ -8,6 +8,7 @@ LL | bar!();
    | ------- in this macro invocation
    |
    = help: add `#![feature(allow_internal_unsafe)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr
index 71005943362..935b95668e8 100644
--- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr
+++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr
@@ -8,6 +8,7 @@ LL | bar!();
    | ------- in this macro invocation
    |
    = help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr
index 14519622c05..1c319c6dad4 100644
--- a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr
+++ b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr
@@ -12,6 +12,8 @@ error[E0425]: cannot find value `ab` in this scope
    |
 LL |     concat_idents!(a, b);
    |     ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/feature-gates/feature-gate-no_sanitize.rs b/src/test/ui/feature-gates/feature-gate-no_sanitize.rs
new file mode 100644
index 00000000000..66a9263e13a
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-no_sanitize.rs
@@ -0,0 +1,4 @@
+#[no_sanitize(address)]
+//~^ the `#[no_sanitize]` attribute is an experimental feature
+fn main() {
+}
diff --git a/src/test/ui/feature-gates/feature-gate-no_sanitize.stderr b/src/test/ui/feature-gates/feature-gate-no_sanitize.stderr
new file mode 100644
index 00000000000..7359cf03652
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-no_sanitize.stderr
@@ -0,0 +1,12 @@
+error[E0658]: the `#[no_sanitize]` attribute is an experimental feature
+  --> $DIR/feature-gate-no_sanitize.rs:1:1
+   |
+LL | #[no_sanitize(address)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/39699
+   = help: add `#![feature(no_sanitize)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/generator-yielding-or-returning-itself.rs b/src/test/ui/generator-yielding-or-returning-itself.rs
index fd526679818..30788e3c186 100644
--- a/src/test/ui/generator-yielding-or-returning-itself.rs
+++ b/src/test/ui/generator-yielding-or-returning-itself.rs
@@ -13,7 +13,7 @@ pub fn want_cyclic_generator_return<T>(_: T)
 
 fn supply_cyclic_generator_return() {
     want_cyclic_generator_return(|| {
-        //~^ ERROR closure/generator type that references itself
+        //~^ ERROR type mismatch
         if false { yield None.unwrap(); }
         None.unwrap()
     })
diff --git a/src/test/ui/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator-yielding-or-returning-itself.stderr
index c9a71e03858..1572219cf4a 100644
--- a/src/test/ui/generator-yielding-or-returning-itself.stderr
+++ b/src/test/ui/generator-yielding-or-returning-itself.stderr
@@ -1,13 +1,13 @@
-error[E0644]: closure/generator type that references itself
-  --> $DIR/generator-yielding-or-returning-itself.rs:15:34
+error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6 _] as std::ops::Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6 _]`
+  --> $DIR/generator-yielding-or-returning-itself.rs:15:5
    |
-LL |       want_cyclic_generator_return(|| {
-   |  __________________________________^
-LL | |
-LL | |         if false { yield None.unwrap(); }
-LL | |         None.unwrap()
-LL | |     })
-   | |_____^ cyclic type of infinite size
+LL | pub fn want_cyclic_generator_return<T>(_: T)
+   |        ----------------------------
+LL |     where T: Generator<Yield = (), Return = T>
+   |                                    ---------- required by this bound in `want_cyclic_generator_return`
+...
+LL |     want_cyclic_generator_return(|| {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size
    |
    = note: closures cannot capture themselves or take themselves as argument;
            this error may be the result of a recent compiler bug-fix,
@@ -30,5 +30,4 @@ LL |     want_cyclic_generator_yield(|| {
 
 error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0271, E0644.
-For more information about an error, try `rustc --explain E0271`.
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/ui/generator/auxiliary/xcrate-reachable.rs b/src/test/ui/generator/auxiliary/xcrate-reachable.rs
index 33337f8038f..2dd5ea67523 100644
--- a/src/test/ui/generator/auxiliary/xcrate-reachable.rs
+++ b/src/test/ui/generator/auxiliary/xcrate-reachable.rs
@@ -6,7 +6,7 @@ fn msg() -> u32 {
     0
 }
 
-pub fn foo() -> impl Generator<Yield=(), Return=u32> {
+pub fn foo() -> impl Generator<(), Yield=(), Return=u32> {
     || {
         yield;
         return msg();
diff --git a/src/test/ui/generator/auxiliary/xcrate.rs b/src/test/ui/generator/auxiliary/xcrate.rs
index 613c495832f..d07abd0918c 100644
--- a/src/test/ui/generator/auxiliary/xcrate.rs
+++ b/src/test/ui/generator/auxiliary/xcrate.rs
@@ -3,7 +3,7 @@
 use std::marker::Unpin;
 use std::ops::Generator;
 
-pub fn foo() -> impl Generator<Yield = (), Return = ()> {
+pub fn foo() -> impl Generator<(), Yield = (), Return = ()> {
     || {
         if false {
             yield;
@@ -11,7 +11,7 @@ pub fn foo() -> impl Generator<Yield = (), Return = ()> {
     }
 }
 
-pub fn bar<T: 'static>(t: T) -> Box<Generator<Yield = T, Return = ()> + Unpin> {
+pub fn bar<T: 'static>(t: T) -> Box<Generator<(), Yield = T, Return = ()> + Unpin> {
     Box::new(|| {
         yield t;
     })
diff --git a/src/test/ui/generator/borrowing.rs b/src/test/ui/generator/borrowing.rs
index 6234b738048..d36592583cd 100644
--- a/src/test/ui/generator/borrowing.rs
+++ b/src/test/ui/generator/borrowing.rs
@@ -6,7 +6,7 @@ use std::pin::Pin;
 fn main() {
     let _b = {
         let a = 3;
-        Pin::new(&mut || yield &a).resume()
+        Pin::new(&mut || yield &a).resume(())
         //~^ ERROR: `a` does not live long enough
     };
 
diff --git a/src/test/ui/generator/borrowing.stderr b/src/test/ui/generator/borrowing.stderr
index 3d58873f826..83987e19839 100644
--- a/src/test/ui/generator/borrowing.stderr
+++ b/src/test/ui/generator/borrowing.stderr
@@ -1,7 +1,7 @@
 error[E0597]: `a` does not live long enough
   --> $DIR/borrowing.rs:9:33
    |
-LL |         Pin::new(&mut || yield &a).resume()
+LL |         Pin::new(&mut || yield &a).resume(())
    |                       ----------^
    |                       |         |
    |                       |         borrowed value does not live long enough
diff --git a/src/test/ui/generator/conditional-drop.rs b/src/test/ui/generator/conditional-drop.rs
index 907f7a3c06d..990d94e6efc 100644
--- a/src/test/ui/generator/conditional-drop.rs
+++ b/src/test/ui/generator/conditional-drop.rs
@@ -35,9 +35,9 @@ fn t1() {
     };
 
     let n = A.load(Ordering::SeqCst);
-    Pin::new(&mut a).resume();
+    Pin::new(&mut a).resume(());
     assert_eq!(A.load(Ordering::SeqCst), n + 1);
-    Pin::new(&mut a).resume();
+    Pin::new(&mut a).resume(());
     assert_eq!(A.load(Ordering::SeqCst), n + 1);
 }
 
@@ -51,8 +51,8 @@ fn t2() {
     };
 
     let n = A.load(Ordering::SeqCst);
-    Pin::new(&mut a).resume();
+    Pin::new(&mut a).resume(());
     assert_eq!(A.load(Ordering::SeqCst), n);
-    Pin::new(&mut a).resume();
+    Pin::new(&mut a).resume(());
     assert_eq!(A.load(Ordering::SeqCst), n + 1);
 }
diff --git a/src/test/ui/generator/control-flow.rs b/src/test/ui/generator/control-flow.rs
index df70e013bd3..9d4c217b76e 100644
--- a/src/test/ui/generator/control-flow.rs
+++ b/src/test/ui/generator/control-flow.rs
@@ -7,10 +7,10 @@ use std::ops::{GeneratorState, Generator};
 use std::pin::Pin;
 
 fn finish<T>(mut amt: usize, mut t: T) -> T::Return
-    where T: Generator<Yield = ()> + Unpin,
+    where T: Generator<(), Yield = ()> + Unpin,
 {
     loop {
-        match Pin::new(&mut t).resume() {
+        match Pin::new(&mut t).resume(()) {
             GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(),
             GeneratorState::Complete(ret) => {
                 assert_eq!(amt, 0);
diff --git a/src/test/ui/generator/drop-and-replace.rs b/src/test/ui/generator/drop-and-replace.rs
index bb33502815b..a9a50a122a1 100644
--- a/src/test/ui/generator/drop-and-replace.rs
+++ b/src/test/ui/generator/drop-and-replace.rs
@@ -37,7 +37,7 @@ fn main() {
     };
 
     loop {
-        match Pin::new(&mut a).resume() {
+        match Pin::new(&mut a).resume(()) {
             GeneratorState::Complete(()) => break,
             _ => (),
         }
diff --git a/src/test/ui/generator/drop-env.rs b/src/test/ui/generator/drop-env.rs
index ac4e0665628..7ba71188104 100644
--- a/src/test/ui/generator/drop-env.rs
+++ b/src/test/ui/generator/drop-env.rs
@@ -30,7 +30,7 @@ fn t1() {
     };
 
     let n = A.load(Ordering::SeqCst);
-    drop(Pin::new(&mut foo).resume());
+    drop(Pin::new(&mut foo).resume(()));
     assert_eq!(A.load(Ordering::SeqCst), n);
     drop(foo);
     assert_eq!(A.load(Ordering::SeqCst), n + 1);
@@ -43,7 +43,7 @@ fn t2() {
     };
 
     let n = A.load(Ordering::SeqCst);
-    drop(Pin::new(&mut foo).resume());
+    drop(Pin::new(&mut foo).resume(()));
     assert_eq!(A.load(Ordering::SeqCst), n + 1);
     drop(foo);
     assert_eq!(A.load(Ordering::SeqCst), n + 1);
diff --git a/src/test/ui/generator/dropck-resume.rs b/src/test/ui/generator/dropck-resume.rs
new file mode 100644
index 00000000000..4c18077f335
--- /dev/null
+++ b/src/test/ui/generator/dropck-resume.rs
@@ -0,0 +1,33 @@
+#![feature(generators, generator_trait)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
+
+struct SetToNone<'a: 'b, 'b>(&'b mut Option<&'a i32>);
+
+impl<'a, 'b> Drop for SetToNone<'a, 'b> {
+    fn drop(&mut self) {
+        *self.0 = None;
+    }
+}
+
+fn drop_using_generator() -> i32 {
+    let mut y = Some(&0);
+    let z = &mut y;
+    let r;
+    {
+        let mut g = move |r| {
+            let _s = SetToNone(r);
+            yield;
+        };
+        let mut g = Pin::new(&mut g);
+        g.as_mut().resume(z);
+        r = y.as_ref().unwrap();
+        //~^ ERROR cannot borrow `y` as immutable because it is also borrowed as mutable
+    }
+    **r
+}
+
+fn main() {
+    println!("{}", drop_using_generator());
+}
diff --git a/src/test/ui/generator/dropck-resume.stderr b/src/test/ui/generator/dropck-resume.stderr
new file mode 100644
index 00000000000..ecf92e7e3ae
--- /dev/null
+++ b/src/test/ui/generator/dropck-resume.stderr
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+  --> $DIR/dropck-resume.rs:25:13
+   |
+LL |     let z = &mut y;
+   |             ------ mutable borrow occurs here
+...
+LL |         r = y.as_ref().unwrap();
+   |             ^ immutable borrow occurs here
+LL |
+LL |     }
+   |     - mutable borrow might be used here, when `g` is dropped and runs the destructor for generator
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/generator/dropck.rs b/src/test/ui/generator/dropck.rs
index 65c61fbaac4..da00b230d9f 100644
--- a/src/test/ui/generator/dropck.rs
+++ b/src/test/ui/generator/dropck.rs
@@ -15,6 +15,6 @@ fn main() {
         let _d = ref_.take(); //~ ERROR `ref_` does not live long enough
         yield;
     };
-    Pin::new(&mut gen).resume();
+    Pin::new(&mut gen).resume(());
     // drops the RefCell and then the Ref, leading to use-after-free
 }
diff --git a/src/test/ui/generator/generator-region-requirements.rs b/src/test/ui/generator/generator-region-requirements.rs
index 41cb339f459..5f0a6bb09b7 100644
--- a/src/test/ui/generator/generator-region-requirements.rs
+++ b/src/test/ui/generator/generator-region-requirements.rs
@@ -8,7 +8,7 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
         x
     };
     loop {
-        match Pin::new(&mut g).resume() {
+        match Pin::new(&mut g).resume(()) {
             GeneratorState::Complete(c) => return c,
             //~^ ERROR explicit lifetime required
             GeneratorState::Yielded(_) => (),
diff --git a/src/test/ui/generator/issue-44197.rs b/src/test/ui/generator/issue-44197.rs
index 6efaff50c1e..389b9d13969 100644
--- a/src/test/ui/generator/issue-44197.rs
+++ b/src/test/ui/generator/issue-44197.rs
@@ -2,14 +2,14 @@
 
 #![feature(generators, generator_trait)]
 
-use std::ops::{ Generator, GeneratorState };
+use std::ops::{Generator, GeneratorState};
 use std::pin::Pin;
 
 fn foo(_: &str) -> String {
     String::new()
 }
 
-fn bar(baz: String) -> impl Generator<Yield = String, Return = ()> {
+fn bar(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
     move || {
         yield foo(&baz);
     }
@@ -19,7 +19,7 @@ fn foo2(_: &str) -> Result<String, ()> {
     Err(())
 }
 
-fn bar2(baz: String) -> impl Generator<Yield = String, Return = ()> {
+fn bar2(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
     move || {
         if let Ok(quux) = foo2(&baz) {
             yield quux;
@@ -28,6 +28,9 @@ fn bar2(baz: String) -> impl Generator<Yield = String, Return = ()> {
 }
 
 fn main() {
-    assert_eq!(Pin::new(&mut bar(String::new())).resume(), GeneratorState::Yielded(String::new()));
-    assert_eq!(Pin::new(&mut bar2(String::new())).resume(), GeneratorState::Complete(()));
+    assert_eq!(
+        Pin::new(&mut bar(String::new())).resume(()),
+        GeneratorState::Yielded(String::new())
+    );
+    assert_eq!(Pin::new(&mut bar2(String::new())).resume(()), GeneratorState::Complete(()));
 }
diff --git a/src/test/ui/generator/issue-61442-stmt-expr-with-drop.rs b/src/test/ui/generator/issue-61442-stmt-expr-with-drop.rs
index e3d19029348..187c374021d 100644
--- a/src/test/ui/generator/issue-61442-stmt-expr-with-drop.rs
+++ b/src/test/ui/generator/issue-61442-stmt-expr-with-drop.rs
@@ -18,12 +18,12 @@ fn drop_and_yield() {
         String::new();
         yield;
     };
-    Box::pin(x).as_mut().resume();
+    Box::pin(x).as_mut().resume(());
     let y = static || {
         String::new();
         yield;
     };
-    Box::pin(y).as_mut().resume();
+    Box::pin(y).as_mut().resume(());
 }
 
 fn main() {
diff --git a/src/test/ui/generator/iterator-count.rs b/src/test/ui/generator/iterator-count.rs
index ac7e122dd58..90eefe02f66 100644
--- a/src/test/ui/generator/iterator-count.rs
+++ b/src/test/ui/generator/iterator-count.rs
@@ -10,18 +10,18 @@ struct W<T>(T);
 
 // This impl isn't safe in general, but the generator used in this test is movable
 // so it won't cause problems.
-impl<T: Generator<Return = ()> + Unpin> Iterator for W<T> {
+impl<T: Generator<(), Return = ()> + Unpin> Iterator for W<T> {
     type Item = T::Yield;
 
     fn next(&mut self) -> Option<Self::Item> {
-        match Pin::new(&mut self.0).resume() {
+        match Pin::new(&mut self.0).resume(()) {
             GeneratorState::Complete(..) => None,
             GeneratorState::Yielded(v) => Some(v),
         }
     }
 }
 
-fn test() -> impl Generator<Return=(), Yield=u8> + Unpin {
+fn test() -> impl Generator<(), Return=(), Yield=u8> + Unpin {
     || {
         for i in 1..6 {
             yield i
diff --git a/src/test/ui/generator/live-upvar-across-yield.rs b/src/test/ui/generator/live-upvar-across-yield.rs
index a1064165b2f..6a2e42a5573 100644
--- a/src/test/ui/generator/live-upvar-across-yield.rs
+++ b/src/test/ui/generator/live-upvar-across-yield.rs
@@ -10,5 +10,5 @@ fn main() {
     let mut a = || {
         b(yield);
     };
-    Pin::new(&mut a).resume();
+    Pin::new(&mut a).resume(());
 }
diff --git a/src/test/ui/generator/nested_generators.rs b/src/test/ui/generator/nested_generators.rs
index b56cce1dc44..45519150eec 100644
--- a/src/test/ui/generator/nested_generators.rs
+++ b/src/test/ui/generator/nested_generators.rs
@@ -11,7 +11,7 @@ fn main() {
             yield 2;
         };
 
-        match Pin::new(&mut sub_generator).resume() {
+        match Pin::new(&mut sub_generator).resume(()) {
             GeneratorState::Yielded(x) => {
                 yield x;
             }
diff --git a/src/test/ui/generator/no-parameters-on-generators.rs b/src/test/ui/generator/no-parameters-on-generators.rs
deleted file mode 100644
index 6b5a5579339..00000000000
--- a/src/test/ui/generator/no-parameters-on-generators.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![feature(generators)]
-
-fn main() {
-    let gen = |start| { //~ ERROR generators cannot have explicit parameters
-        //~^ ERROR type inside generator must be known in this context
-        yield;
-    };
-}
diff --git a/src/test/ui/generator/no-parameters-on-generators.stderr b/src/test/ui/generator/no-parameters-on-generators.stderr
deleted file mode 100644
index 5e8e043a391..00000000000
--- a/src/test/ui/generator/no-parameters-on-generators.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0628]: generators cannot have explicit parameters
-  --> $DIR/no-parameters-on-generators.rs:4:15
-   |
-LL |     let gen = |start| {
-   |               ^^^^^^^
-
-error[E0698]: type inside generator must be known in this context
-  --> $DIR/no-parameters-on-generators.rs:4:16
-   |
-LL |     let gen = |start| {
-   |                ^^^^^ cannot infer type
-   |
-note: the type is part of the generator because of this `yield`
-  --> $DIR/no-parameters-on-generators.rs:6:9
-   |
-LL |         yield;
-   |         ^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0698`.
diff --git a/src/test/ui/generator/panic-drops-resume.rs b/src/test/ui/generator/panic-drops-resume.rs
new file mode 100644
index 00000000000..29f4788b275
--- /dev/null
+++ b/src/test/ui/generator/panic-drops-resume.rs
@@ -0,0 +1,37 @@
+//! Tests that panics inside a generator will correctly drop the initial resume argument.
+
+// run-pass
+// ignore-wasm       no unwind support
+// ignore-emscripten no unwind support
+
+#![feature(generators, generator_trait)]
+
+use std::ops::Generator;
+use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::pin::Pin;
+use std::sync::atomic::{AtomicUsize, Ordering};
+
+static DROP: AtomicUsize = AtomicUsize::new(0);
+
+struct Dropper {}
+
+impl Drop for Dropper {
+    fn drop(&mut self) {
+        DROP.fetch_add(1, Ordering::SeqCst);
+    }
+}
+
+fn main() {
+    let mut gen = |_arg| {
+        if true {
+            panic!();
+        }
+        yield ();
+    };
+    let mut gen = Pin::new(&mut gen);
+
+    assert_eq!(DROP.load(Ordering::Acquire), 0);
+    let res = catch_unwind(AssertUnwindSafe(|| gen.as_mut().resume(Dropper {})));
+    assert!(res.is_err());
+    assert_eq!(DROP.load(Ordering::Acquire), 1);
+}
diff --git a/src/test/ui/generator/panic-drops.rs b/src/test/ui/generator/panic-drops.rs
index f88687858fd..c9a201725ae 100644
--- a/src/test/ui/generator/panic-drops.rs
+++ b/src/test/ui/generator/panic-drops.rs
@@ -35,7 +35,7 @@ fn main() {
 
     assert_eq!(A.load(Ordering::SeqCst), 0);
     let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
-        Pin::new(&mut foo).resume()
+        Pin::new(&mut foo).resume(())
     }));
     assert!(res.is_err());
     assert_eq!(A.load(Ordering::SeqCst), 1);
@@ -50,7 +50,7 @@ fn main() {
 
     assert_eq!(A.load(Ordering::SeqCst), 1);
     let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
-        Pin::new(&mut foo).resume()
+        Pin::new(&mut foo).resume(())
     }));
     assert!(res.is_err());
     assert_eq!(A.load(Ordering::SeqCst), 1);
diff --git a/src/test/ui/generator/panic-safe.rs b/src/test/ui/generator/panic-safe.rs
index 5f6778674dc..500a3c9c295 100644
--- a/src/test/ui/generator/panic-safe.rs
+++ b/src/test/ui/generator/panic-safe.rs
@@ -17,13 +17,13 @@ fn main() {
     };
 
     let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
-        Pin::new(&mut foo).resume()
+        Pin::new(&mut foo).resume(())
     }));
     assert!(res.is_err());
 
     for _ in 0..10 {
         let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
-            Pin::new(&mut foo).resume()
+            Pin::new(&mut foo).resume(())
         }));
         assert!(res.is_err());
     }
diff --git a/src/test/ui/generator/resume-after-return.rs b/src/test/ui/generator/resume-after-return.rs
index 71a68ff684a..efed08bd470 100644
--- a/src/test/ui/generator/resume-after-return.rs
+++ b/src/test/ui/generator/resume-after-return.rs
@@ -16,12 +16,12 @@ fn main() {
         yield;
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(()) => {}
         s => panic!("bad state: {:?}", s),
     }
 
-    match panic::catch_unwind(move || Pin::new(&mut foo).resume()) {
+    match panic::catch_unwind(move || Pin::new(&mut foo).resume(())) {
         Ok(_) => panic!("generator successfully resumed"),
         Err(_) => {}
     }
diff --git a/src/test/ui/generator/resume-arg-late-bound.rs b/src/test/ui/generator/resume-arg-late-bound.rs
new file mode 100644
index 00000000000..87b1f1a065b
--- /dev/null
+++ b/src/test/ui/generator/resume-arg-late-bound.rs
@@ -0,0 +1,17 @@
+//! Tests that we cannot produce a generator that accepts a resume argument
+//! with any lifetime and then stores it across a `yield`.
+
+#![feature(generators, generator_trait)]
+
+use std::ops::Generator;
+
+fn test(a: impl for<'a> Generator<&'a mut bool>) {}
+
+fn main() {
+    let gen = |arg: &mut bool| {
+        yield ();
+        *arg = true;
+    };
+    test(gen);
+    //~^ ERROR type mismatch in function arguments
+}
diff --git a/src/test/ui/generator/resume-arg-late-bound.stderr b/src/test/ui/generator/resume-arg-late-bound.stderr
new file mode 100644
index 00000000000..7719d5123f4
--- /dev/null
+++ b/src/test/ui/generator/resume-arg-late-bound.stderr
@@ -0,0 +1,15 @@
+error[E0631]: type mismatch in function arguments
+  --> $DIR/resume-arg-late-bound.rs:15:10
+   |
+LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
+   |    ----         ------------------------------- required by this bound in `test`
+...
+LL |     test(gen);
+   |          ^^^
+   |          |
+   |          expected signature of `for<'a> fn(&'a mut bool) -> _`
+   |          found signature of `fn(&mut bool) -> _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/generator/resume-live-across-yield.rs b/src/test/ui/generator/resume-live-across-yield.rs
new file mode 100644
index 00000000000..4c4cf117a55
--- /dev/null
+++ b/src/test/ui/generator/resume-live-across-yield.rs
@@ -0,0 +1,45 @@
+// run-pass
+
+#![feature(generators, generator_trait)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
+use std::sync::atomic::{AtomicUsize, Ordering};
+
+static DROP: AtomicUsize = AtomicUsize::new(0);
+
+#[derive(PartialEq, Eq, Debug)]
+struct Dropper(String);
+
+impl Drop for Dropper {
+    fn drop(&mut self) {
+        DROP.fetch_add(1, Ordering::SeqCst);
+    }
+}
+
+fn main() {
+    let mut g = |mut _d| {
+        _d = yield;
+        _d
+    };
+
+    let mut g = Pin::new(&mut g);
+
+    assert_eq!(
+        g.as_mut().resume(Dropper(String::from("Hello world!"))),
+        GeneratorState::Yielded(())
+    );
+    assert_eq!(DROP.load(Ordering::Acquire), 0);
+    match g.as_mut().resume(Dropper(String::from("Number Two"))) {
+        GeneratorState::Complete(dropper) => {
+            assert_eq!(DROP.load(Ordering::Acquire), 1);
+            assert_eq!(dropper.0, "Number Two");
+            drop(dropper);
+            assert_eq!(DROP.load(Ordering::Acquire), 2);
+        }
+        _ => unreachable!(),
+    }
+
+    drop(g);
+    assert_eq!(DROP.load(Ordering::Acquire), 2);
+}
diff --git a/src/test/ui/generator/retain-resume-ref.rs b/src/test/ui/generator/retain-resume-ref.rs
new file mode 100644
index 00000000000..0606ea71cdf
--- /dev/null
+++ b/src/test/ui/generator/retain-resume-ref.rs
@@ -0,0 +1,25 @@
+//! This test ensures that a mutable reference cannot be passed as a resume argument twice.
+
+#![feature(generators, generator_trait)]
+
+use std::marker::Unpin;
+use std::ops::{
+    Generator,
+    GeneratorState::{self, *},
+};
+use std::pin::Pin;
+
+fn main() {
+    let mut thing = String::from("hello");
+
+    let mut gen = |r| {
+        if false {
+            yield r;
+        }
+    };
+
+    let mut gen = Pin::new(&mut gen);
+    gen.as_mut().resume(&mut thing);
+    gen.as_mut().resume(&mut thing);
+    //~^ cannot borrow `thing` as mutable more than once at a time
+}
diff --git a/src/test/ui/generator/retain-resume-ref.stderr b/src/test/ui/generator/retain-resume-ref.stderr
new file mode 100644
index 00000000000..bc715c7030e
--- /dev/null
+++ b/src/test/ui/generator/retain-resume-ref.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `thing` as mutable more than once at a time
+  --> $DIR/retain-resume-ref.rs:23:25
+   |
+LL |     gen.as_mut().resume(&mut thing);
+   |                         ---------- first mutable borrow occurs here
+LL |     gen.as_mut().resume(&mut thing);
+   |                         ^^^^^^^^^^ second mutable borrow occurs here
+LL |
+LL | }
+   | - first borrow might be used here, when `gen` is dropped and runs the destructor for generator
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/generator/sized-yield.rs b/src/test/ui/generator/sized-yield.rs
index f64849b3149..c6dd738d6ac 100644
--- a/src/test/ui/generator/sized-yield.rs
+++ b/src/test/ui/generator/sized-yield.rs
@@ -9,6 +9,6 @@ fn main() {
    //~^ ERROR the size for values of type
        yield s[..];
    };
-   Pin::new(&mut gen).resume();
+   Pin::new(&mut gen).resume(());
    //~^ ERROR the size for values of type
 }
diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr
index c2caac7ebe2..79aeec2ec02 100644
--- a/src/test/ui/generator/sized-yield.stderr
+++ b/src/test/ui/generator/sized-yield.stderr
@@ -15,7 +15,7 @@ LL | |    };
 error[E0277]: the size for values of type `str` cannot be known at compilation time
   --> $DIR/sized-yield.rs:12:23
    |
-LL |    Pin::new(&mut gen).resume();
+LL |    Pin::new(&mut gen).resume(());
    |                       ^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `str`
diff --git a/src/test/ui/generator/smoke-resume-args.rs b/src/test/ui/generator/smoke-resume-args.rs
new file mode 100644
index 00000000000..32f3ee32d77
--- /dev/null
+++ b/src/test/ui/generator/smoke-resume-args.rs
@@ -0,0 +1,97 @@
+// run-pass
+
+#![feature(generators, generator_trait)]
+
+use std::fmt::Debug;
+use std::marker::Unpin;
+use std::ops::{
+    Generator,
+    GeneratorState::{self, *},
+};
+use std::pin::Pin;
+use std::sync::atomic::{AtomicUsize, Ordering};
+
+fn drain<G: Generator<R, Yield = Y> + Unpin, R, Y>(
+    gen: &mut G,
+    inout: Vec<(R, GeneratorState<Y, G::Return>)>,
+) where
+    Y: Debug + PartialEq,
+    G::Return: Debug + PartialEq,
+{
+    let mut gen = Pin::new(gen);
+
+    for (input, out) in inout {
+        assert_eq!(gen.as_mut().resume(input), out);
+    }
+}
+
+static DROPS: AtomicUsize = AtomicUsize::new(0);
+
+#[derive(Debug, PartialEq)]
+struct DropMe;
+
+impl Drop for DropMe {
+    fn drop(&mut self) {
+        DROPS.fetch_add(1, Ordering::SeqCst);
+    }
+}
+
+fn expect_drops<T>(expected_drops: usize, f: impl FnOnce() -> T) -> T {
+    DROPS.store(0, Ordering::SeqCst);
+
+    let res = f();
+
+    let actual_drops = DROPS.load(Ordering::SeqCst);
+    assert_eq!(actual_drops, expected_drops);
+    res
+}
+
+fn main() {
+    drain(
+        &mut |mut b| {
+            while b != 0 {
+                b = yield (b + 1);
+            }
+            -1
+        },
+        vec![(1, Yielded(2)), (-45, Yielded(-44)), (500, Yielded(501)), (0, Complete(-1))],
+    );
+
+    expect_drops(2, || drain(&mut |a| yield a, vec![(DropMe, Yielded(DropMe))]));
+
+    expect_drops(6, || {
+        drain(
+            &mut |a| yield yield a,
+            vec![(DropMe, Yielded(DropMe)), (DropMe, Yielded(DropMe)), (DropMe, Complete(DropMe))],
+        )
+    });
+
+    #[allow(unreachable_code)]
+    expect_drops(2, || drain(&mut |a| yield return a, vec![(DropMe, Complete(DropMe))]));
+
+    expect_drops(2, || {
+        drain(
+            &mut |a: DropMe| {
+                if false { yield () } else { a }
+            },
+            vec![(DropMe, Complete(DropMe))],
+        )
+    });
+
+    expect_drops(4, || {
+        drain(
+            #[allow(unused_assignments, unused_variables)]
+            &mut |mut a: DropMe| {
+                a = yield;
+                a = yield;
+                a = yield;
+            },
+            vec![
+                (DropMe, Yielded(())),
+                (DropMe, Yielded(())),
+                (DropMe, Yielded(())),
+                (DropMe, Complete(())),
+            ],
+        )
+    });
+}
diff --git a/src/test/ui/generator/smoke.rs b/src/test/ui/generator/smoke.rs
index 533f2399084..9289710b34b 100644
--- a/src/test/ui/generator/smoke.rs
+++ b/src/test/ui/generator/smoke.rs
@@ -17,7 +17,7 @@ fn simple() {
         }
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(()) => {}
         s => panic!("bad state: {:?}", s),
     }
@@ -33,7 +33,7 @@ fn return_capture() {
         a
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(ref s) if *s == "foo" => {}
         s => panic!("bad state: {:?}", s),
     }
@@ -45,11 +45,11 @@ fn simple_yield() {
         yield;
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Yielded(()) => {}
         s => panic!("bad state: {:?}", s),
     }
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(()) => {}
         s => panic!("bad state: {:?}", s),
     }
@@ -62,11 +62,11 @@ fn yield_capture() {
         yield b;
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Yielded(ref s) if *s == "foo" => {}
         s => panic!("bad state: {:?}", s),
     }
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(()) => {}
         s => panic!("bad state: {:?}", s),
     }
@@ -79,11 +79,11 @@ fn simple_yield_value() {
         return String::from("foo")
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Yielded(ref s) if *s == "bar" => {}
         s => panic!("bad state: {:?}", s),
     }
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(ref s) if *s == "foo" => {}
         s => panic!("bad state: {:?}", s),
     }
@@ -97,11 +97,11 @@ fn return_after_yield() {
         return a
     };
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Yielded(()) => {}
         s => panic!("bad state: {:?}", s),
     }
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(ref s) if *s == "foo" => {}
         s => panic!("bad state: {:?}", s),
     }
@@ -149,11 +149,11 @@ fn send_and_sync() {
 fn send_over_threads() {
     let mut foo = || { yield };
     thread::spawn(move || {
-        match Pin::new(&mut foo).resume() {
+        match Pin::new(&mut foo).resume(()) {
             GeneratorState::Yielded(()) => {}
             s => panic!("bad state: {:?}", s),
         }
-        match Pin::new(&mut foo).resume() {
+        match Pin::new(&mut foo).resume(()) {
             GeneratorState::Complete(()) => {}
             s => panic!("bad state: {:?}", s),
         }
@@ -162,11 +162,11 @@ fn send_over_threads() {
     let a = String::from("a");
     let mut foo = || { yield a };
     thread::spawn(move || {
-        match Pin::new(&mut foo).resume() {
+        match Pin::new(&mut foo).resume(()) {
             GeneratorState::Yielded(ref s) if *s == "a" => {}
             s => panic!("bad state: {:?}", s),
         }
-        match Pin::new(&mut foo).resume() {
+        match Pin::new(&mut foo).resume(()) {
             GeneratorState::Complete(()) => {}
             s => panic!("bad state: {:?}", s),
         }
diff --git a/src/test/ui/generator/static-generators.rs b/src/test/ui/generator/static-generators.rs
index 965d3c61c22..3980766c428 100644
--- a/src/test/ui/generator/static-generators.rs
+++ b/src/test/ui/generator/static-generators.rs
@@ -15,6 +15,6 @@ fn main() {
     // Safety: We shadow the original generator variable so have no safe API to
     // move it after this point.
     let mut generator = unsafe { Pin::new_unchecked(&mut generator) };
-    assert_eq!(generator.as_mut().resume(), GeneratorState::Yielded(()));
-    assert_eq!(generator.as_mut().resume(), GeneratorState::Complete(()));
+    assert_eq!(generator.as_mut().resume(()), GeneratorState::Yielded(()));
+    assert_eq!(generator.as_mut().resume(()), GeneratorState::Complete(()));
 }
diff --git a/src/test/ui/generator/too-many-parameters.rs b/src/test/ui/generator/too-many-parameters.rs
new file mode 100644
index 00000000000..7a353ea298b
--- /dev/null
+++ b/src/test/ui/generator/too-many-parameters.rs
@@ -0,0 +1,8 @@
+#![feature(generators)]
+
+fn main() {
+    |(), ()| {
+        //~^ error: too many parameters for a generator
+        yield;
+    };
+}
diff --git a/src/test/ui/generator/too-many-parameters.stderr b/src/test/ui/generator/too-many-parameters.stderr
new file mode 100644
index 00000000000..a297ee43de9
--- /dev/null
+++ b/src/test/ui/generator/too-many-parameters.stderr
@@ -0,0 +1,8 @@
+error[E0628]: too many parameters for a generator (expected 0 or 1 parameters)
+  --> $DIR/too-many-parameters.rs:4:5
+   |
+LL |     |(), ()| {
+   |     ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/generator/type-mismatch-error.rs b/src/test/ui/generator/type-mismatch-error.rs
new file mode 100644
index 00000000000..d39c788a84b
--- /dev/null
+++ b/src/test/ui/generator/type-mismatch-error.rs
@@ -0,0 +1,22 @@
+//! Test that we get the expected type mismatch error instead of "closure is expected to take 0
+//! arguments" (which got introduced after implementing resume arguments).
+
+#![feature(generators, generator_trait)]
+
+use std::ops::Generator;
+
+fn f<G: Generator>(_: G, _: G::Return) {}
+
+fn main() {
+    f(
+        |a: u8| {
+            if false {
+                yield ();
+            } else {
+                a
+                //~^ error: `if` and `else` have incompatible types
+            }
+        },
+        0u8,
+    );
+}
diff --git a/src/test/ui/generator/type-mismatch-error.stderr b/src/test/ui/generator/type-mismatch-error.stderr
new file mode 100644
index 00000000000..8f5949533e2
--- /dev/null
+++ b/src/test/ui/generator/type-mismatch-error.stderr
@@ -0,0 +1,19 @@
+error[E0308]: `if` and `else` have incompatible types
+  --> $DIR/type-mismatch-error.rs:16:17
+   |
+LL | /             if false {
+LL | |                 yield ();
+   | |                 ---------
+   | |                 |       |
+   | |                 |       help: consider removing this semicolon
+   | |                 expected because of this
+LL | |             } else {
+LL | |                 a
+   | |                 ^ expected `()`, found `u8`
+LL | |
+LL | |             }
+   | |_____________- `if` and `else` have incompatible types
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.rs b/src/test/ui/generator/type-mismatch-signature-deduction.rs
index b9c6bc5d079..7774ff48f56 100644
--- a/src/test/ui/generator/type-mismatch-signature-deduction.rs
+++ b/src/test/ui/generator/type-mismatch-signature-deduction.rs
@@ -2,15 +2,15 @@
 
 use std::ops::Generator;
 
-fn foo() -> impl Generator<Return = i32> {
+fn foo() -> impl Generator<Return = i32> { //~ ERROR type mismatch
     || {
         if false {
-            return Ok(6); //~ ERROR mismatched types [E0308]
+            return Ok(6);
         }
 
         yield ();
 
-        5
+        5 //~ ERROR mismatched types [E0308]
     }
 }
 
diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.stderr b/src/test/ui/generator/type-mismatch-signature-deduction.stderr
index 8606ecd33da..8de77798ff4 100644
--- a/src/test/ui/generator/type-mismatch-signature-deduction.stderr
+++ b/src/test/ui/generator/type-mismatch-signature-deduction.stderr
@@ -1,12 +1,23 @@
 error[E0308]: mismatched types
-  --> $DIR/type-mismatch-signature-deduction.rs:8:20
+  --> $DIR/type-mismatch-signature-deduction.rs:13:9
    |
-LL |             return Ok(6);
-   |                    ^^^^^ expected `i32`, found enum `std::result::Result`
+LL |         5
+   |         ^ expected enum `std::result::Result`, found integer
    |
-   = note: expected type `i32`
-              found enum `std::result::Result<{integer}, _>`
+   = note: expected type `std::result::Result<{integer}, _>`
+              found type `{integer}`
 
-error: aborting due to previous error
+error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:6:5: 14:6 _] as std::ops::Generator>::Return == i32`
+  --> $DIR/type-mismatch-signature-deduction.rs:5:13
+   |
+LL | fn foo() -> impl Generator<Return = i32> {
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `i32`
+   |
+   = note: expected enum `std::result::Result<{integer}, _>`
+              found type `i32`
+   = note: the return type of a function must have a statically known size
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0308`.
+Some errors have detailed explanations: E0271, E0308.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/generator/xcrate-reachable.rs b/src/test/ui/generator/xcrate-reachable.rs
index 9483ad7395e..1b1cff3387d 100644
--- a/src/test/ui/generator/xcrate-reachable.rs
+++ b/src/test/ui/generator/xcrate-reachable.rs
@@ -10,5 +10,5 @@ use std::ops::Generator;
 use std::pin::Pin;
 
 fn main() {
-    Pin::new(&mut foo::foo()).resume();
+    Pin::new(&mut foo::foo()).resume(());
 }
diff --git a/src/test/ui/generator/xcrate.rs b/src/test/ui/generator/xcrate.rs
index febf5c3583f..40986bbeb65 100644
--- a/src/test/ui/generator/xcrate.rs
+++ b/src/test/ui/generator/xcrate.rs
@@ -12,18 +12,18 @@ use std::pin::Pin;
 fn main() {
     let mut foo = xcrate::foo();
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(()) => {}
         s => panic!("bad state: {:?}", s),
     }
 
     let mut foo = xcrate::bar(3);
 
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Yielded(3) => {}
         s => panic!("bad state: {:?}", s),
     }
-    match Pin::new(&mut foo).resume() {
+    match Pin::new(&mut foo).resume(()) {
         GeneratorState::Complete(()) => {}
         s => panic!("bad state: {:?}", s),
     }
diff --git a/src/test/ui/generator/yield-while-iterating.rs b/src/test/ui/generator/yield-while-iterating.rs
index e42781d1279..985e5d8bdc8 100644
--- a/src/test/ui/generator/yield-while-iterating.rs
+++ b/src/test/ui/generator/yield-while-iterating.rs
@@ -43,7 +43,7 @@ fn yield_during_iter_borrowed_slice_3() {
             yield p;
         }
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn yield_during_iter_borrowed_slice_4() {
@@ -56,7 +56,7 @@ fn yield_during_iter_borrowed_slice_4() {
         }
     };
     println!("{}", x[0]); //~ ERROR
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn yield_during_range_iter() {
@@ -69,7 +69,7 @@ fn yield_during_range_iter() {
             yield x;
         }
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn main() { }
diff --git a/src/test/ui/generator/yield-while-iterating.stderr b/src/test/ui/generator/yield-while-iterating.stderr
index 6a96b25b19f..b6563475235 100644
--- a/src/test/ui/generator/yield-while-iterating.stderr
+++ b/src/test/ui/generator/yield-while-iterating.stderr
@@ -16,7 +16,7 @@ LL |         for p in &mut x {
 ...
 LL |     println!("{}", x[0]);
    |                    ^ immutable borrow occurs here
-LL |     Pin::new(&mut b).resume();
+LL |     Pin::new(&mut b).resume(());
    |              ------ mutable borrow later used here
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/generator/yield-while-local-borrowed.rs b/src/test/ui/generator/yield-while-local-borrowed.rs
index b643bbf3376..061a64dbc36 100644
--- a/src/test/ui/generator/yield-while-local-borrowed.rs
+++ b/src/test/ui/generator/yield-while-local-borrowed.rs
@@ -15,7 +15,7 @@ fn borrow_local_inline() {
         yield();
         println!("{}", a);
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn borrow_local_inline_done() {
@@ -26,7 +26,7 @@ fn borrow_local_inline_done() {
         }
         yield();
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn borrow_local() {
@@ -43,7 +43,7 @@ fn borrow_local() {
             println!("{}", b);
         }
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn main() { }
diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.rs b/src/test/ui/generator/yield-while-ref-reborrowed.rs
index f54a4f468f6..a03ef945dd2 100644
--- a/src/test/ui/generator/yield-while-ref-reborrowed.rs
+++ b/src/test/ui/generator/yield-while-ref-reborrowed.rs
@@ -12,7 +12,7 @@ fn reborrow_shared_ref(x: &i32) {
         yield();
         println!("{}", a);
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn reborrow_mutable_ref(x: &mut i32) {
@@ -23,7 +23,7 @@ fn reborrow_mutable_ref(x: &mut i32) {
         yield();
         println!("{}", a);
     };
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn reborrow_mutable_ref_2(x: &mut i32) {
@@ -34,7 +34,7 @@ fn reborrow_mutable_ref_2(x: &mut i32) {
         println!("{}", a);
     };
     println!("{}", x); //~ ERROR
-    Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume(());
 }
 
 fn main() { }
diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.stderr
index 4c37cd35173..fd885660d09 100644
--- a/src/test/ui/generator/yield-while-ref-reborrowed.stderr
+++ b/src/test/ui/generator/yield-while-ref-reborrowed.stderr
@@ -8,7 +8,7 @@ LL |         let a = &mut *x;
 ...
 LL |     println!("{}", x);
    |                    ^ second borrow occurs here
-LL |     Pin::new(&mut b).resume();
+LL |     Pin::new(&mut b).resume(());
    |              ------ first borrow later used here
 
 error: aborting due to previous error
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
index ba2e7ea8b53..3a9c918cd37 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
@@ -30,6 +30,8 @@ LL |             let ...$e;
 ...
 LL |     mac!(0);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr
index 2bdb8ea5766..871c9b57e54 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr
@@ -40,6 +40,7 @@ LL |     mac!(0);
    |     -------- in this macro invocation
    |
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0586]: inclusive range with no end
   --> $DIR/half-open-range-pats-inclusive-no-end.rs:21:19
@@ -51,6 +52,7 @@ LL |     mac!(0);
    |     -------- in this macro invocation
    |
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
index c8521a54e6c..b91798fa123 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
@@ -10,6 +10,7 @@ LL | |                                             for<'a>    fn(&'a u32, &'a u3
    |
    = note: expected enum `std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32>`
               found enum `std::option::Option<for<'a> fn(&'a u32, &'a u32) -> &'a u32>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
index 3ad802c5450..45f53d4fe99 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
@@ -10,6 +10,7 @@ LL | |                                 for<'a>    fn(&'a u32, &'a u32)) }
    |
    = note: expected enum `std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32)>`
               found enum `std::option::Option<for<'a> fn(&'a u32, &'a u32)>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
index 3d09633367c..c3e4f6d2ed0 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
@@ -10,6 +10,7 @@ LL | |                              fn(&'x u32)) }
    |
    = note: expected enum `std::option::Option<for<'a> fn(&'a u32)>`
               found enum `std::option::Option<fn(&'x u32)>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
index 8b623a4c0be..4d7b86027f5 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
@@ -10,6 +10,7 @@ LL | |                                       for<'a>    fn(Co<'a>, Co<'a>)) }
    |
    = note: expected enum `std::option::Option<for<'a, 'b> fn(Co<'a>, Co<'b>)>`
               found enum `std::option::Option<for<'a> fn(Co<'a>, Co<'a>)>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
index f12bff69691..7f0a4197dd7 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
@@ -10,6 +10,7 @@ LL | |                                         for<'a>    fn(Co<'a>, Co<'a>) ->
    |
    = note: expected enum `std::option::Option<for<'a, 'b> fn(Co<'a>, Co<'b>) -> Contra<'a>>`
               found enum `std::option::Option<for<'a> fn(Co<'a>, Co<'a>) -> Contra<'a>>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
index 37ba44cf2e9..c12e543a44e 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
@@ -10,6 +10,7 @@ LL | |                                             for<'a>    fn(Contra<'a>, Con
    |
    = note: expected enum `std::option::Option<for<'a, 'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>>`
               found enum `std::option::Option<for<'a> fn(Contra<'a>, Contra<'a>) -> Co<'a>>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
index a00bbea6d18..460356856bd 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
@@ -10,6 +10,7 @@ LL | |                                         for<'a>    fn(Inv<'a>, Inv<'a>))
    |
    = note: expected enum `std::option::Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>`
               found enum `std::option::Option<for<'a> fn(Inv<'a>, Inv<'a>)>`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
index 9b0c987c054..6b5e7a5a634 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
@@ -13,6 +13,7 @@ LL | |                                     fn(Inv<'y>)) }
    | |__________________________________________________- in this macro invocation
    |
    = help: consider adding the following bound: `'x: 'y`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: lifetime may not live long enough
   --> $DIR/hr-subtype.rs:39:13
@@ -29,6 +30,7 @@ LL | |                                     fn(Inv<'y>)) }
    | |__________________________________________________- in this macro invocation
    |
    = help: consider adding the following bound: `'x: 'y`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
index 561f3519176..fc3643306e6 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
@@ -28,6 +28,7 @@ LL |           fn subtype<'x,'y:'x,'z:'y>() {
 LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
 LL | |                                     fn(Inv<'y>)) }
    | |__________________________________________________- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/hr-subtype.rs:39:26
@@ -59,6 +60,7 @@ LL |           fn supertype<'x,'y:'x,'z:'y>() {
 LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
 LL | |                                     fn(Inv<'y>)) }
    | |__________________________________________________- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
index 48558fad005..7c0770924da 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
@@ -13,6 +13,7 @@ LL | |                             fn(&'y u32)) }
    | |__________________________________________- in this macro invocation
    |
    = help: consider adding the following bound: `'x: 'y`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
index 082627050b3..0dde27788f6 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
@@ -28,6 +28,7 @@ LL |           fn supertype<'x,'y:'x,'z:'y>() {
 LL | / check! { free_x_vs_free_y: (fn(&'x u32),
 LL | |                             fn(&'y u32)) }
    | |__________________________________________- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/assoc_item_ctxt.stderr b/src/test/ui/hygiene/assoc_item_ctxt.stderr
index 0d1c73eef0e..dec1bd62ca9 100644
--- a/src/test/ui/hygiene/assoc_item_ctxt.stderr
+++ b/src/test/ui/hygiene/assoc_item_ctxt.stderr
@@ -6,6 +6,8 @@ LL |             fn method() {}
 ...
 LL |     mac_trait_impl!();
    |     ------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0046]: not all trait items implemented, missing: `method`
   --> $DIR/assoc_item_ctxt.rs:34:9
@@ -18,6 +20,8 @@ LL |         impl Tr for u8 {
 ...
 LL |     mac_trait_impl!();
    |     ------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/hygiene/duplicate_lifetimes.stderr b/src/test/ui/hygiene/duplicate_lifetimes.stderr
index 7aaea6ff24e..04f5bed5e05 100644
--- a/src/test/ui/hygiene/duplicate_lifetimes.stderr
+++ b/src/test/ui/hygiene/duplicate_lifetimes.stderr
@@ -9,6 +9,8 @@ LL | m!('a);
    | |  |
    | |  previous declaration here
    | in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0263]: lifetime name `'a` declared twice in the same scope
   --> $DIR/duplicate_lifetimes.rs:13:14
@@ -21,6 +23,8 @@ LL | n!('a);
    | |  |
    | |  previous declaration here
    | in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/hygiene/extern-prelude-from-opaque-fail.stderr b/src/test/ui/hygiene/extern-prelude-from-opaque-fail.stderr
index 65133eb1e18..b9e05c84a8a 100644
--- a/src/test/ui/hygiene/extern-prelude-from-opaque-fail.stderr
+++ b/src/test/ui/hygiene/extern-prelude-from-opaque-fail.stderr
@@ -15,6 +15,8 @@ LL |         use my_core;
 ...
 LL | a!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0433]: failed to resolve: use of undeclared type or module `my_core`
   --> $DIR/extern-prelude-from-opaque-fail.rs:11:18
@@ -24,6 +26,8 @@ LL |         fn f() { my_core::mem::drop(0); }
 ...
 LL | a!();
    | ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0433]: failed to resolve: use of undeclared type or module `my_core`
   --> $DIR/extern-prelude-from-opaque-fail.rs:24:14
diff --git a/src/test/ui/hygiene/fields-definition.stderr b/src/test/ui/hygiene/fields-definition.stderr
index a30650d88e2..8070ffdfdeb 100644
--- a/src/test/ui/hygiene/fields-definition.stderr
+++ b/src/test/ui/hygiene/fields-definition.stderr
@@ -8,6 +8,8 @@ LL |             $a: u8,
 ...
 LL | legacy!(a);
    | ----------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/fields-move.stderr b/src/test/ui/hygiene/fields-move.stderr
index 562f60e31b5..5ce786dce83 100644
--- a/src/test/ui/hygiene/fields-move.stderr
+++ b/src/test/ui/hygiene/fields-move.stderr
@@ -10,6 +10,7 @@ LL |     assert_two_copies(copy_legacy!(foo), foo.x);
    |                       ----------------- in this macro invocation
    |
    = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0382]: use of moved value: `foo.x`
   --> $DIR/fields-move.rs:28:42
diff --git a/src/test/ui/hygiene/fields.stderr b/src/test/ui/hygiene/fields.stderr
index 20ea4e91067..89deef49202 100644
--- a/src/test/ui/hygiene/fields.stderr
+++ b/src/test/ui/hygiene/fields.stderr
@@ -6,6 +6,8 @@ LL |         let s = S { x: 0 };
 ...
 LL |     let s = foo::m!(S, x);
    |             ------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `foo::S` is private
   --> $DIR/fields.rs:16:17
@@ -15,6 +17,8 @@ LL |         let _ = s.x;
 ...
 LL |     let s = foo::m!(S, x);
    |             ------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `foo::T` is private
   --> $DIR/fields.rs:18:17
@@ -24,6 +28,8 @@ LL |         let t = T(0);
 ...
 LL |     let s = foo::m!(S, x);
    |             ------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `foo::T` is private
   --> $DIR/fields.rs:19:17
@@ -33,6 +39,8 @@ LL |         let _ = t.0;
 ...
 LL |     let s = foo::m!(S, x);
    |             ------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/hygiene/generate-mod.stderr b/src/test/ui/hygiene/generate-mod.stderr
index 5e2c56d4bf4..073e1527b2e 100644
--- a/src/test/ui/hygiene/generate-mod.stderr
+++ b/src/test/ui/hygiene/generate-mod.stderr
@@ -18,6 +18,8 @@ LL |         type A = FromOutside;
 ...
 LL |     genmod_transparent!();
    |     ---------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `Outer` in this scope
   --> $DIR/generate-mod.rs:20:22
@@ -27,6 +29,8 @@ LL |         type Inner = Outer;
 ...
 LL |     genmod_transparent!();
    |     ---------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `FromOutside` in this scope
   --> $DIR/generate-mod.rs:28:18
@@ -36,6 +40,8 @@ LL |         type A = FromOutside;
 ...
 LL |     genmod_legacy!();
    |     ----------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `Outer` in this scope
   --> $DIR/generate-mod.rs:29:22
@@ -45,6 +51,8 @@ LL |         type Inner = Outer;
 ...
 LL |     genmod_legacy!();
    |     ----------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr
index f9fbf295aec..153ad8cbecf 100644
--- a/src/test/ui/hygiene/globs.stderr
+++ b/src/test/ui/hygiene/globs.stderr
@@ -22,6 +22,7 @@ LL | |         f();
 LL | |     }
    | |_____- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: possible candidates are found in other modules, you can import them into scope
    |
 LL | use bar::g;
@@ -42,6 +43,7 @@ LL |         n!(f);
    |
    = note: possible candidate is found in another module, you can import it into scope:
            foo::f
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find function `f` in this scope
   --> $DIR/globs.rs:65:17
@@ -54,6 +56,7 @@ LL |                 f
    |
    = note: possible candidate is found in another module, you can import it into scope:
            foo::f
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/hygiene/hygienic-label-1.stderr b/src/test/ui/hygiene/hygienic-label-1.stderr
index d61c0687c16..60df494e131 100644
--- a/src/test/ui/hygiene/hygienic-label-1.stderr
+++ b/src/test/ui/hygiene/hygienic-label-1.stderr
@@ -6,6 +6,8 @@ LL |     () => { break 'x; }
 ...
 LL |     'x: loop { foo!() }
    |                ------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/hygienic-label-3.stderr b/src/test/ui/hygiene/hygienic-label-3.stderr
index 0c4173a61aa..dbec71fcaa4 100644
--- a/src/test/ui/hygiene/hygienic-label-3.stderr
+++ b/src/test/ui/hygiene/hygienic-label-3.stderr
@@ -6,6 +6,8 @@ LL |     () => { break 'x; }
 ...
 LL |         foo!()
    |         ------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr
index 4acb34f2dce..7c82a08753a 100644
--- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr
+++ b/src/test/ui/hygiene/hygienic-labels-in-let.stderr
@@ -9,6 +9,8 @@ LL |         'x: loop {
 LL |             // this 'x should refer to the outer loop, lexically
 LL |             loop_x!(break 'x);
    |             ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:64:9
@@ -39,6 +41,8 @@ LL |         'x: loop {
 ...
 LL |             loop_x!(break 'x);
    |             ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:16:9
@@ -51,6 +55,8 @@ LL |         'x: loop { $e }
 ...
 LL |             loop_x!(break 'x);
    |             ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:16:9
@@ -63,6 +69,8 @@ LL |         'x: for _ in 0..1 {
 ...
 LL |             loop_x!(break 'x);
    |             ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:76:9
@@ -111,6 +119,8 @@ LL |         'x: loop {
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
@@ -123,6 +133,8 @@ LL |         'x: while 1 + 1 == 2 { $e }
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
@@ -135,6 +147,8 @@ LL |         'x: for _ in 0..1 {
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
@@ -147,6 +161,8 @@ LL |         'x: while 1 + 1 == 2 { $e }
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:27:9
@@ -159,6 +175,8 @@ LL |         'x: for _ in 0..1 {
 ...
 LL |             while_true!(break 'x);
    |             ---------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:90:9
@@ -225,6 +243,8 @@ LL |         'x: loop {
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
@@ -237,6 +257,8 @@ LL |         'x: for _ in 0..1 { $e }
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
@@ -249,6 +271,8 @@ LL |         'x: for _ in 0..1 {
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
@@ -261,6 +285,8 @@ LL |         'x: for _ in 0..1 { $e }
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
@@ -273,6 +299,8 @@ LL |         'x: for _ in 0..1 {
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
@@ -285,6 +313,8 @@ LL |         'x: for _ in 0..1 { $e }
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels-in-let.rs:39:9
@@ -297,4 +327,6 @@ LL |         'x: for _ in 0..1 {
 ...
 LL |             run_once!(continue 'x);
    |             ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr
index 0833825940a..960da15ef3c 100644
--- a/src/test/ui/hygiene/hygienic-labels.stderr
+++ b/src/test/ui/hygiene/hygienic-labels.stderr
@@ -9,6 +9,8 @@ LL |     'x: for _ in 0..1 {
 LL |         // this 'x should refer to the outer loop, lexically
 LL |         loop_x!(break 'x);
    |         ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:54:5
@@ -39,6 +41,8 @@ LL |     'x: for _ in 0..1 {
 ...
 LL |         loop_x!(break 'x);
    |         ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:13:9
@@ -51,6 +55,8 @@ LL |         'x: loop { $e }
 ...
 LL |         loop_x!(break 'x);
    |         ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:13:9
@@ -63,6 +69,8 @@ LL |     'x: loop {
 ...
 LL |         loop_x!(break 'x);
    |         ------------------ in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:63:5
@@ -111,6 +119,8 @@ LL |     'x: for _ in 0..1 {
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
@@ -123,6 +133,8 @@ LL |         'x: while 1 + 1 == 2 { $e }
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
@@ -135,6 +147,8 @@ LL |     'x: loop {
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
@@ -147,6 +161,8 @@ LL |         'x: while 1 + 1 == 2 { $e }
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:38:9
@@ -159,6 +175,8 @@ LL |     'x: while 1 + 1 == 2 {
 ...
 LL |         while_x!(break 'x);
    |         ------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:73:5
@@ -225,6 +243,8 @@ LL |     'x: for _ in 0..1 {
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
@@ -237,6 +257,8 @@ LL |         'x: for _ in 0..1 { $e }
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
@@ -249,6 +271,8 @@ LL |     'x: loop {
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
@@ -261,6 +285,8 @@ LL |         'x: for _ in 0..1 { $e }
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
@@ -273,6 +299,8 @@ LL |     'x: while 1 + 1 == 2 {
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
@@ -285,6 +313,8 @@ LL |         'x: while 1 + 1 == 2 { $e }
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: label name `'x` shadows a label name that is already in scope
   --> $DIR/hygienic-labels.rs:24:9
@@ -297,4 +327,6 @@ LL |     'x: for _ in 0..1 {
 ...
 LL |         run_once!(continue 'x);
    |         ----------------------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/hygiene/impl_items.stderr b/src/test/ui/hygiene/impl_items.stderr
index 418c2c73ba1..85ee9f4cbf3 100644
--- a/src/test/ui/hygiene/impl_items.stderr
+++ b/src/test/ui/hygiene/impl_items.stderr
@@ -6,6 +6,8 @@ LL |         let _: () = S.f();
 ...
 LL |     foo::m!();
    |     ---------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/intercrate.stderr b/src/test/ui/hygiene/intercrate.stderr
index 30a5570b2ad..3912ca337fb 100644
--- a/src/test/ui/hygiene/intercrate.stderr
+++ b/src/test/ui/hygiene/intercrate.stderr
@@ -4,7 +4,7 @@ error: type `fn() -> u32 {intercrate::foo::bar::f}` is private
 LL |     assert_eq!(intercrate::foo::m!(), 1);
    |                ^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr
index 5d75f5034bc..986671c7810 100644
--- a/src/test/ui/hygiene/no_implicit_prelude.stderr
+++ b/src/test/ui/hygiene/no_implicit_prelude.stderr
@@ -4,7 +4,7 @@ error: cannot find macro `panic` in this scope
 LL |         assert_eq!(0, 0);
    |         ^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0433]: failed to resolve: use of undeclared type or module `Vec`
   --> $DIR/no_implicit_prelude.rs:11:9
@@ -14,6 +14,8 @@ LL |     fn f() { ::bar::m!(); }
 ...
 LL |         Vec::new();
    |         ^^^ use of undeclared type or module `Vec`
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0599]: no method named `clone` found for unit type `()` in the current scope
   --> $DIR/no_implicit_prelude.rs:12:12
@@ -27,6 +29,7 @@ LL |         ().clone()
    = help: items from traits can only be used if the trait is in scope
    = note: the following trait is implemented but not in scope; perhaps add a `use` for it:
            `use std::clone::Clone;`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/hygiene/privacy-early.stderr b/src/test/ui/hygiene/privacy-early.stderr
index 60e50e05fc3..afc94bf79f6 100644
--- a/src/test/ui/hygiene/privacy-early.stderr
+++ b/src/test/ui/hygiene/privacy-early.stderr
@@ -15,6 +15,7 @@ LL |         use f as g;
 ...
 LL |     foo::m!();
    |     ---------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/hygiene/trait_items.stderr b/src/test/ui/hygiene/trait_items.stderr
index 8e3609292a7..d24336883e9 100644
--- a/src/test/ui/hygiene/trait_items.stderr
+++ b/src/test/ui/hygiene/trait_items.stderr
@@ -10,6 +10,7 @@ LL |     pub macro m() { ().f() }
    = help: items from traits can only be used if the trait is in scope
    = note: the following trait is implemented but not in scope; perhaps add a `use` for it:
            `use foo::T;`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/if/if-let.stderr b/src/test/ui/if/if-let.stderr
index 570a64e999c..ad4aefb6e58 100644
--- a/src/test/ui/if/if-let.stderr
+++ b/src/test/ui/if/if-let.stderr
@@ -10,6 +10,7 @@ LL | |     });
    | |_______- in this macro invocation
    |
    = note: `#[warn(irrefutable_let_patterns)]` on by default
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: irrefutable if-let pattern
   --> $DIR/if-let.rs:6:13
@@ -21,6 +22,8 @@ LL | /     bar!(a, 1, {
 LL | |         println!("irrefutable pattern");
 LL | |     });
    | |_______- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: irrefutable if-let pattern
   --> $DIR/if-let.rs:26:5
diff --git a/src/test/ui/if/ifmt-bad-arg.stderr b/src/test/ui/if/ifmt-bad-arg.stderr
index c024094dd56..3e5f5a63742 100644
--- a/src/test/ui/if/ifmt-bad-arg.stderr
+++ b/src/test/ui/if/ifmt-bad-arg.stderr
@@ -300,6 +300,7 @@ LL |     println!("{} {:.*} {}", 1, 3.2, 4);
    |
    = note: expected reference `&usize`
               found reference `&{float}`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/ifmt-bad-arg.rs:81:35
@@ -309,6 +310,7 @@ LL |     println!("{} {:07$.*} {}", 1, 3.2, 4);
    |
    = note: expected reference `&usize`
               found reference `&{float}`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 36 previous errors
 
diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/if/ifmt-bad-format-args.stderr
index 23252b6b5f4..8bb0d40629f 100644
--- a/src/test/ui/if/ifmt-bad-format-args.stderr
+++ b/src/test/ui/if/ifmt-bad-format-args.stderr
@@ -3,6 +3,8 @@ error: requires at least a format string argument
    |
 LL |     format_args!();
    |     ^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: format argument must be a string literal
   --> $DIR/ifmt-bad-format-args.rs:3:18
diff --git a/src/test/ui/if/ifmt-unimpl.stderr b/src/test/ui/if/ifmt-unimpl.stderr
index 7a7e4b34d25..a142896ada5 100644
--- a/src/test/ui/if/ifmt-unimpl.stderr
+++ b/src/test/ui/if/ifmt-unimpl.stderr
@@ -6,6 +6,7 @@ LL |     format!("{:X}", "3");
    |
    = note: required because of the requirements on the impl of `std::fmt::UpperHex` for `&str`
    = note: required by `std::fmt::UpperHex::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr b/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr
index e067432b392..f7544306d34 100644
--- a/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr
+++ b/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr
@@ -6,6 +6,8 @@ LL |         extern crate std as non_existent;
 ...
 LL | define_std_as_non_existent!();
    | ------------------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0433]: failed to resolve: use of undeclared type or module `two_macros`
   --> $DIR/extern-prelude-extern-crate-fail.rs:10:9
diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr
index 245013a4ea4..e344d059147 100644
--- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr
+++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr
@@ -6,6 +6,8 @@ LL |         extern crate std as core;
 ...
 LL | define_other_core!();
    | --------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:17:9
@@ -26,6 +28,7 @@ note: `Vec` could also refer to the struct defined here
    |
 LL | pub use crate::vec::Vec;
    |         ^^^^^^^^^^^^^^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/imports/import-crate-var.stderr b/src/test/ui/imports/import-crate-var.stderr
index 85f15ad4648..6bc2d15b2ff 100644
--- a/src/test/ui/imports/import-crate-var.stderr
+++ b/src/test/ui/imports/import-crate-var.stderr
@@ -4,7 +4,7 @@ error: `$crate` may not be imported
 LL |     m!();
    |     ^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/imports/import-prefix-macro-1.stderr b/src/test/ui/imports/import-prefix-macro-1.stderr
index 6c12a366b71..2ecc519e718 100644
--- a/src/test/ui/imports/import-prefix-macro-1.stderr
+++ b/src/test/ui/imports/import-prefix-macro-1.stderr
@@ -6,6 +6,8 @@ LL |     ($p: path) => (use $p {S, Z});
 ...
 LL | import! { a::b::c }
    | ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/imports/import-prefix-macro-2.stderr b/src/test/ui/imports/import-prefix-macro-2.stderr
index 8428dce2728..80317a34944 100644
--- a/src/test/ui/imports/import-prefix-macro-2.stderr
+++ b/src/test/ui/imports/import-prefix-macro-2.stderr
@@ -6,6 +6,8 @@ LL |     ($p: path) => (use ::$p {S, Z});
 ...
 LL | import! { a::b::c }
    | ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr
index c9498fed6a5..ea720c8b873 100644
--- a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr
+++ b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr
@@ -20,6 +20,7 @@ note: `exported` could also refer to the macro imported here
 LL | use inner1::*;
    |     ^^^^^^^^^
    = help: consider adding an explicit import of `exported` to disambiguate
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `exported` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution)
   --> $DIR/local-modularized-tricky-fail-1.rs:28:1
@@ -43,6 +44,7 @@ note: `exported` could also refer to the macro imported here
 LL | use inner1::*;
    |     ^^^^^^^^^
    = help: consider adding an explicit import of `exported` to disambiguate
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/local-modularized-tricky-fail-1.rs:36:5
@@ -62,6 +64,7 @@ LL | |     }
 LL |       define_panic!();
    |       ---------------- in this macro invocation
    = help: use `crate::panic` to refer to this macro unambiguously
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `include` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/local-modularized-tricky-fail-1.rs:47:1
@@ -81,6 +84,7 @@ LL | |     }
 LL |       define_include!();
    |       ------------------ in this macro invocation
    = help: use `crate::include` to refer to this macro unambiguously
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr
index 92a836cadfa..07b7ff942a6 100644
--- a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr
+++ b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr
@@ -9,6 +9,7 @@ LL |                 () => ( struct Б; )
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55467
    = help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: non-ascii idents are not fully supported
   --> $DIR/local-modularized-tricky-fail-2.rs:36:24
@@ -21,6 +22,7 @@ LL |         () => ( struct Г; )
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55467
    = help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: non-ascii idents are not fully supported
   --> $DIR/local-modularized-tricky-fail-2.rs:46:24
@@ -33,6 +35,7 @@ LL |         () => ( struct Д; )
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55467
    = help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-3.stderr b/src/test/ui/imports/local-modularized-tricky-fail-3.stderr
index 5272d2a319f..4494a88a5cf 100644
--- a/src/test/ui/imports/local-modularized-tricky-fail-3.stderr
+++ b/src/test/ui/imports/local-modularized-tricky-fail-3.stderr
@@ -17,6 +17,7 @@ LL | |     }
 ...
 LL |   define_exported!();
    |   ------------------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
   --> $DIR/local-modularized-tricky-fail-3.rs:19:5
@@ -36,6 +37,7 @@ LL | |     }
 ...
 LL |   define_exported!();
    |   ------------------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr
index 2f2ab20cdf0..413ead8c25e 100644
--- a/src/test/ui/imports/shadow_builtin_macros.stderr
+++ b/src/test/ui/imports/shadow_builtin_macros.stderr
@@ -28,6 +28,7 @@ LL |         macro_rules! panic { () => {} }
 LL |     } }
 LL |     m!();
    |     ----- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `n` is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
   --> $DIR/shadow_builtin_macros.rs:49:5
diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr
index 1184f51680a..6eddd9c411b 100644
--- a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr
+++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr
@@ -36,6 +36,8 @@ LL |         fn $fn_name(gift: &str) -> $type_name {
 ...
 LL | autowrapper!(Autowrapped, autowrap_gift, 'a);
    | --------------------------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hidden lifetime parameters in types are deprecated
   --> $DIR/elided-lifetimes.rs:78:18
@@ -51,6 +53,8 @@ LL |         Ref<($($types),*)>
 ...
 LL |     let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow();
    |                 ---------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 7 previous errors
 
diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr
index efe1f58a6f4..d035df8e5d8 100644
--- a/src/test/ui/include-macros/mismatched-types.stderr
+++ b/src/test/ui/include-macros/mismatched-types.stderr
@@ -8,6 +8,7 @@ LL |     let b: &[u8] = include_str!("file.txt");
    |
    = note: expected reference `&[u8]`
               found reference `&'static str`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/mismatched-types.rs:3:19
@@ -19,6 +20,7 @@ LL |     let s: &str = include_bytes!("file.txt");
    |
    = note: expected reference `&str`
               found reference `&'static [u8; 0]`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/infinite/infinite-macro-expansion.stderr b/src/test/ui/infinite/infinite-macro-expansion.stderr
index ff67eea5688..c9254915d03 100644
--- a/src/test/ui/infinite/infinite-macro-expansion.stderr
+++ b/src/test/ui/infinite/infinite-macro-expansion.stderr
@@ -8,6 +8,7 @@ LL |     recursive!()
    |     ------------ in this macro invocation
    |
    = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`infinite_macro_expansion`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr
index f38bfb2af1d..2647e337b9d 100644
--- a/src/test/ui/inline-asm-bad-constraint.stderr
+++ b/src/test/ui/inline-asm-bad-constraint.stderr
@@ -3,18 +3,24 @@ error[E0668]: malformed inline assembly
    |
 LL |         asm!("" :"={rax"(rax))
    |         ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0668]: malformed inline assembly
   --> $DIR/inline-asm-bad-constraint.rs:30:9
    |
 LL |         asm!("callq $0" : : "0"(foo))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0668]: malformed inline assembly
   --> $DIR/inline-asm-bad-constraint.rs:37:9
    |
 LL |         asm!("addb $1, $0" : "={rax}"((0i32, rax)));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/internal/internal-unstable-noallow.stderr b/src/test/ui/internal/internal-unstable-noallow.stderr
index 5a3a2356150..ede8e5437ff 100644
--- a/src/test/ui/internal/internal-unstable-noallow.stderr
+++ b/src/test/ui/internal/internal-unstable-noallow.stderr
@@ -5,7 +5,7 @@ LL |     call_unstable_noallow!();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(function)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: use of unstable library feature 'struct_field'
   --> $DIR/internal-unstable-noallow.rs:18:5
@@ -14,7 +14,7 @@ LL |     construct_unstable_noallow!(0);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(struct_field)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: use of unstable library feature 'method'
   --> $DIR/internal-unstable-noallow.rs:20:35
@@ -23,7 +23,7 @@ LL |     |x: internal_unstable::Foo| { call_method_noallow!(x) };
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(method)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0658]: use of unstable library feature 'struct2_field'
   --> $DIR/internal-unstable-noallow.rs:22:35
@@ -32,7 +32,7 @@ LL |     |x: internal_unstable::Bar| { access_field_noallow!(x) };
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(struct2_field)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr
index 2c9d1469210..2c6bf42ae86 100644
--- a/src/test/ui/internal/internal-unstable.stderr
+++ b/src/test/ui/internal/internal-unstable.stderr
@@ -40,6 +40,7 @@ LL |     bar!(internal_unstable::unstable());
    |     ------------------------------------ in this macro invocation
    |
    = help: add `#![feature(function)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/invalid/invalid-no-sanitize.rs b/src/test/ui/invalid/invalid-no-sanitize.rs
new file mode 100644
index 00000000000..b52e3cc83fa
--- /dev/null
+++ b/src/test/ui/invalid/invalid-no-sanitize.rs
@@ -0,0 +1,5 @@
+#![feature(no_sanitize)]
+
+#[no_sanitize(brontosaurus)] //~ ERROR invalid argument
+fn main() {
+}
diff --git a/src/test/ui/invalid/invalid-no-sanitize.stderr b/src/test/ui/invalid/invalid-no-sanitize.stderr
new file mode 100644
index 00000000000..e9983e5fbd2
--- /dev/null
+++ b/src/test/ui/invalid/invalid-no-sanitize.stderr
@@ -0,0 +1,10 @@
+error: invalid argument for `no_sanitize`
+  --> $DIR/invalid-no-sanitize.rs:3:15
+   |
+LL | #[no_sanitize(brontosaurus)]
+   |               ^^^^^^^^^^^^
+   |
+   = note: expected one of: `address`, `memory` or `thread`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-12997-2.stderr b/src/test/ui/issues/issue-12997-2.stderr
index 01f8e348836..04464896e92 100644
--- a/src/test/ui/issues/issue-12997-2.stderr
+++ b/src/test/ui/issues/issue-12997-2.stderr
@@ -3,6 +3,8 @@ error[E0308]: mismatched types
    |
 LL | fn bar(x: isize) { }
    | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `&mut test::Bencher`
+   |
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-13446.stderr b/src/test/ui/issues/issue-13446.stderr
index 13c35dd84f7..71d3bfe3398 100644
--- a/src/test/ui/issues/issue-13446.stderr
+++ b/src/test/ui/issues/issue-13446.stderr
@@ -6,7 +6,7 @@ LL | static VEC: [u32; 256] = vec![];
    |
    = note: expected array `[u32; 256]`
              found struct `std::vec::Vec<_>`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-14091-2.stderr b/src/test/ui/issues/issue-14091-2.stderr
index 2d6e9567d26..499ebe977ed 100644
--- a/src/test/ui/issues/issue-14091-2.stderr
+++ b/src/test/ui/issues/issue-14091-2.stderr
@@ -5,6 +5,7 @@ LL |     assert!(x, x);
    |     ^^^^^^^^^^^^^^ cannot apply unary operator `!`
    |
    = note: an implementation of `std::ops::Not` might be missing for `BytePos`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-15167.stderr b/src/test/ui/issues/issue-15167.stderr
index 1c488bf6fba..fff28b0c3af 100644
--- a/src/test/ui/issues/issue-15167.stderr
+++ b/src/test/ui/issues/issue-15167.stderr
@@ -6,6 +6,8 @@ LL | macro_rules! f { () => (n) }
 ...
 LL |         println!("{}", f!());
    |                        ---- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `n` in this scope
   --> $DIR/issue-15167.rs:3:25
@@ -15,6 +17,8 @@ LL | macro_rules! f { () => (n) }
 ...
 LL |         println!("{}", f!());
    |                        ---- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `n` in this scope
   --> $DIR/issue-15167.rs:3:25
@@ -24,6 +28,8 @@ LL | macro_rules! f { () => (n) }
 ...
 LL |         println!("{}", f!());
    |                        ---- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `n` in this scope
   --> $DIR/issue-15167.rs:3:25
@@ -33,6 +39,8 @@ LL | macro_rules! f { () => (n) }
 ...
 LL |         println!("{}", f!());
    |                        ---- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/issues/issue-16098.stderr b/src/test/ui/issues/issue-16098.stderr
index a34039a6eec..077c720a9cd 100644
--- a/src/test/ui/issues/issue-16098.stderr
+++ b/src/test/ui/issues/issue-16098.stderr
@@ -8,6 +8,7 @@ LL |     println!("Problem 1: {}", prob1!(1000));
    |                               ------------ in this macro invocation
    |
    = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_16098`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr
index 49a12cc2009..30932a375b1 100644
--- a/src/test/ui/issues/issue-16966.stderr
+++ b/src/test/ui/issues/issue-16966.stderr
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
 LL |     panic!(std::default::Default::default());
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `M` declared on the function `begin_panic`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr
index a7bb4fc5128..a24dc8a259d 100644
--- a/src/test/ui/issues/issue-21160.stderr
+++ b/src/test/ui/issues/issue-21160.stderr
@@ -8,6 +8,8 @@ LL | struct Foo(Bar);
    |
 LL |     fn hash<H: Hasher>(&self, state: &mut H);
    |             - required by this bound in `std::hash::Hash::hash`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-2150.stderr b/src/test/ui/issues/issue-2150.stderr
index 3f370255106..f1cb3890a72 100644
--- a/src/test/ui/issues/issue-2150.stderr
+++ b/src/test/ui/issues/issue-2150.stderr
@@ -11,7 +11,6 @@ note: the lint level is defined here
    |
 LL | #![deny(unreachable_code)]
    |         ^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-25385.stderr b/src/test/ui/issues/issue-25385.stderr
index ab4db7e42a4..2ed48356e9f 100644
--- a/src/test/ui/issues/issue-25385.stderr
+++ b/src/test/ui/issues/issue-25385.stderr
@@ -6,6 +6,8 @@ LL |     ($e:expr) => { $e.foo() }
 ...
 LL |     foo!(a);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0599]: no method named `foo` found for type `i32` in the current scope
   --> $DIR/issue-25385.rs:10:15
diff --git a/src/test/ui/issues/issue-25386.stderr b/src/test/ui/issues/issue-25386.stderr
index eabb139b97d..76a4a5a493f 100644
--- a/src/test/ui/issues/issue-25386.stderr
+++ b/src/test/ui/issues/issue-25386.stderr
@@ -6,6 +6,8 @@ LL |         (*$var.c_object).$member.is_some()
 ...
 LL |     println!("{}", check_ptr_exist!(item, name));
    |                    ---------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0616]: field `name` of struct `stuff::CObj` is private
   --> $DIR/issue-25386.rs:19:9
@@ -15,6 +17,8 @@ LL |         (*$var.c_object).$member.is_some()
 ...
 LL |     println!("{}", check_ptr_exist!(item, name));
    |                    ---------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-25793.stderr b/src/test/ui/issues/issue-25793.stderr
index daea9cd8cd7..9d66ba3aae1 100644
--- a/src/test/ui/issues/issue-25793.stderr
+++ b/src/test/ui/issues/issue-25793.stderr
@@ -10,6 +10,8 @@ LL |         r.get_size(width!(self))
    |           -------- ------------ in this macro invocation
    |           |
    |           borrow later used by call
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-26093.stderr b/src/test/ui/issues/issue-26093.stderr
index c96228b518a..204786c65c1 100644
--- a/src/test/ui/issues/issue-26093.stderr
+++ b/src/test/ui/issues/issue-26093.stderr
@@ -9,6 +9,8 @@ LL |     not_a_place!(99);
    |     |            |
    |     |            cannot assign to this expression
    |     in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0067]: invalid left-hand side of assignment
   --> $DIR/issue-26093.rs:5:16
@@ -21,6 +23,8 @@ LL |     not_a_place!(99);
    |     |            |
    |     |            cannot assign to this expression
    |     in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-26094.stderr b/src/test/ui/issues/issue-26094.stderr
index 36b2d3d074b..0b5b6d5a750 100644
--- a/src/test/ui/issues/issue-26094.stderr
+++ b/src/test/ui/issues/issue-26094.stderr
@@ -9,6 +9,8 @@ LL | fn some_function() {}
 ...
 LL |     some_macro!(some_function);
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-27340.stderr b/src/test/ui/issues/issue-27340.stderr
index 05b213b293c..f2c659083f6 100644
--- a/src/test/ui/issues/issue-27340.stderr
+++ b/src/test/ui/issues/issue-27340.stderr
@@ -6,6 +6,8 @@ LL | #[derive(Copy, Clone)]
 LL |
 LL | struct Bar(Foo);
    |            --- this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-27592.stderr b/src/test/ui/issues/issue-27592.stderr
index c8649d82d74..cf59016ded4 100644
--- a/src/test/ui/issues/issue-27592.stderr
+++ b/src/test/ui/issues/issue-27592.stderr
@@ -6,12 +6,16 @@ LL |     write(|| format_args!("{}", String::from("Hello world")));
    |              |                  |
    |              |                  temporary value created here
    |              returns a value referencing data owned by the current function
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0515]: cannot return reference to temporary value
   --> $DIR/issue-27592.rs:16:14
    |
 LL |     write(|| format_args!("{}", String::from("Hello world")));
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returns a reference to data owned by the current function
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-29084.stderr b/src/test/ui/issues/issue-29084.stderr
index 3e7ea745ce4..bc22e937139 100644
--- a/src/test/ui/issues/issue-29084.stderr
+++ b/src/test/ui/issues/issue-29084.stderr
@@ -6,6 +6,8 @@ LL |         bar(&mut $d);
 ...
 LL |     foo!(0u8);
    |     ---------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-31011.stderr b/src/test/ui/issues/issue-31011.stderr
index c7618e0835b..deaf490466c 100644
--- a/src/test/ui/issues/issue-31011.stderr
+++ b/src/test/ui/issues/issue-31011.stderr
@@ -9,6 +9,8 @@ LL | fn wrap<T>(context: &T) -> ()
 LL | {
 LL |     log!(context, "entered wrapper");
    |     --------------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr
index ca085b25c2d..5d5ad8aed98 100644
--- a/src/test/ui/issues/issue-32655.stderr
+++ b/src/test/ui/issues/issue-32655.stderr
@@ -6,6 +6,8 @@ LL |         #[derive_Clone]
 ...
 LL | foo!();
    | ------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: cannot find attribute `derive_Clone` in this scope
   --> $DIR/issue-32655.rs:15:7
diff --git a/src/test/ui/issues/issue-32782.stderr b/src/test/ui/issues/issue-32782.stderr
index 029826f09a2..3d74897aab2 100644
--- a/src/test/ui/issues/issue-32782.stderr
+++ b/src/test/ui/issues/issue-32782.stderr
@@ -8,6 +8,7 @@ LL | foo!();
    | ------- in this macro invocation
    |
    = help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-32829.stderr b/src/test/ui/issues/issue-32829.stderr
index b620abbf436..98201b050ec 100644
--- a/src/test/ui/issues/issue-32829.stderr
+++ b/src/test/ui/issues/issue-32829.stderr
@@ -6,7 +6,7 @@ LL | static S : u64 = { { panic!("foo"); 0 } };
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/51999
    = help: add `#![feature(const_panic)]` to the crate attributes to enable
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr
index 3cdf35af1d8..06a6ebd9704 100644
--- a/src/test/ui/issues/issue-32950.stderr
+++ b/src/test/ui/issues/issue-32950.stderr
@@ -9,6 +9,8 @@ error[E0412]: cannot find type `FooBar` in this scope
    |
 LL |     concat_idents!(Foo, Bar)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-34229.stderr b/src/test/ui/issues/issue-34229.stderr
index 9e1734899bd..cd9be6ab72c 100644
--- a/src/test/ui/issues/issue-34229.stderr
+++ b/src/test/ui/issues/issue-34229.stderr
@@ -6,6 +6,7 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Comparable`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Comparable` with `Comparable`
   --> $DIR/issue-34229.rs:2:46
@@ -15,6 +16,7 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Comparable`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Comparable` with `Comparable`
   --> $DIR/issue-34229.rs:2:46
@@ -24,6 +26,7 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Comparable`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Comparable` with `Comparable`
   --> $DIR/issue-34229.rs:2:46
@@ -33,6 +36,7 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Comparable`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `Comparable` with `Comparable`
   --> $DIR/issue-34229.rs:2:46
@@ -42,6 +46,7 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `Comparable`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr
index c52ea4ef9da..c68b271807b 100644
--- a/src/test/ui/issues/issue-34334.stderr
+++ b/src/test/ui/issues/issue-34334.stderr
@@ -33,7 +33,7 @@ LL |     let sr: Vec<(u32, _, _) = vec![];
    |
    = note: expected type `bool`
             found struct `std::vec::Vec<_>`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0070]: invalid left-hand side of assignment
   --> $DIR/issue-34334.rs:2:29
diff --git a/src/test/ui/issues/issue-38821.stderr b/src/test/ui/issues/issue-38821.stderr
index 0687fc940de..e355094261d 100644
--- a/src/test/ui/issues/issue-38821.stderr
+++ b/src/test/ui/issues/issue-38821.stderr
@@ -5,6 +5,7 @@ LL | #[derive(Debug, Copy, Clone)]
    |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
    |
    = note: required because of the requirements on the impl of `IntoNullable` for `<Col as Expression>::SqlType`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-42954.stderr b/src/test/ui/issues/issue-42954.stderr
index 8c35088a1bb..840cceea7b0 100644
--- a/src/test/ui/issues/issue-42954.stderr
+++ b/src/test/ui/issues/issue-42954.stderr
@@ -9,6 +9,8 @@ LL |         $i as u32 < 0
 ...
 LL |     is_plainly_printable!(c);
    |     ------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-48364.stderr b/src/test/ui/issues/issue-48364.stderr
index e5bb9298cd5..5ccede308a1 100644
--- a/src/test/ui/issues/issue-48364.stderr
+++ b/src/test/ui/issues/issue-48364.stderr
@@ -6,6 +6,7 @@ LL |     b"".starts_with(stringify!(foo))
    |
    = note: expected reference `&[u8]`
               found reference `&'static str`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-48728.stderr b/src/test/ui/issues/issue-48728.stderr
index 84c10d8fbc4..a0698c20798 100644
--- a/src/test/ui/issues/issue-48728.stderr
+++ b/src/test/ui/issues/issue-48728.stderr
@@ -8,6 +8,7 @@ LL | impl<T: Clone + ?Sized> Clone for Node<[T]> {
    | ------------------------------------------- first implementation here
    |
    = note: upstream crates may add a new impl of trait `std::clone::Clone` for type `[_]` in future versions
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-50480.stderr b/src/test/ui/issues/issue-50480.stderr
index 2b92664d577..dfcac128173 100644
--- a/src/test/ui/issues/issue-50480.stderr
+++ b/src/test/ui/issues/issue-50480.stderr
@@ -29,6 +29,8 @@ LL | struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
    |                                                 --------  ------ this field does not implement `Copy`
    |                                                 |
    |                                                 this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/issues/issue-51848.stderr b/src/test/ui/issues/issue-51848.stderr
index 31faaab6141..051c4d7f427 100644
--- a/src/test/ui/issues/issue-51848.stderr
+++ b/src/test/ui/issues/issue-51848.stderr
@@ -10,6 +10,7 @@ LL |     macro_with_error!();
    |     -------------------- in this macro invocation
    |
    = note: if you intended to print `{`, you can escape it using `{{`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: invalid format string: unmatched `}` found
   --> $DIR/issue-51848.rs:18:15
diff --git a/src/test/ui/issues/issue-53251.stderr b/src/test/ui/issues/issue-53251.stderr
index 21e41574a46..cd5030f7619 100644
--- a/src/test/ui/issues/issue-53251.stderr
+++ b/src/test/ui/issues/issue-53251.stderr
@@ -6,6 +6,8 @@ LL |                 S::f::<i64>();
 ...
 LL | impl_add!(a b);
    | --------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0107]: wrong number of type arguments: expected 0, found 1
   --> $DIR/issue-53251.rs:11:24
@@ -15,6 +17,8 @@ LL |                 S::f::<i64>();
 ...
 LL | impl_add!(a b);
    | --------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-56411.stderr b/src/test/ui/issues/issue-56411.stderr
index 1f38c70a119..3ac8dc548ae 100644
--- a/src/test/ui/issues/issue-56411.stderr
+++ b/src/test/ui/issues/issue-56411.stderr
@@ -13,6 +13,7 @@ LL | import!(("issue-56411-aux.rs", issue_56411_aux));
    | ------------------------------------------------- in this macro invocation
    |
    = note: `issue_56411_aux` must be defined only once in the type namespace of this module
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0365]: `issue_56411_aux` is private, and cannot be re-exported
   --> $DIR/issue-56411.rs:6:21
@@ -24,6 +25,7 @@ LL | import!(("issue-56411-aux.rs", issue_56411_aux));
    | ------------------------------------------------- in this macro invocation
    |
    = note: consider declaring type or module `issue_56411_aux` with `pub`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr
index 35ada71a1f1..2ac5577e0a0 100644
--- a/src/test/ui/issues/issue-59488.stderr
+++ b/src/test/ui/issues/issue-59488.stderr
@@ -80,7 +80,7 @@ LL |     assert_eq!(Foo::Bar, i);
    |     fn(usize) -> Foo {Foo::Bar}
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `fn(usize) -> Foo {Foo::Bar}`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `std::fmt::Debug`
   --> $DIR/issue-59488.rs:30:5
@@ -91,7 +91,7 @@ LL |     assert_eq!(Foo::Bar, i);
    = help: the trait `std::fmt::Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&fn(usize) -> Foo {Foo::Bar}`
    = note: required by `std::fmt::Debug::fmt`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `std::fmt::Debug`
   --> $DIR/issue-59488.rs:30:5
@@ -102,7 +102,7 @@ LL |     assert_eq!(Foo::Bar, i);
    = help: the trait `std::fmt::Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&fn(usize) -> Foo {Foo::Bar}`
    = note: required by `std::fmt::Debug::fmt`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 10 previous errors
 
diff --git a/src/test/ui/issues/issue-6596-1.stderr b/src/test/ui/issues/issue-6596-1.stderr
index 2a4ece2f242..4f29d8a9274 100644
--- a/src/test/ui/issues/issue-6596-1.stderr
+++ b/src/test/ui/issues/issue-6596-1.stderr
@@ -6,6 +6,8 @@ LL |         $nonexistent
 ...
 LL |     e!(foo);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-6596-2.stderr b/src/test/ui/issues/issue-6596-2.stderr
index 20fbe0fab01..4fcb0176faa 100644
--- a/src/test/ui/issues/issue-6596-2.stderr
+++ b/src/test/ui/issues/issue-6596-2.stderr
@@ -6,6 +6,8 @@ LL |         { $inp $nonexistent }
 ...
 LL |     g!(foo);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr b/src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr
index 8d1a03ac207..78760efd8d1 100644
--- a/src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr
+++ b/src/test/ui/issues/issue-68091-unicode-ident-after-if.stderr
@@ -12,6 +12,8 @@ LL |         $($c)ö* {}
 ...
 LL |     x!(if);
    |     ------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
index 0e2fc0a0fe9..2cb6e62e412 100644
--- a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
+++ b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr
@@ -10,7 +10,7 @@ LL |     x.use_mut();
    |     - borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/lint/lint-stability2.stderr b/src/test/ui/lint/lint-stability2.stderr
index 5bac22594d6..a14bf2ec8ca 100644
--- a/src/test/ui/lint/lint-stability2.stderr
+++ b/src/test/ui/lint/lint-stability2.stderr
@@ -9,7 +9,7 @@ note: the lint level is defined here
    |
 LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/lint/lint-stability3.stderr b/src/test/ui/lint/lint-stability3.stderr
index 566734743ca..858ac12612c 100644
--- a/src/test/ui/lint/lint-stability3.stderr
+++ b/src/test/ui/lint/lint-stability3.stderr
@@ -9,7 +9,7 @@ note: the lint level is defined here
    |
 LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr
index 8e56fd4139b..0b2b9fab392 100644
--- a/src/test/ui/lint/lint-unsafe-code.stderr
+++ b/src/test/ui/lint/lint-unsafe-code.stderr
@@ -90,6 +90,8 @@ LL |         unsafe {}
 ...
 LL |     unsafe_in_macro!()
    |     ------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 14 previous errors
 
diff --git a/src/test/ui/lint/lints-in-foreign-macros.stderr b/src/test/ui/lint/lints-in-foreign-macros.stderr
index 0d2adb2ad04..207d85a89c7 100644
--- a/src/test/ui/lint/lints-in-foreign-macros.stderr
+++ b/src/test/ui/lint/lints-in-foreign-macros.stderr
@@ -12,6 +12,7 @@ note: the lint level is defined here
    |
 LL | #![warn(unused_imports)]
    |         ^^^^^^^^^^^^^^
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: unused import: `std::string::ToString`
   --> $DIR/lints-in-foreign-macros.rs:16:18
diff --git a/src/test/ui/lint/test-inner-fn.stderr b/src/test/ui/lint/test-inner-fn.stderr
index bf476a45f77..a8974e1cf96 100644
--- a/src/test/ui/lint/test-inner-fn.stderr
+++ b/src/test/ui/lint/test-inner-fn.stderr
@@ -5,12 +5,15 @@ LL |     #[test]
    |     ^^^^^^^
    |
    = note: requested on the command line with `-D unnameable-test-items`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: cannot test inner items
   --> $DIR/test-inner-fn.rs:13:9
    |
 LL |         #[test]
    |         ^^^^^^^
+   |
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.stderr b/src/test/ui/lint/unreachable_pub-pub_crate.stderr
index abe07b1c649..fd3f2dbc076 100644
--- a/src/test/ui/lint/unreachable_pub-pub_crate.stderr
+++ b/src/test/ui/lint/unreachable_pub-pub_crate.stderr
@@ -132,6 +132,7 @@ LL |     define_empty_struct_with_visibility!(pub, Fluorine);
    |     in this macro invocation
    |
    = help: or consider exporting it for use by other crates
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: unreachable `pub` item
   --> $DIR/unreachable_pub-pub_crate.rs:45:9
diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr
index 6144d5bb657..ad687a4b54e 100644
--- a/src/test/ui/lint/unreachable_pub.stderr
+++ b/src/test/ui/lint/unreachable_pub.stderr
@@ -132,6 +132,7 @@ LL |     define_empty_struct_with_visibility!(pub, Fluorine);
    |     in this macro invocation
    |
    = help: or consider exporting it for use by other crates
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: unreachable `pub` item
   --> $DIR/unreachable_pub.rs:41:9
diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
index 6b4de6618c5..ae63bad841f 100644
--- a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
+++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
@@ -9,6 +9,8 @@ LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } }
 ...
 LL |     test!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
   --> $DIR/liveness-return-last-stmt-semi.rs:7:19
diff --git a/src/test/ui/macro_backtrace/main.stderr b/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr
index c4950e0fdf5..41ed545cf16 100644
--- a/src/test/ui/macro_backtrace/main.stderr
+++ b/src/test/ui/macro_backtrace/main.-Zmacro-backtrace.stderr
@@ -1,5 +1,5 @@
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
-  --> $DIR/main.rs:9:20
+  --> $DIR/main.rs:10:20
    |
 LL | / macro_rules! pong {
 LL | |     () => { syntax error };
@@ -11,7 +11,7 @@ LL |       pong!();
    |       -------- in this macro invocation
 
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
-  --> $DIR/main.rs:9:20
+  --> $DIR/main.rs:10:20
    |
 LL | / macro_rules! pong {
 LL | |     () => { syntax error };
@@ -31,7 +31,7 @@ LL |   () => { pong ! () ; }
    |   in this expansion of `ping!`
 
 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
-  --> $DIR/main.rs:9:20
+  --> $DIR/main.rs:10:20
    |
 LL | / macro_rules! pong {
 LL | |     () => { syntax error };
diff --git a/src/test/ui/macro_backtrace/main.default.stderr b/src/test/ui/macro_backtrace/main.default.stderr
new file mode 100644
index 00000000000..fac76fd6080
--- /dev/null
+++ b/src/test/ui/macro_backtrace/main.default.stderr
@@ -0,0 +1,35 @@
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
+  --> $DIR/main.rs:10:20
+   |
+LL |     () => { syntax error };
+   |                    ^^^^^ expected one of 8 possible tokens
+...
+LL |     pong!();
+   |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
+  --> $DIR/main.rs:10:20
+   |
+LL |     () => { syntax error };
+   |                    ^^^^^ expected one of 8 possible tokens
+...
+LL |     ping!();
+   |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
+  --> $DIR/main.rs:10:20
+   |
+LL |     () => { syntax error };
+   |                    ^^^^^ expected one of 8 possible tokens
+...
+LL |     deep!();
+   |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/macro_backtrace/main.rs b/src/test/ui/macro_backtrace/main.rs
index 8fcd497f87b..6cee3b4cd96 100644
--- a/src/test/ui/macro_backtrace/main.rs
+++ b/src/test/ui/macro_backtrace/main.rs
@@ -1,6 +1,7 @@
 // Test that the macro backtrace facility works
 // aux-build:ping.rs
-// compile-flags: -Z external-macro-backtrace
+// revisions: default -Zmacro-backtrace
+//[-Zmacro-backtrace] compile-flags: -Z macro-backtrace
 
 #[macro_use] extern crate ping;
 
diff --git a/src/test/ui/macros/assert.stderr b/src/test/ui/macros/assert.stderr
index fa604506b94..8aa7c331859 100644
--- a/src/test/ui/macros/assert.stderr
+++ b/src/test/ui/macros/assert.stderr
@@ -16,7 +16,7 @@ error: macro requires a boolean expression as an argument
 LL |     debug_assert!();
    |     ^^^^^^^^^^^^^^^^ boolean expression required
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected expression, found keyword `struct`
   --> $DIR/assert.rs:5:19
diff --git a/src/test/ui/macros/cfg.stderr b/src/test/ui/macros/cfg.stderr
index 0fdb62922a7..bbfc5e27fec 100644
--- a/src/test/ui/macros/cfg.stderr
+++ b/src/test/ui/macros/cfg.stderr
@@ -3,6 +3,8 @@ error: macro requires a cfg-pattern as an argument
    |
 LL |     cfg!();
    |     ^^^^^^^ cfg-pattern required
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected identifier, found `123`
   --> $DIR/cfg.rs:3:10
diff --git a/src/test/ui/macros/derive-in-eager-expansion-hang.stderr b/src/test/ui/macros/derive-in-eager-expansion-hang.stderr
index 0e2fb4c8af5..5943a252579 100644
--- a/src/test/ui/macros/derive-in-eager-expansion-hang.stderr
+++ b/src/test/ui/macros/derive-in-eager-expansion-hang.stderr
@@ -12,6 +12,7 @@ LL | |     }
 LL |       format_args!(hang!());
    |                    ------- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you might be missing a string literal to format with
    |
 LL |     format_args!("{}", hang!());
diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr
index 02b704299ff..66cffbfa181 100644
--- a/src/test/ui/macros/format-parse-errors.stderr
+++ b/src/test/ui/macros/format-parse-errors.stderr
@@ -4,7 +4,7 @@ error: requires at least a format string argument
 LL |     format!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected expression, found keyword `struct`
   --> $DIR/format-parse-errors.rs:5:13
diff --git a/src/test/ui/macros/issue-54441.stderr b/src/test/ui/macros/issue-54441.stderr
index 92d1afe1b64..c94355f4716 100644
--- a/src/test/ui/macros/issue-54441.stderr
+++ b/src/test/ui/macros/issue-54441.stderr
@@ -6,6 +6,8 @@ LL |         let
 ...
 LL |     m!();
    |     ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
index 85dee9f24fe..2ce565936f2 100644
--- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
+++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
@@ -6,6 +6,8 @@ LL |           1.fake()
 ...
 LL |     fake_method_stmt!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
   --> $DIR/macro-backtrace-invalid-internals.rs:11:13
@@ -15,6 +17,8 @@ LL |           1.fake
 ...
 LL |     fake_field_stmt!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
   --> $DIR/macro-backtrace-invalid-internals.rs:17:15
@@ -24,6 +28,8 @@ LL |           (1).0
 ...
 LL |     fake_anon_field_stmt!();
    |     ------------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
   --> $DIR/macro-backtrace-invalid-internals.rs:41:15
@@ -34,6 +40,7 @@ LL |           2.0.neg()
 LL |     real_method_stmt!();
    |     -------------------- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you must specify a concrete type for this numeric value, like `f32`
    |
 LL |           2.0_f32.neg()
@@ -47,6 +54,8 @@ LL |           1.fake()
 ...
 LL |     let _ = fake_method_expr!();
    |             ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
   --> $DIR/macro-backtrace-invalid-internals.rs:29:13
@@ -56,6 +65,8 @@ LL |           1.fake
 ...
 LL |     let _ = fake_field_expr!();
    |             ------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
   --> $DIR/macro-backtrace-invalid-internals.rs:35:15
@@ -65,6 +76,8 @@ LL |           (1).0
 ...
 LL |     let _ = fake_anon_field_expr!();
    |             ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
   --> $DIR/macro-backtrace-invalid-internals.rs:47:15
@@ -75,6 +88,7 @@ LL |           2.0.neg()
 LL |     let _ = real_method_expr!();
    |             ------------------- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you must specify a concrete type for this numeric value, like `f32`
    |
 LL |           2.0_f32.neg()
diff --git a/src/test/ui/macros/macro-backtrace-nested.stderr b/src/test/ui/macros/macro-backtrace-nested.stderr
index 501f525a05f..8d366383366 100644
--- a/src/test/ui/macros/macro-backtrace-nested.stderr
+++ b/src/test/ui/macros/macro-backtrace-nested.stderr
@@ -6,6 +6,8 @@ LL |     () => (fake)
 ...
 LL |     1 + call_nested_expr!();
    |         ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `fake` in this scope
   --> $DIR/macro-backtrace-nested.rs:5:12
@@ -15,6 +17,8 @@ LL |     () => (fake)
 ...
 LL |     call_nested_expr_sum!();
    |     ------------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr
index 209ff09aea4..b4194a833a4 100644
--- a/src/test/ui/macros/macro-backtrace-println.stderr
+++ b/src/test/ui/macros/macro-backtrace-println.stderr
@@ -6,6 +6,8 @@ LL |     ($fmt:expr) => (myprint!(concat!($fmt, "\n")));
 ...
 LL |     myprintln!("{}");
    |     ----------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/macro-context.stderr b/src/test/ui/macros/macro-context.stderr
index 2a0779190f5..2e712110689 100644
--- a/src/test/ui/macros/macro-context.stderr
+++ b/src/test/ui/macros/macro-context.stderr
@@ -39,6 +39,8 @@ LL |     () => ( i ; typeof );
 ...
 LL |     m!();
    |     ----- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
index 05418d9bddf..162b337bbef 100644
--- a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
+++ b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr
@@ -8,4 +8,6 @@ LL |     'b: loop {
    |     -- first declared here
 LL |         br2!('b);
    |         --------- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/macros/macro-local-data-key-priv.stderr b/src/test/ui/macros/macro-local-data-key-priv.stderr
index 72994d1652c..c53a09aad57 100644
--- a/src/test/ui/macros/macro-local-data-key-priv.stderr
+++ b/src/test/ui/macros/macro-local-data-key-priv.stderr
@@ -9,7 +9,7 @@ note: the constant `baz` is defined here
    |
 LL |     thread_local!(static baz: f64 = 0.0);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/macro-shadowing.stderr b/src/test/ui/macros/macro-shadowing.stderr
index 033e12a31ae..461e71471fb 100644
--- a/src/test/ui/macros/macro-shadowing.stderr
+++ b/src/test/ui/macros/macro-shadowing.stderr
@@ -8,6 +8,7 @@ LL | m1!();
    | ------ in this macro invocation
    |
    = note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `foo` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/macro-shadowing.rs:17:1
@@ -28,6 +29,7 @@ note: `foo` could also refer to the macro defined here
    |
 LL | macro_rules! foo { () => {} }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr
index d29e6b4d46f..1ab6b79a61e 100644
--- a/src/test/ui/macros/macros-nonfatal-errors.stderr
+++ b/src/test/ui/macros/macros-nonfatal-errors.stderr
@@ -3,6 +3,8 @@ error[E0665]: `Default` cannot be derived for enums, only structs
    |
 LL | #[derive(Default)]
    |          ^^^^^^^
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: inline assembly must be a string literal
   --> $DIR/macros-nonfatal-errors.rs:13:10
@@ -68,6 +70,8 @@ error: couldn't read $DIR/i'd be quite surprised if a file with this name existe
    |
 LL |     include_str!("i'd be quite surprised if a file with this name existed");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: argument must be a string literal
   --> $DIR/macros-nonfatal-errors.rs:28:20
@@ -80,6 +84,8 @@ error: couldn't read $DIR/i'd be quite surprised if a file with this name existe
    |
 LL |     include_bytes!("i'd be quite surprised if a file with this name existed");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trace_macros! accepts only `true` or `false`
   --> $DIR/macros-nonfatal-errors.rs:31:5
diff --git a/src/test/ui/macros/must-use-in-macro-55516.stderr b/src/test/ui/macros/must-use-in-macro-55516.stderr
index 302c8aa7e6a..e3649e32d76 100644
--- a/src/test/ui/macros/must-use-in-macro-55516.stderr
+++ b/src/test/ui/macros/must-use-in-macro-55516.stderr
@@ -6,5 +6,5 @@ LL |     write!(&mut example, "{}", 42);
    |
    = note: `-W unused-must-use` implied by `-W unused`
    = note: this `Result` may be an `Err` variant, which should be handled
-   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/macros/nonterminal-matching.stderr b/src/test/ui/macros/nonterminal-matching.stderr
index 93cc97d4583..9521322f5c2 100644
--- a/src/test/ui/macros/nonterminal-matching.stderr
+++ b/src/test/ui/macros/nonterminal-matching.stderr
@@ -9,6 +9,8 @@ LL |     n!(a $nt_item b);
 ...
 LL | complex_nonterminal!(enum E {});
    | -------------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/restricted-shadowing-legacy.stderr b/src/test/ui/macros/restricted-shadowing-legacy.stderr
index 8378286bdad..662266013d0 100644
--- a/src/test/ui/macros/restricted-shadowing-legacy.stderr
+++ b/src/test/ui/macros/restricted-shadowing-legacy.stderr
@@ -23,6 +23,7 @@ LL |         macro_rules! m { () => {} }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:139:42
@@ -49,6 +50,7 @@ LL |         macro_rules! m { () => {} }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:148:9
@@ -75,6 +77,7 @@ LL |         macro_rules! m { () => {} }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:164:9
@@ -101,6 +104,7 @@ LL |         macro_rules! m { () => { Wrong } }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:180:13
@@ -127,6 +131,7 @@ LL |         macro_rules! m { () => { Wrong } }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:218:42
@@ -153,6 +158,7 @@ LL |         macro_rules! m { () => { Wrong } }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:232:9
@@ -179,6 +185,7 @@ LL |             macro_rules! m { () => {} }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-legacy.rs:262:42
@@ -205,6 +212,7 @@ LL |             macro_rules! m { () => {} }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 8 previous errors
 
diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr
index 12075d42b9a..609f0b6b18a 100644
--- a/src/test/ui/macros/restricted-shadowing-modern.stderr
+++ b/src/test/ui/macros/restricted-shadowing-modern.stderr
@@ -23,6 +23,7 @@ LL |         macro m() {}
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-modern.rs:147:33
@@ -49,6 +50,7 @@ LL |         macro m() {}
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-modern.rs:156:13
@@ -75,6 +77,7 @@ LL |         macro m() {}
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-modern.rs:172:13
@@ -101,6 +104,7 @@ LL |         macro m() { Wrong }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-modern.rs:190:17
@@ -127,6 +131,7 @@ LL |         macro m() { Wrong }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
   --> $DIR/restricted-shadowing-modern.rs:233:33
@@ -153,6 +158,7 @@ LL |         macro m() { Wrong }
 ...
 LL | include!();
    | ----------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/macros/same-sequence-span.stderr b/src/test/ui/macros/same-sequence-span.stderr
index 896f579765f..65b67a94238 100644
--- a/src/test/ui/macros/same-sequence-span.stderr
+++ b/src/test/ui/macros/same-sequence-span.stderr
@@ -28,17 +28,16 @@ LL | | fn main() {}
 ...  |
    |
    = note: allowed there are: `=>`, `,` or `;`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments
   --> $DIR/same-sequence-span.rs:19:1
    |
 LL | proc_macro_sequence::make_foo!();
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   | |
-   | not allowed after `expr` fragments
-   | in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed after `expr` fragments
    |
    = note: allowed there are: `=>`, `,` or `;`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/macros/span-covering-argument-1.stderr b/src/test/ui/macros/span-covering-argument-1.stderr
index 2ac881107b9..efb8f61e462 100644
--- a/src/test/ui/macros/span-covering-argument-1.stderr
+++ b/src/test/ui/macros/span-covering-argument-1.stderr
@@ -8,6 +8,8 @@ LL |             *&mut $s = 0;
 ...
 LL |     bad!(foo whatever);
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/trace_faulty_macros.stderr b/src/test/ui/macros/trace_faulty_macros.stderr
index 021c51fd726..a18e22e07f8 100644
--- a/src/test/ui/macros/trace_faulty_macros.stderr
+++ b/src/test/ui/macros/trace_faulty_macros.stderr
@@ -9,6 +9,8 @@ LL |         my_faulty_macro!(bcd);
 ...
 LL |     my_faulty_macro!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: trace_macro
   --> $DIR/trace_faulty_macros.rs:33:5
@@ -30,6 +32,7 @@ LL |     my_recursive_macro!();
    |     ---------------------- in this macro invocation
    |
    = help: consider adding a `#![recursion_limit="8"]` attribute to your crate (`trace_faulty_macros`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: trace_macro
   --> $DIR/trace_faulty_macros.rs:34:5
diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr
index 1f1ee39b049..ddc75c905ac 100644
--- a/src/test/ui/malformed/malformed-derive-entry.stderr
+++ b/src/test/ui/malformed/malformed-derive-entry.stderr
@@ -21,12 +21,16 @@ error[E0277]: the trait bound `Test1: std::clone::Clone` is not satisfied
    |
 LL | #[derive(Copy(Bad))]
    |          ^^^^ the trait `std::clone::Clone` is not implemented for `Test1`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `Test2: std::clone::Clone` is not satisfied
   --> $DIR/malformed-derive-entry.rs:6:10
    |
 LL | #[derive(Copy="bad")]
    |          ^^^^ the trait `std::clone::Clone` is not implemented for `Test2`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr
index 6f6ad4508be..d1be82cf7b7 100644
--- a/src/test/ui/malformed/malformed-interpolated.stderr
+++ b/src/test/ui/malformed/malformed-interpolated.stderr
@@ -14,6 +14,8 @@ LL |         #[rustc_dummy = $expr]
 ...
 LL | check!(-0); // ERROR, see above
    | ----------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unexpected token: `0 + 0`
   --> $DIR/malformed-interpolated.rs:5:25
@@ -23,6 +25,8 @@ LL |         #[rustc_dummy = $expr]
 ...
 LL | check!(0 + 0); // ERROR, see above
    | -------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/match/match-arm-resolving-to-never.stderr b/src/test/ui/match/match-arm-resolving-to-never.stderr
index 3a723de9f6b..686fbd0baa3 100644
--- a/src/test/ui/match/match-arm-resolving-to-never.stderr
+++ b/src/test/ui/match/match-arm-resolving-to-never.stderr
@@ -12,8 +12,6 @@ LL | |         E::F => "",
    | |                 ^^ expected integer, found `&str`
 LL | |     };
    | |_____- `match` arms have incompatible types
-   |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
index d9e250882e1..10950834ad3 100644
--- a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
+++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
@@ -46,8 +46,6 @@ LL |     mac!(bar);
    |     ---------- you must specify a type for this binding, like `i32`
 LL |     bar.pow(2);
    |         ^^^
-   |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr
index d4dcb9a39a4..69a9d03e474 100644
--- a/src/test/ui/mismatched_types/issue-26480.stderr
+++ b/src/test/ui/mismatched_types/issue-26480.stderr
@@ -7,6 +7,7 @@ LL |                   $arr.len() * size_of($arr[0]));
 LL |     write!(hello);
    |     -------------- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit
    |
 LL |                   ($arr.len() * size_of($arr[0])).try_into().unwrap());
@@ -22,6 +23,7 @@ LL |     cast!(2);
    |     --------- in this macro invocation
    |
    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/missing/missing-semicolon-warning.stderr b/src/test/ui/missing/missing-semicolon-warning.stderr
index b4001aba288..ecaefd47de0 100644
--- a/src/test/ui/missing/missing-semicolon-warning.stderr
+++ b/src/test/ui/missing/missing-semicolon-warning.stderr
@@ -8,6 +8,7 @@ LL | fn main() { m!(0, 0; 0, 0); }
    |             --------------- in this macro invocation
    |
    = note: this was erroneously allowed and will become a hard error in a future release
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: expected `;`, found `println`
   --> $DIR/missing-semicolon-warning.rs:7:12
@@ -19,4 +20,5 @@ LL | fn main() { m!(0, 0; 0, 0); }
    |             --------------- in this macro invocation
    |
    = note: this was erroneously allowed and will become a hard error in a future release
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr
index 08e16f46936..c652faafad4 100644
--- a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr
+++ b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr
@@ -8,7 +8,6 @@ LL |     panic!()
    |     -------- this returned value is of type `!`
    |
    = note: the return type of a function must have a statically known size
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/never_type/never-assign-dead-code.stderr b/src/test/ui/never_type/never-assign-dead-code.stderr
index f0a11ae1bcc..6002f8e1eb7 100644
--- a/src/test/ui/never_type/never-assign-dead-code.stderr
+++ b/src/test/ui/never_type/never-assign-dead-code.stderr
@@ -12,7 +12,6 @@ note: the lint level is defined here
 LL | #![warn(unused)]
    |         ^^^^^^
    = note: `#[warn(unreachable_code)]` implied by `#[warn(unused)]`
-   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 warning: unreachable call
   --> $DIR/never-assign-dead-code.rs:10:5
diff --git a/src/test/ui/nll/issue-55850.rs b/src/test/ui/nll/issue-55850.rs
index a8f7299f899..e6279bd028e 100644
--- a/src/test/ui/nll/issue-55850.rs
+++ b/src/test/ui/nll/issue-55850.rs
@@ -15,7 +15,7 @@ where
     type Item = G::Yield;
 
     fn next(&mut self) -> Option<Self::Item> {
-        match Pin::new(&mut self.0).resume() {
+        match Pin::new(&mut self.0).resume(()) {
             Yielded(y) => Some(y),
             _ => None
         }
diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
index 20edfb33931..2f18f600b75 100644
--- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
+++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs
@@ -36,7 +36,7 @@ where
     T: Anything<'b, 'c>,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
+    //~^ ERROR may not live long enough
 }
 
 #[rustc_regions]
@@ -46,7 +46,7 @@ where
     'a: 'a,
 {
     with_signature(cell, t, |cell, t| require(cell, t));
-    //~^ ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
+    //~^ ERROR may not live long enough
 }
 
 #[rustc_regions]
diff --git a/src/test/ui/on-unimplemented/no-debug.stderr b/src/test/ui/on-unimplemented/no-debug.stderr
index cbb41263a83..4f9d428546b 100644
--- a/src/test/ui/on-unimplemented/no-debug.stderr
+++ b/src/test/ui/on-unimplemented/no-debug.stderr
@@ -7,6 +7,7 @@ LL |     println!("{:?} {:?}", Foo, Bar);
    = help: the trait `std::fmt::Debug` is not implemented for `Foo`
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required by `std::fmt::Debug::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Debug`
   --> $DIR/no-debug.rs:10:32
@@ -16,6 +17,7 @@ LL |     println!("{:?} {:?}", Foo, Bar);
    |
    = help: the trait `std::fmt::Debug` is not implemented for `no_debug::Bar`
    = note: required by `std::fmt::Debug::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `Foo` doesn't implement `std::fmt::Display`
   --> $DIR/no-debug.rs:11:23
@@ -26,6 +28,7 @@ LL |     println!("{} {}", Foo, Bar);
    = help: the trait `std::fmt::Display` is not implemented for `Foo`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: required by `std::fmt::Display::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Display`
   --> $DIR/no-debug.rs:11:28
@@ -36,6 +39,7 @@ LL |     println!("{} {}", Foo, Bar);
    = help: the trait `std::fmt::Display` is not implemented for `no_debug::Bar`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: required by `std::fmt::Display::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/out-of-order-shadowing.stderr b/src/test/ui/out-of-order-shadowing.stderr
index 2a120dee482..b414f9230b6 100644
--- a/src/test/ui/out-of-order-shadowing.stderr
+++ b/src/test/ui/out-of-order-shadowing.stderr
@@ -14,7 +14,7 @@ note: `bar` could also refer to the macro defined here
    |
 LL | macro_rules! bar { () => {} }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr b/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr
index dd193d6a86e..40599d228b2 100644
--- a/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr
+++ b/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr
@@ -8,6 +8,7 @@ LL |     mac1! { does_not_exist!() }
    |     --------------------------- in this macro invocation
    |
    = note: `mut` may be followed by `variable` and `variable @ pattern`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected identifier, found `does_not_exist!()`
   --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17
@@ -17,6 +18,8 @@ LL |         let mut $eval = ();
 ...
 LL |     mac2! { does_not_exist!() }
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `mut` must be followed by a named binding
   --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13
@@ -28,6 +31,7 @@ LL |     mac2! { does_not_exist!() }
    |     --------------------------- in this macro invocation
    |
    = note: `mut` may be followed by `variable` and `variable @ pattern`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: cannot find macro `does_not_exist` in this scope
   --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:20:13
diff --git a/src/test/ui/parser/macro/issue-37113.stderr b/src/test/ui/parser/macro/issue-37113.stderr
index 7aadc0aa4b5..20ee9d35ec7 100644
--- a/src/test/ui/parser/macro/issue-37113.stderr
+++ b/src/test/ui/parser/macro/issue-37113.stderr
@@ -6,6 +6,8 @@ LL |             $( $t, )*
 ...
 LL |     test_macro!(String,);
    |     --------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/macro/issue-37234.stderr b/src/test/ui/parser/macro/issue-37234.stderr
index 8cef5ae3758..2db0f848f75 100644
--- a/src/test/ui/parser/macro/issue-37234.stderr
+++ b/src/test/ui/parser/macro/issue-37234.stderr
@@ -6,6 +6,8 @@ LL |         let x = 5 "";
 ...
 LL |     failed!();
    |     ---------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/macro/macro-incomplete-parse.stderr b/src/test/ui/parser/macro/macro-incomplete-parse.stderr
index 46cccba74c0..c9d220b1a27 100644
--- a/src/test/ui/parser/macro/macro-incomplete-parse.stderr
+++ b/src/test/ui/parser/macro/macro-incomplete-parse.stderr
@@ -17,6 +17,8 @@ LL |     () => ( 1,
 ...
 LL |     ignored_expr!();
    |     ---------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: macro expansion ignores token `,` and any following
   --> $DIR/macro-incomplete-parse.rs:16:14
diff --git a/src/test/ui/parser/macro/pub-item-macro.stderr b/src/test/ui/parser/macro/pub-item-macro.stderr
index ae981ac4cbe..49644cf6a0e 100644
--- a/src/test/ui/parser/macro/pub-item-macro.stderr
+++ b/src/test/ui/parser/macro/pub-item-macro.stderr
@@ -8,6 +8,7 @@ LL |     pub_x!();
    |     --------- in this macro invocation
    |
    = help: try adjusting the macro to put `pub` inside the invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0603]: static `x` is private
   --> $DIR/pub-item-macro.rs:17:23
@@ -23,6 +24,7 @@ LL |     static x: u32 = 0;
 ...
 LL |     pub_x!();
    |     --------- in this macro invocation
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/parser/macro/trait-non-item-macros.stderr b/src/test/ui/parser/macro/trait-non-item-macros.stderr
index 7647ba500e0..5a89b5b936f 100644
--- a/src/test/ui/parser/macro/trait-non-item-macros.stderr
+++ b/src/test/ui/parser/macro/trait-non-item-macros.stderr
@@ -6,6 +6,8 @@ LL |     ($a:expr) => ($a)
 ...
 LL |     bah!(2);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr
index a0e290a834d..5f4c349d7d6 100644
--- a/src/test/ui/parser/mut-patterns.stderr
+++ b/src/test/ui/parser/mut-patterns.stderr
@@ -99,6 +99,8 @@ LL |             let mut $p = 0;
 ...
 LL |     foo!(x);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 12 previous errors
 
diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr
index 50bfbcec247..0d4db74f9f4 100644
--- a/src/test/ui/parser/recover-range-pats.stderr
+++ b/src/test/ui/parser/recover-range-pats.stderr
@@ -166,6 +166,8 @@ LL |             let ...$e;
 ...
 LL |     mac!(0);
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0586]: inclusive range with no end
   --> $DIR/recover-range-pats.rs:141:19
@@ -177,6 +179,7 @@ LL |     mac!(0);
    |     -------- in this macro invocation
    |
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0586]: inclusive range with no end
   --> $DIR/recover-range-pats.rs:142:19
@@ -188,6 +191,7 @@ LL |     mac!(0);
    |     -------- in this macro invocation
    |
    = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `...` range patterns are deprecated
   --> $DIR/recover-range-pats.rs:42:13
@@ -251,6 +255,8 @@ LL |             let $e1...$e2;
 ...
 LL |     mac2!(0, 1);
    |     ------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:20:12
diff --git a/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr b/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr
index be484e3a4d4..95f6d53a9d4 100644
--- a/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr
+++ b/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr
@@ -8,6 +8,7 @@ LL |     let mk_pat!();
    |         --------- in this macro invocation
    |
    = note: only allowed in tuple, tuple struct, and slice patterns
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `..` patterns are not allowed here
   --> $DIR/rest-pat-semantic-disallowed.rs:18:9
diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.stderr b/src/test/ui/privacy/associated-item-privacy-inherent.stderr
index 6471a7914e1..88561568ea5 100644
--- a/src/test/ui/privacy/associated-item-privacy-inherent.stderr
+++ b/src/test/ui/privacy/associated-item-privacy-inherent.stderr
@@ -6,6 +6,8 @@ LL |         let value = Pub::method;
 ...
 LL |     priv_nominal::mac!();
    |     --------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
   --> $DIR/associated-item-privacy-inherent.rs:15:9
@@ -15,6 +17,8 @@ LL |         value;
 ...
 LL |     priv_nominal::mac!();
    |     --------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
   --> $DIR/associated-item-privacy-inherent.rs:17:13
@@ -24,6 +28,8 @@ LL |         Pub.method();
 ...
 LL |     priv_nominal::mac!();
    |     --------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: associated constant `CONST` is private
   --> $DIR/associated-item-privacy-inherent.rs:19:9
@@ -33,6 +39,8 @@ LL |         Pub::CONST;
 ...
 LL |     priv_nominal::mac!();
    |     --------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_signature::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:37:21
@@ -42,6 +50,8 @@ LL |         let value = Pub::method;
 ...
 LL |     priv_signature::mac!();
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_signature::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:39:9
@@ -51,6 +61,8 @@ LL |         value;
 ...
 LL |     priv_signature::mac!();
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_signature::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:41:13
@@ -60,6 +72,8 @@ LL |         Pub.method(loop {});
 ...
 LL |     priv_signature::mac!();
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:57:21
@@ -69,6 +83,8 @@ LL |         let value = Pub::method::<Priv>;
 ...
 LL |     priv_substs::mac!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:59:9
@@ -78,6 +94,8 @@ LL |         value;
 ...
 LL |     priv_substs::mac!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:61:9
@@ -87,6 +105,8 @@ LL |         Pub.method::<Priv>();
 ...
 LL |     priv_substs::mac!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:80:21
@@ -96,6 +116,8 @@ LL |         let value = <Pub>::method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:82:9
@@ -105,6 +127,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:84:21
@@ -114,6 +138,8 @@ LL |         let value = Pub::method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:86:9
@@ -123,6 +149,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:88:21
@@ -132,6 +160,8 @@ LL |         let value = <Pub>::static_method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:90:9
@@ -141,6 +171,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:92:21
@@ -150,6 +182,8 @@ LL |         let value = Pub::static_method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:94:9
@@ -159,6 +193,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:96:19
@@ -168,6 +204,8 @@ LL |         Pub(Priv).method();
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:99:10
@@ -177,6 +215,8 @@ LL |         <Pub>::CONST;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-inherent.rs:101:9
@@ -186,6 +226,8 @@ LL |         Pub::CONST;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 21 previous errors
 
diff --git a/src/test/ui/privacy/associated-item-privacy-trait.stderr b/src/test/ui/privacy/associated-item-privacy-trait.stderr
index 5cf1be82937..ac422e99855 100644
--- a/src/test/ui/privacy/associated-item-privacy-trait.stderr
+++ b/src/test/ui/privacy/associated-item-privacy-trait.stderr
@@ -6,6 +6,8 @@ LL |         let value = <Pub as PrivTr>::method;
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as priv_trait::PrivTr>::method}` is private
   --> $DIR/associated-item-privacy-trait.rs:19:9
@@ -15,6 +17,8 @@ LL |         value;
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `for<'r> fn(&'r Self) {<Self as priv_trait::PrivTr>::method}` is private
   --> $DIR/associated-item-privacy-trait.rs:21:13
@@ -24,6 +28,8 @@ LL |         Pub.method();
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: associated constant `PrivTr::CONST` is private
   --> $DIR/associated-item-privacy-trait.rs:23:9
@@ -33,6 +39,8 @@ LL |         <Pub as PrivTr>::CONST;
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-trait.rs:25:13
@@ -42,6 +50,8 @@ LL |         let _: <Pub as PrivTr>::AssocTy;
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-trait.rs:25:16
@@ -51,6 +61,8 @@ LL |         let _: <Pub as PrivTr>::AssocTy;
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-trait.rs:28:34
@@ -60,6 +72,8 @@ LL |         pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-trait.rs:30:34
@@ -69,6 +83,8 @@ LL |         pub trait InSignatureTr: PrivTr {}
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-trait.rs:32:14
@@ -78,6 +94,8 @@ LL |         impl PrivTr for u8 {}
 ...
 LL |     priv_trait::mac!();
    |     ------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_signature::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:49:21
@@ -87,6 +105,8 @@ LL |         let value = <Pub as PubTr>::method;
 ...
 LL |     priv_signature::mac!();
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_signature::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:51:9
@@ -96,6 +116,8 @@ LL |         value;
 ...
 LL |     priv_signature::mac!();
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_signature::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:53:13
@@ -105,6 +127,8 @@ LL |         Pub.method(loop {});
 ...
 LL |     priv_signature::mac!();
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:70:21
@@ -114,6 +138,8 @@ LL |         let value = <Pub as PubTr>::method::<Priv>;
 ...
 LL |     priv_substs::mac!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:72:9
@@ -123,6 +149,8 @@ LL |         value;
 ...
 LL |     priv_substs::mac!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:74:9
@@ -132,6 +160,8 @@ LL |         Pub.method::<Priv>();
 ...
 LL |     priv_substs::mac!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:94:21
@@ -141,6 +171,8 @@ LL |         let value = <Pub as PubTr>::method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:96:9
@@ -150,6 +182,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:98:21
@@ -159,6 +193,8 @@ LL |         let value = <Pub as PubTr<_>>::method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:100:9
@@ -168,6 +204,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:102:9
@@ -177,6 +215,8 @@ LL |         Pub.method();
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:105:21
@@ -186,6 +226,8 @@ LL |         let value = <Priv as PubTr<_>>::method;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:107:9
@@ -195,6 +237,8 @@ LL |         value;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:109:9
@@ -204,6 +248,8 @@ LL |         Priv.method();
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:112:9
@@ -213,6 +259,8 @@ LL |         <Pub as PubTr>::CONST;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:114:9
@@ -222,6 +270,8 @@ LL |         <Pub as PubTr<_>>::CONST;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:116:9
@@ -231,6 +281,8 @@ LL |         <Priv as PubTr<_>>::CONST;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:119:13
@@ -240,6 +292,8 @@ LL |         let _: <Pub as PubTr>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:119:16
@@ -249,6 +303,8 @@ LL |         let _: <Pub as PubTr>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:122:13
@@ -258,6 +314,8 @@ LL |         let _: <Pub as PubTr<_>>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:122:16
@@ -267,6 +325,8 @@ LL |         let _: <Pub as PubTr<_>>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:125:13
@@ -276,6 +336,8 @@ LL |         let _: <Priv as PubTr<_>>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:125:16
@@ -285,6 +347,8 @@ LL |         let _: <Priv as PubTr<_>>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:129:35
@@ -294,6 +358,8 @@ LL |         pub type InSignatureTy1 = <Pub as PubTr>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:131:35
@@ -303,6 +369,8 @@ LL |         pub type InSignatureTy2 = <Priv as PubTr<Pub>>::AssocTy;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-trait.rs:133:14
@@ -312,6 +380,8 @@ LL |         impl PubTr for u8 {}
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 35 previous errors
 
diff --git a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr
index 7f6886d7f9a..5afa286b85f 100644
--- a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr
+++ b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr
@@ -6,6 +6,8 @@ LL |         let _: Box<PubTr<AssocTy = u8>>;
 ...
 LL |     priv_trait::mac1!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:11:16
@@ -15,6 +17,8 @@ LL |         let _: Box<PubTr<AssocTy = u8>>;
 ...
 LL |     priv_trait::mac1!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:14:31
@@ -24,6 +28,8 @@ LL |         type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
 ...
 LL |     priv_trait::mac1!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:16:31
@@ -33,6 +39,8 @@ LL |         trait InSignatureTr2: PubTr<AssocTy = u8> {}
 ...
 LL |     priv_trait::mac1!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:20:13
@@ -42,6 +50,8 @@ LL |         let _: Box<PrivTr<AssocTy = u8>>;
 ...
 LL |     priv_trait::mac2!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:20:16
@@ -51,6 +61,8 @@ LL |         let _: Box<PrivTr<AssocTy = u8>>;
 ...
 LL |     priv_trait::mac2!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:23:31
@@ -60,6 +72,8 @@ LL |         type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
 ...
 LL |     priv_trait::mac2!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `priv_trait::PrivTr` is private
   --> $DIR/associated-item-privacy-type-binding.rs:25:31
@@ -69,6 +83,8 @@ LL |         trait InSignatureTr1: PrivTr<AssocTy = u8> {}
 ...
 LL |     priv_trait::mac2!();
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:44:13
@@ -78,6 +94,8 @@ LL |         let _: Box<PubTrWithParam<AssocTy = u8>>;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:44:16
@@ -87,6 +105,8 @@ LL |         let _: Box<PubTrWithParam<AssocTy = u8>>;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:47:13
@@ -96,6 +116,8 @@ LL |         let _: Box<PubTr<AssocTy = u8>>;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:47:16
@@ -105,6 +127,8 @@ LL |         let _: Box<PubTr<AssocTy = u8>>;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:50:35
@@ -114,6 +138,8 @@ LL |         pub type InSignatureTy1 = Box<PubTrWithParam<AssocTy = u8>>;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:52:35
@@ -123,6 +149,8 @@ LL |         pub type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:54:31
@@ -132,6 +160,8 @@ LL |         trait InSignatureTr1: PubTrWithParam<AssocTy = u8> {}
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `priv_parent_substs::Priv` is private
   --> $DIR/associated-item-privacy-type-binding.rs:56:31
@@ -141,6 +171,8 @@ LL |         trait InSignatureTr2: PubTr<AssocTy = u8> {}
 ...
 LL |     priv_parent_substs::mac!();
    |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 16 previous errors
 
diff --git a/src/test/ui/privacy/private-inferred-type-3.stderr b/src/test/ui/privacy/private-inferred-type-3.stderr
index 61cd8476297..376f1334ff8 100644
--- a/src/test/ui/privacy/private-inferred-type-3.stderr
+++ b/src/test/ui/privacy/private-inferred-type-3.stderr
@@ -4,7 +4,7 @@ error: type `fn() {ext::priv_fn}` is private
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: static `PRIV_STATIC` is private
   --> $DIR/private-inferred-type-3.rs:16:5
@@ -12,7 +12,7 @@ error: static `PRIV_STATIC` is private
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `ext::PrivEnum` is private
   --> $DIR/private-inferred-type-3.rs:16:5
@@ -20,7 +20,7 @@ error: type `ext::PrivEnum` is private
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `fn() {<u8 as ext::PrivTrait>::method}` is private
   --> $DIR/private-inferred-type-3.rs:16:5
@@ -28,7 +28,7 @@ error: type `fn() {<u8 as ext::PrivTrait>::method}` is private
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
   --> $DIR/private-inferred-type-3.rs:16:5
@@ -36,7 +36,7 @@ error: type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct}` is private
   --> $DIR/private-inferred-type-3.rs:16:5
@@ -44,7 +44,7 @@ error: type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct}` is private
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `for<'r> fn(&'r ext::Pub<u8>) {ext::Pub::<u8>::priv_method}` is private
   --> $DIR/private-inferred-type-3.rs:16:5
@@ -52,7 +52,7 @@ error: type `for<'r> fn(&'r ext::Pub<u8>) {ext::Pub::<u8>::priv_method}` is priv
 LL |     ext::m!();
    |     ^^^^^^^^^^
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 7 previous errors
 
diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr
index 4d40b6b7cab..48c83c21865 100644
--- a/src/test/ui/privacy/private-inferred-type.stderr
+++ b/src/test/ui/privacy/private-inferred-type.stderr
@@ -114,6 +114,8 @@ LL |         priv_fn;
 ...
 LL |     m::m!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `m::PrivEnum` is private
   --> $DIR/private-inferred-type.rs:41:9
@@ -123,6 +125,8 @@ LL |         PrivEnum::Variant;
 ...
 LL |     m::m!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `fn() {<u8 as m::PrivTrait>::method}` is private
   --> $DIR/private-inferred-type.rs:43:9
@@ -132,6 +136,8 @@ LL |         <u8 as PrivTrait>::method;
 ...
 LL |     m::m!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `fn(u8) -> m::PrivTupleStruct {m::PrivTupleStruct}` is private
   --> $DIR/private-inferred-type.rs:45:9
@@ -141,6 +147,8 @@ LL |         PrivTupleStruct;
 ...
 LL |     m::m!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct}` is private
   --> $DIR/private-inferred-type.rs:47:9
@@ -150,6 +158,8 @@ LL |         PubTupleStruct;
 ...
 LL |     m::m!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: type `for<'r> fn(&'r m::Pub<u8>) {m::Pub::<u8>::priv_method}` is private
   --> $DIR/private-inferred-type.rs:49:18
@@ -159,6 +169,8 @@ LL |         Pub(0u8).priv_method();
 ...
 LL |     m::m!();
    |     -------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: trait `m::Trait` is private
   --> $DIR/private-inferred-type.rs:118:5
diff --git a/src/test/ui/proc-macro/derive-bad.stderr b/src/test/ui/proc-macro/derive-bad.stderr
index 93908150b6c..8667396c989 100644
--- a/src/test/ui/proc-macro/derive-bad.stderr
+++ b/src/test/ui/proc-macro/derive-bad.stderr
@@ -3,6 +3,8 @@ error: expected `:`, found `}`
    |
 LL |     A
    |     ^ expected `:`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: proc-macro derive produced unparseable tokens
   --> $DIR/derive-bad.rs:7:5
diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr
index 76434860a49..f82f49aa775 100644
--- a/src/test/ui/proc-macro/derive-helper-shadowing.stderr
+++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr
@@ -15,6 +15,8 @@ error: cannot find attribute `empty_helper` in this scope
    |
 LL |             #[derive(GenHelperUse)]
    |                      ^^^^^^^^^^^^
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: cannot find attribute `empty_helper` in this scope
   --> $DIR/derive-helper-shadowing.rs:14:11
@@ -24,6 +26,8 @@ LL |         #[empty_helper]
 ...
 LL |             gen_helper_use!();
    |             ------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0659]: `empty_helper` is ambiguous (name vs any other name during import resolution)
   --> $DIR/derive-helper-shadowing.rs:24:13
diff --git a/src/test/ui/proc-macro/dollar-crate.stderr b/src/test/ui/proc-macro/dollar-crate.stderr
index 5d78a8e1987..465f242580d 100644
--- a/src/test/ui/proc-macro/dollar-crate.stderr
+++ b/src/test/ui/proc-macro/dollar-crate.stderr
@@ -11,6 +11,7 @@ LL |     local!();
    |     --------- in this macro invocation
    |
    = note: `D` must be defined only once in the type namespace of this module
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0428]: the name `D` is defined multiple times
   --> $DIR/dollar-crate.rs:36:5
@@ -22,7 +23,7 @@ LL |     dollar_crate_external::external!();
    |     previous definition of the type `D` here
    |
    = note: `D` must be defined only once in the type namespace of this module
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr
index 5b6184afacd..ac75367d7ff 100644
--- a/src/test/ui/proc-macro/expand-to-unstable-2.stderr
+++ b/src/test/ui/proc-macro/expand-to-unstable-2.stderr
@@ -6,6 +6,7 @@ LL | #[derive(Unstable)]
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/expand-to-unstable.stderr b/src/test/ui/proc-macro/expand-to-unstable.stderr
index 6df00765866..fdbf80f9b33 100644
--- a/src/test/ui/proc-macro/expand-to-unstable.stderr
+++ b/src/test/ui/proc-macro/expand-to-unstable.stderr
@@ -5,6 +5,7 @@ LL | #[derive(Unstable)]
    |          ^^^^^^^^
    |
    = help: add `#![feature(core_intrinsics)]` to the crate attributes to enable
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/gen-macro-rules-hygiene.stderr b/src/test/ui/proc-macro/gen-macro-rules-hygiene.stderr
index ecebdfa9656..b65fc739e09 100644
--- a/src/test/ui/proc-macro/gen-macro-rules-hygiene.stderr
+++ b/src/test/ui/proc-macro/gen-macro-rules-hygiene.stderr
@@ -6,6 +6,8 @@ LL | gen_macro_rules!();
 ...
 LL |         generated!();
    |         ------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `local_use` in this scope
   --> $DIR/gen-macro-rules-hygiene.rs:12:1
@@ -15,6 +17,8 @@ LL | gen_macro_rules!();
 ...
 LL |         generated!();
    |         ------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `local_def` in this scope
   --> $DIR/gen-macro-rules-hygiene.rs:21:9
diff --git a/src/test/ui/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr
index fe53fb242f4..d2390972634 100644
--- a/src/test/ui/proc-macro/generate-mod.stderr
+++ b/src/test/ui/proc-macro/generate-mod.stderr
@@ -2,25 +2,21 @@ error[E0412]: cannot find type `FromOutside` in this scope
   --> $DIR/generate-mod.rs:9:1
    |
 LL | generate_mod::check!();
-   | ^^^^^^^^^^^^^^^^^^^^^^^
-   | |
-   | not found in this scope
-   | in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
    = note: possible candidate is found in another module, you can import it into scope:
            FromOutside
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `Outer` in this scope
   --> $DIR/generate-mod.rs:9:1
    |
 LL | generate_mod::check!();
-   | ^^^^^^^^^^^^^^^^^^^^^^^
-   | |
-   | not found in this scope
-   | in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
    = note: possible candidate is found in another module, you can import it into scope:
            Outer
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `FromOutside` in this scope
   --> $DIR/generate-mod.rs:12:1
@@ -30,6 +26,7 @@ LL | #[generate_mod::check_attr]
    |
    = note: possible candidate is found in another module, you can import it into scope:
            FromOutside
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `OuterAttr` in this scope
   --> $DIR/generate-mod.rs:12:1
@@ -39,6 +36,7 @@ LL | #[generate_mod::check_attr]
    |
    = note: possible candidate is found in another module, you can import it into scope:
            OuterAttr
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: cannot find type `FromOutside` in this scope
   --> $DIR/generate-mod.rs:16:10
diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr
index e7764004e8d..fe3e55b31be 100644
--- a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr
+++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr
@@ -2,10 +2,9 @@ error: unexpected closing delimiter: `)`
   --> $DIR/invalid-punct-ident-4.rs:6:1
    |
 LL | lexer_failure!();
-   | ^^^^^^^^^^^^^^^^^
-   | |
-   | unexpected closing delimiter
-   | in this macro invocation
+   | ^^^^^^^^^^^^^^^^^ unexpected closing delimiter
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: proc macro panicked
   --> $DIR/invalid-punct-ident-4.rs:6:1
diff --git a/src/test/ui/proc-macro/issue-38586.stderr b/src/test/ui/proc-macro/issue-38586.stderr
index 2584e0c62ee..4cdca5c8e01 100644
--- a/src/test/ui/proc-macro/issue-38586.stderr
+++ b/src/test/ui/proc-macro/issue-38586.stderr
@@ -3,6 +3,8 @@ error[E0425]: cannot find value `foo` in this scope
    |
 LL | #[derive(A)]
    |          ^ not found in this scope
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/issue-50493.stderr b/src/test/ui/proc-macro/issue-50493.stderr
index 56c78001021..7997786b50b 100644
--- a/src/test/ui/proc-macro/issue-50493.stderr
+++ b/src/test/ui/proc-macro/issue-50493.stderr
@@ -9,12 +9,16 @@ error[E0616]: field `field` of struct `Restricted` is private
    |
 LL | #[derive(Derive)]
    |          ^^^^^^
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0616]: field `field` of struct `Restricted` is private
   --> $DIR/issue-50493.rs:6:10
    |
 LL | #[derive(Derive)]
    |          ^^^^^^
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr b/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr
index e0a3caef9db..5995a4891f3 100644
--- a/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr
+++ b/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr
@@ -3,6 +3,8 @@ error: expected crate top-level item to be a module after macro expansion, found
    |
 LL | #![issue_59191::no_main]
    | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0601]: `main` function not found in crate `issue_59191_replace_root_with_fn`
   --> $DIR/issue-59191-replace-root-with-fn.rs:5:1
diff --git a/src/test/ui/proc-macro/lints_in_proc_macros.stderr b/src/test/ui/proc-macro/lints_in_proc_macros.stderr
index f28b8c9fb73..df9d7e1efe3 100644
--- a/src/test/ui/proc-macro/lints_in_proc_macros.stderr
+++ b/src/test/ui/proc-macro/lints_in_proc_macros.stderr
@@ -2,10 +2,9 @@ error[E0425]: cannot find value `foobar2` in this scope
   --> $DIR/lints_in_proc_macros.rs:12:5
    |
 LL |     bang_proc_macro2!();
-   |     ^^^^^^^^^^^^^^^^^^^^
-   |     |
-   |     help: a local variable with a similar name exists: `foobar`
-   |     in this macro invocation
+   |     ^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `foobar`
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr
index 54d10fe0d90..c344147ed93 100644
--- a/src/test/ui/proc-macro/mixed-site-span.stderr
+++ b/src/test/ui/proc-macro/mixed-site-span.stderr
@@ -2,19 +2,17 @@ error[E0426]: use of undeclared label `'label_use`
   --> $DIR/mixed-site-span.rs:15:9
    |
 LL |         proc_macro_rules!();
-   |         ^^^^^^^^^^^^^^^^^^^^
-   |         |
-   |         undeclared label `'label_use`
-   |         in this macro invocation
+   |         ^^^^^^^^^^^^^^^^^^^^ undeclared label `'label_use`
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `local_use` in this scope
   --> $DIR/mixed-site-span.rs:15:9
    |
 LL |         proc_macro_rules!();
-   |         ^^^^^^^^^^^^^^^^^^^^
-   |         |
-   |         not found in this scope
-   |         in this macro invocation
+   |         ^^^^^^^^^^^^^^^^^^^^ not found in this scope
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `local_def` in this scope
   --> $DIR/mixed-site-span.rs:19:9
@@ -39,6 +37,7 @@ LL | | }
 LL |   pass_dollar_crate!();
    |   --------------------- in this macro invocation
    |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 help: possible candidate is found in another module, you can import it into scope
    |
 LL | use ItemUse;
diff --git a/src/test/ui/proc-macro/multispan.stderr b/src/test/ui/proc-macro/multispan.stderr
index e7f705c7feb..c9390a04b9e 100644
--- a/src/test/ui/proc-macro/multispan.stderr
+++ b/src/test/ui/proc-macro/multispan.stderr
@@ -20,6 +20,7 @@ note: found these 'hi's
    |
 LL |     hello!(hi);
    |            ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hello to you, too!
   --> $DIR/auxiliary/multispan.rs:31:1
@@ -43,6 +44,7 @@ note: found these 'hi's
    |
 LL |     hello!(hi hi);
    |            ^^ ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hello to you, too!
   --> $DIR/auxiliary/multispan.rs:31:1
@@ -66,6 +68,7 @@ note: found these 'hi's
    |
 LL |     hello!(hi hi hi);
    |            ^^ ^^ ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hello to you, too!
   --> $DIR/auxiliary/multispan.rs:31:1
@@ -89,6 +92,7 @@ note: found these 'hi's
    |
 LL |     hello!(hi hey hi yo hi beep beep hi hi);
    |            ^^     ^^    ^^           ^^ ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hello to you, too!
   --> $DIR/auxiliary/multispan.rs:31:1
@@ -112,6 +116,7 @@ note: found these 'hi's
    |
 LL |     hello!(hi there, hi how are you? hi... hi.);
    |            ^^        ^^              ^^    ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hello to you, too!
   --> $DIR/auxiliary/multispan.rs:31:1
@@ -135,6 +140,7 @@ note: found these 'hi's
    |
 LL |     hello!(whoah. hi di hi di ho);
    |                   ^^    ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: hello to you, too!
   --> $DIR/auxiliary/multispan.rs:31:1
@@ -158,6 +164,7 @@ note: found these 'hi's
    |
 LL |     hello!(hi good hi and good bye);
    |            ^^      ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 7 previous errors
 
diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr
index 9f0fefcfe6c..254f87751fd 100644
--- a/src/test/ui/proc-macro/parent-source-spans.stderr
+++ b/src/test/ui/proc-macro/parent-source-spans.stderr
@@ -6,6 +6,8 @@ LL |     three!($a, $b);
 ...
 LL |     one!("hello", "world");
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: second final: "world"
   --> $DIR/parent-source-spans.rs:19:16
@@ -15,6 +17,8 @@ LL |     three!($a, $b);
 ...
 LL |     one!("hello", "world");
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: first parent: "hello"
   --> $DIR/parent-source-spans.rs:13:5
@@ -24,6 +28,8 @@ LL |     two!($a, $b);
 ...
 LL |     one!("hello", "world");
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: second parent: "world"
   --> $DIR/parent-source-spans.rs:13:5
@@ -33,6 +39,8 @@ LL |     two!($a, $b);
 ...
 LL |     one!("hello", "world");
    |     ----------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: first grandparent: "hello"
   --> $DIR/parent-source-spans.rs:39:5
@@ -66,6 +74,8 @@ LL |     three!($a, $b);
 ...
 LL |     two!("yay", "rust");
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: second final: "rust"
   --> $DIR/parent-source-spans.rs:19:16
@@ -75,6 +85,8 @@ LL |     three!($a, $b);
 ...
 LL |     two!("yay", "rust");
    |     -------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: first parent: "yay"
   --> $DIR/parent-source-spans.rs:45:5
@@ -137,6 +149,8 @@ LL |     one!("hello", "world");
    |
 LL |     Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     --------------------------------------------------- similarly named tuple variant `Ok` defined here
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `ok` in this scope
   --> $DIR/parent-source-spans.rs:32:5
@@ -151,6 +165,8 @@ LL |     two!("yay", "rust");
    |
 LL |     Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     --------------------------------------------------- similarly named tuple variant `Ok` defined here
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0425]: cannot find value `ok` in this scope
   --> $DIR/parent-source-spans.rs:32:5
@@ -165,6 +181,8 @@ LL |     three!("hip", "hop");
    |
 LL |     Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     --------------------------------------------------- similarly named tuple variant `Ok` defined here
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 21 previous errors
 
diff --git a/src/test/ui/proc-macro/subspan.stderr b/src/test/ui/proc-macro/subspan.stderr
index 06715c197bc..c82c2dee676 100644
--- a/src/test/ui/proc-macro/subspan.stderr
+++ b/src/test/ui/proc-macro/subspan.stderr
@@ -2,97 +2,105 @@ error: found 'hi's
   --> $DIR/subspan.rs:11:1
    |
 LL | subspan!("hi");
-   | ^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:11:11
    |
 LL | subspan!("hi");
    |           ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:14:1
    |
 LL | subspan!("hihi");
-   | ^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:14:11
    |
 LL | subspan!("hihi");
    |           ^^^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:17:1
    |
 LL | subspan!("hihihi");
-   | ^^^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:17:11
    |
 LL | subspan!("hihihi");
    |           ^^^^^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:20:1
    |
 LL | subspan!("why I hide? hi!");
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:20:17
    |
 LL | subspan!("why I hide? hi!");
    |                 ^^    ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:21:1
    |
 LL | subspan!("hey, hi, hidy, hidy, hi hi");
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:21:16
    |
 LL | subspan!("hey, hi, hidy, hidy, hi hi");
    |                ^^  ^^    ^^    ^^ ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:22:1
    |
 LL | subspan!("this is a hi, and this is another hi");
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:22:12
    |
 LL | subspan!("this is a hi, and this is another hi");
    |            ^^       ^^       ^^             ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:23:1
    |
 LL | subspan!("how are you this evening");
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:23:24
    |
 LL | subspan!("how are you this evening");
    |                        ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: found 'hi's
   --> $DIR/subspan.rs:24:1
    |
 LL | subspan!("this is highly eradic");
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: here
   --> $DIR/subspan.rs:24:12
    |
 LL | subspan!("this is highly eradic");
    |            ^^     ^^
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 8 previous errors
 
diff --git a/src/test/ui/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr
index 0698b0f4754..82c4167262f 100644
--- a/src/test/ui/proc-macro/three-equals.stderr
+++ b/src/test/ui/proc-macro/three-equals.stderr
@@ -16,6 +16,7 @@ LL |       three_equals!(==);
    |       ------------------ in this macro invocation
    |
    = help: input must be: `===`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected EOF, found `=`.
   --> $DIR/three-equals.rs:18:21
diff --git a/src/test/ui/range/range_traits-1.stderr b/src/test/ui/range/range_traits-1.stderr
index f60ec23bdb0..0e1da3d3f76 100644
--- a/src/test/ui/range/range_traits-1.stderr
+++ b/src/test/ui/range/range_traits-1.stderr
@@ -6,6 +6,7 @@ LL |     a: Range<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::Range<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
   --> $DIR/range_traits-1.rs:12:5
@@ -15,6 +16,7 @@ LL |     b: RangeTo<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
   --> $DIR/range_traits-1.rs:19:5
@@ -24,6 +26,7 @@ LL |     c: RangeFrom<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
   --> $DIR/range_traits-1.rs:26:5
@@ -33,6 +36,7 @@ LL |     d: RangeFull,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFull`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
   --> $DIR/range_traits-1.rs:33:5
@@ -42,6 +46,7 @@ LL |     e: RangeInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
   --> $DIR/range_traits-1.rs:40:5
@@ -51,6 +56,7 @@ LL |     f: RangeToInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::Range<usize>` with `std::ops::Range<usize>`
   --> $DIR/range_traits-1.rs:5:5
@@ -60,6 +66,7 @@ LL |     a: Range<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::Range<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
   --> $DIR/range_traits-1.rs:12:5
@@ -69,6 +76,7 @@ LL |     b: RangeTo<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
   --> $DIR/range_traits-1.rs:19:5
@@ -78,6 +86,7 @@ LL |     c: RangeFrom<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
   --> $DIR/range_traits-1.rs:26:5
@@ -87,6 +96,7 @@ LL |     d: RangeFull,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFull`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
   --> $DIR/range_traits-1.rs:33:5
@@ -96,6 +106,7 @@ LL |     e: RangeInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
   --> $DIR/range_traits-1.rs:40:5
@@ -105,6 +116,7 @@ LL |     f: RangeToInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::Range<usize>` with `std::ops::Range<usize>`
   --> $DIR/range_traits-1.rs:5:5
@@ -114,6 +126,7 @@ LL |     a: Range<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::Range<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
   --> $DIR/range_traits-1.rs:12:5
@@ -123,6 +136,7 @@ LL |     b: RangeTo<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
   --> $DIR/range_traits-1.rs:19:5
@@ -132,6 +146,7 @@ LL |     c: RangeFrom<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
   --> $DIR/range_traits-1.rs:26:5
@@ -141,6 +156,7 @@ LL |     d: RangeFull,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFull`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
   --> $DIR/range_traits-1.rs:33:5
@@ -150,6 +166,7 @@ LL |     e: RangeInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
   --> $DIR/range_traits-1.rs:40:5
@@ -159,6 +176,7 @@ LL |     f: RangeToInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::Range<usize>` with `std::ops::Range<usize>`
   --> $DIR/range_traits-1.rs:5:5
@@ -168,6 +186,7 @@ LL |     a: Range<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::Range<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
   --> $DIR/range_traits-1.rs:12:5
@@ -177,6 +196,7 @@ LL |     b: RangeTo<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
   --> $DIR/range_traits-1.rs:19:5
@@ -186,6 +206,7 @@ LL |     c: RangeFrom<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
   --> $DIR/range_traits-1.rs:26:5
@@ -195,6 +216,7 @@ LL |     d: RangeFull,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFull`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
   --> $DIR/range_traits-1.rs:33:5
@@ -204,6 +226,7 @@ LL |     e: RangeInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
   --> $DIR/range_traits-1.rs:40:5
@@ -213,6 +236,7 @@ LL |     f: RangeToInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::Range<usize>` with `std::ops::Range<usize>`
   --> $DIR/range_traits-1.rs:5:5
@@ -222,6 +246,7 @@ LL |     a: Range<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::Range<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
   --> $DIR/range_traits-1.rs:12:5
@@ -231,6 +256,7 @@ LL |     b: RangeTo<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
   --> $DIR/range_traits-1.rs:19:5
@@ -240,6 +266,7 @@ LL |     c: RangeFrom<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
   --> $DIR/range_traits-1.rs:26:5
@@ -249,6 +276,7 @@ LL |     d: RangeFull,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFull`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
   --> $DIR/range_traits-1.rs:33:5
@@ -258,6 +286,7 @@ LL |     e: RangeInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
   --> $DIR/range_traits-1.rs:40:5
@@ -267,6 +296,7 @@ LL |     f: RangeToInclusive<usize>,
    |
    = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
    = note: required by `std::cmp::PartialOrd::partial_cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::Range<usize>: std::cmp::Ord` is not satisfied
   --> $DIR/range_traits-1.rs:5:5
@@ -275,6 +305,7 @@ LL |     a: Range<usize>,
    |     ^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::Range<usize>`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeTo<usize>: std::cmp::Ord` is not satisfied
   --> $DIR/range_traits-1.rs:12:5
@@ -283,6 +314,7 @@ LL |     b: RangeTo<usize>,
    |     ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeTo<usize>`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeFrom<usize>: std::cmp::Ord` is not satisfied
   --> $DIR/range_traits-1.rs:19:5
@@ -291,6 +323,7 @@ LL |     c: RangeFrom<usize>,
    |     ^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeFrom<usize>`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeFull: std::cmp::Ord` is not satisfied
   --> $DIR/range_traits-1.rs:26:5
@@ -299,6 +332,7 @@ LL |     d: RangeFull,
    |     ^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeFull`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeInclusive<usize>: std::cmp::Ord` is not satisfied
   --> $DIR/range_traits-1.rs:33:5
@@ -307,6 +341,7 @@ LL |     e: RangeInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeInclusive<usize>`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeToInclusive<usize>: std::cmp::Ord` is not satisfied
   --> $DIR/range_traits-1.rs:40:5
@@ -315,6 +350,7 @@ LL |     f: RangeToInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeToInclusive<usize>`
    |
    = note: required by `std::cmp::Ord::cmp`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 36 previous errors
 
diff --git a/src/test/ui/range/range_traits-2.stderr b/src/test/ui/range/range_traits-2.stderr
index 598a0b3ed03..8a9d15f0999 100644
--- a/src/test/ui/range/range_traits-2.stderr
+++ b/src/test/ui/range/range_traits-2.stderr
@@ -5,6 +5,8 @@ LL | #[derive(Copy, Clone)]
    |          ^^^^
 LL | struct R(Range<usize>);
    |          ------------ this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/range/range_traits-3.stderr b/src/test/ui/range/range_traits-3.stderr
index e2713a2bd5e..14fda58e1f8 100644
--- a/src/test/ui/range/range_traits-3.stderr
+++ b/src/test/ui/range/range_traits-3.stderr
@@ -5,6 +5,8 @@ LL | #[derive(Copy, Clone)]
    |          ^^^^
 LL | struct R(RangeFrom<usize>);
    |          ---------------- this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/range/range_traits-6.stderr b/src/test/ui/range/range_traits-6.stderr
index 226d72ce026..693600cdce4 100644
--- a/src/test/ui/range/range_traits-6.stderr
+++ b/src/test/ui/range/range_traits-6.stderr
@@ -5,6 +5,8 @@ LL | #[derive(Copy, Clone)]
    |          ^^^^
 LL | struct R(RangeInclusive<usize>);
    |          --------------------- this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/reachable/expr_again.stderr b/src/test/ui/reachable/expr_again.stderr
index a9b5832ba2c..130fd8535e0 100644
--- a/src/test/ui/reachable/expr_again.stderr
+++ b/src/test/ui/reachable/expr_again.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![deny(unreachable_code)]
    |         ^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/reachable/expr_block.stderr b/src/test/ui/reachable/expr_block.stderr
index 8b696b7abcb..154734b0f69 100644
--- a/src/test/ui/reachable/expr_block.stderr
+++ b/src/test/ui/reachable/expr_block.stderr
@@ -20,7 +20,7 @@ LL |         return;
 LL |         println!("foo");
    |         ^^^^^^^^^^^^^^^^ unreachable statement
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/reachable/expr_if.stderr b/src/test/ui/reachable/expr_if.stderr
index 6ae635ae4b7..850570d0564 100644
--- a/src/test/ui/reachable/expr_if.stderr
+++ b/src/test/ui/reachable/expr_if.stderr
@@ -24,7 +24,7 @@ LL |         return;
 LL |     println!("But I am.");
    |     ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/reachable/expr_loop.stderr b/src/test/ui/reachable/expr_loop.stderr
index e5d395254a0..fe7d7782edf 100644
--- a/src/test/ui/reachable/expr_loop.stderr
+++ b/src/test/ui/reachable/expr_loop.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![deny(unreachable_code)]
    |         ^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unreachable statement
   --> $DIR/expr_loop.rs:21:5
@@ -21,7 +21,7 @@ LL |     loop { return; }
 LL |     println!("I am dead.");
    |     ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unreachable statement
   --> $DIR/expr_loop.rs:32:5
@@ -31,7 +31,7 @@ LL |     loop { 'middle: loop { loop { break 'middle; } } }
 LL |     println!("I am dead.");
    |     ^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/reachable/expr_match.stderr b/src/test/ui/reachable/expr_match.stderr
index a8317192c2b..a1c396e0c61 100644
--- a/src/test/ui/reachable/expr_match.stderr
+++ b/src/test/ui/reachable/expr_match.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![deny(unreachable_code)]
    |         ^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unreachable statement
   --> $DIR/expr_match.rs:19:5
@@ -21,7 +21,7 @@ LL |     match () { () if false => return, () => return }
 LL |     println!("I am dead");
    |     ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.stderr
index 146fb8fd81f..d9571767685 100644
--- a/src/test/ui/regions/regions-var-type-out-of-scope.stderr
+++ b/src/test/ui/regions/regions-var-type-out-of-scope.stderr
@@ -9,7 +9,6 @@ LL |         assert_eq!(*x, 3);
    |         ------------------ borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr
index ed4f34b527f..d4bd760770d 100644
--- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr
+++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr
@@ -12,6 +12,7 @@ LL |   pub fn assert_test_result<T: Termination>(result: T) {
    |                                ----------- required by this bound in `test::assert_test_result`
    |
    = help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseFloatError>`
+   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
index 5f0b3a1d40b..5611b5f4ece 100644
--- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
+++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
@@ -7,8 +7,6 @@ LL |     let _ = dbg!(a);
    |             ------- value moved here
 LL |     let _ = dbg!(a);
    |                  ^ value used here after move
-   |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr
index ecab673953d..799a05bf7e8 100644
--- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr
+++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr
@@ -8,7 +8,7 @@ LL |     let _: NotDebug = dbg!(NotDebug);
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&NotDebug`
    = note: required by `std::fmt::Debug::fmt`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
index 8495fe62575..30f98d6df9e 100644
--- a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
+++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr
@@ -12,6 +12,7 @@ LL | #![warn(rust_2018_compatibility)]
    = note: `#[warn(absolute_paths_not_starting_with_crate)]` implied by `#[warn(rust_2018_compatibility)]`
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
    = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+   = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
   --> $DIR/suggestions-not-always-applicable.rs:17:5
@@ -21,4 +22,5 @@ LL |     #[foo]
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
    = note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+   = note: this warning originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
index 27b8d0e216e..14c2582121b 100644
--- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
@@ -17,6 +17,7 @@ LL | |             }
 LL |       m!();
    |       ----- in this macro invocation
    = help: use `self::std` to refer to this module unambiguously
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
index 44b34d2682d..de7b79de95c 100644
--- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
@@ -17,6 +17,7 @@ LL | |         }
 LL |   m!();
    |   ----- in this macro invocation
    = help: use `crate::std` to refer to this module unambiguously
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/sanitize-inline-always.rs b/src/test/ui/sanitize-inline-always.rs
new file mode 100644
index 00000000000..52dc5578180
--- /dev/null
+++ b/src/test/ui/sanitize-inline-always.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+#![feature(no_sanitize)]
+
+#[inline(always)]
+//~^ NOTE inlining requested here
+#[no_sanitize(address)]
+//~^ WARN will have no effect after inlining
+//~| NOTE on by default
+fn x() {
+}
+
+fn main() {
+    x()
+}
diff --git a/src/test/ui/sanitize-inline-always.stderr b/src/test/ui/sanitize-inline-always.stderr
new file mode 100644
index 00000000000..50b9474baa2
--- /dev/null
+++ b/src/test/ui/sanitize-inline-always.stderr
@@ -0,0 +1,13 @@
+warning: `no_sanitize` will have no effect after inlining
+  --> $DIR/sanitize-inline-always.rs:7:1
+   |
+LL | #[no_sanitize(address)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(inline_no_sanitize)]` on by default
+note: inlining requested here
+  --> $DIR/sanitize-inline-always.rs:5:1
+   |
+LL | #[inline(always)]
+   | ^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr
index 5a981a4a6e4..23c9513f9cc 100644
--- a/src/test/ui/span/E0204.stderr
+++ b/src/test/ui/span/E0204.stderr
@@ -15,6 +15,8 @@ LL | #[derive(Copy)]
 LL | struct Foo2<'a> {
 LL |     ty: &'a mut bool,
    |     ---------------- this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0204]: the trait `Copy` may not be implemented for this type
   --> $DIR/E0204.rs:17:6
@@ -33,6 +35,8 @@ LL | #[derive(Copy)]
 LL | enum EFoo2<'a> {
 LL |     Bar(&'a mut bool),
    |         ------------ this field does not implement `Copy`
+   |
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr
index 343644006b1..d1960a8aab3 100644
--- a/src/test/ui/span/coerce-suggestions.stderr
+++ b/src/test/ui/span/coerce-suggestions.stderr
@@ -49,7 +49,7 @@ error[E0308]: mismatched types
 LL |     s = format!("foo");
    |         ^^^^^^^^^^^^^^ expected `&mut std::string::String`, found struct `std::string::String`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/span/issue-33884.stderr b/src/test/ui/span/issue-33884.stderr
index 4f46c4c7394..184d9644c83 100644
--- a/src/test/ui/span/issue-33884.stderr
+++ b/src/test/ui/span/issue-33884.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL |     stream.write_fmt(format!("message received"))
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::fmt::Arguments`, found struct `std::string::String`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr
index 4eb775155a5..721d3b12172 100644
--- a/src/test/ui/span/macro-span-replacement.stderr
+++ b/src/test/ui/span/macro-span-replacement.stderr
@@ -13,4 +13,5 @@ note: the lint level is defined here
 LL | #![warn(unused)]
    |         ^^^^^^
    = note: `#[warn(dead_code)]` implied by `#[warn(unused)]`
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/span/slice-borrow.stderr b/src/test/ui/span/slice-borrow.stderr
index 84d0c847b7b..745936e11ea 100644
--- a/src/test/ui/span/slice-borrow.stderr
+++ b/src/test/ui/span/slice-borrow.stderr
@@ -10,7 +10,7 @@ LL |     y.use_ref();
    |     - borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr b/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr
index e37edc1daca..b0cef952b21 100644
--- a/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr
+++ b/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr
@@ -4,12 +4,9 @@ error[E0308]: mismatched types
 LL | /     intrinsic_match! {
 LL | |         "abc"
 LL | |     };
-   | |      ^
-   | |      |
-   | |______expected `&str`, found struct `std::string::String`
-   |        in this macro invocation
+   | |______^ expected `&str`, found struct `std::string::String`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr b/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr
index 1f2252f4d43..b1ea100f164 100644
--- a/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr
+++ b/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL |     assert_eq!(10u64, 10usize);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `usize`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
index 2c3c07c19e7..8dc041ace36 100644
--- a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
+++ b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
@@ -33,7 +33,7 @@ LL |     writeln!(fp, "hello world").unwrap();
    |
    = note: the method `write_fmt` exists but the following trait bounds were not satisfied:
            `std::io::BufWriter<&dyn std::io::Write> : std::io::Write`
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/suggestions/path-display.stderr b/src/test/ui/suggestions/path-display.stderr
index 39d236af4f3..13546cddbd3 100644
--- a/src/test/ui/suggestions/path-display.stderr
+++ b/src/test/ui/suggestions/path-display.stderr
@@ -8,6 +8,7 @@ LL |     println!("{}", path);
    = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
    = note: required because of the requirements on the impl of `std::fmt::Display` for `&std::path::Path`
    = note: required by `std::fmt::Display::fmt`
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/vec-macro-in-pattern.stderr b/src/test/ui/suggestions/vec-macro-in-pattern.stderr
index 1634fdde7d2..f9d0464ac88 100644
--- a/src/test/ui/suggestions/vec-macro-in-pattern.stderr
+++ b/src/test/ui/suggestions/vec-macro-in-pattern.stderr
@@ -10,7 +10,7 @@ LL |         Some(vec![_x]) => (),
    |              help: use a slice pattern here instead: `[_x]`
    |
    = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/test-panic-abort-nocapture.rs b/src/test/ui/test-panic-abort-nocapture.rs
new file mode 100644
index 00000000000..75f79838650
--- /dev/null
+++ b/src/test/ui/test-panic-abort-nocapture.rs
@@ -0,0 +1,39 @@
+// no-prefer-dynamic
+// compile-flags: --test -Cpanic=abort -Zpanic_abort_tests
+// run-flags: --test-threads=1 --nocapture
+// run-fail
+// check-run-results
+// exec-env:RUST_BACKTRACE=0
+
+// ignore-wasm no panic or subprocess support
+// ignore-emscripten no panic or subprocess support
+
+#![cfg(test)]
+
+use std::io::Write;
+
+#[test]
+fn it_works() {
+    println!("about to succeed");
+    assert_eq!(1 + 1, 2);
+}
+
+#[test]
+#[should_panic]
+fn it_panics() {
+    println!("about to panic");
+    assert_eq!(1 + 1, 4);
+}
+
+#[test]
+fn it_fails() {
+    println!("about to fail");
+    assert_eq!(1 + 1, 4);
+}
+
+#[test]
+fn it_writes_to_stdio() {
+    println!("hello, world");
+    writeln!(std::io::stdout(), "testing123").unwrap();
+    writeln!(std::io::stderr(), "testing321").unwrap();
+}
diff --git a/src/test/ui/test-panic-abort-nocapture.run.stderr b/src/test/ui/test-panic-abort-nocapture.run.stderr
new file mode 100644
index 00000000000..37fbe3d3ff2
--- /dev/null
+++ b/src/test/ui/test-panic-abort-nocapture.run.stderr
@@ -0,0 +1,9 @@
+thread 'main' panicked at 'assertion failed: `(left == right)`
+  left: `2`,
+ right: `4`', $DIR/test-panic-abort-nocapture.rs:31:5
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at 'assertion failed: `(left == right)`
+  left: `2`,
+ right: `4`', $DIR/test-panic-abort-nocapture.rs:25:5
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+testing321
diff --git a/src/test/ui/test-panic-abort-nocapture.run.stdout b/src/test/ui/test-panic-abort-nocapture.run.stdout
new file mode 100644
index 00000000000..87a246db5e0
--- /dev/null
+++ b/src/test/ui/test-panic-abort-nocapture.run.stdout
@@ -0,0 +1,23 @@
+
+running 4 tests
+test it_fails ... about to fail
+FAILED
+test it_panics ... about to panic
+ok
+test it_works ... about to succeed
+ok
+test it_writes_to_stdio ... hello, world
+testing123
+ok
+
+failures:
+
+---- it_fails stdout ----
+---- it_fails stderr ----
+
+
+failures:
+    it_fails
+
+test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
+
diff --git a/src/test/ui/trace_macros-gate.stderr b/src/test/ui/trace_macros-gate.stderr
index 7b954273071..7b46bee6a64 100644
--- a/src/test/ui/trace_macros-gate.stderr
+++ b/src/test/ui/trace_macros-gate.stderr
@@ -42,6 +42,7 @@ LL |     expando!(true);
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29598
    = help: add `#![feature(trace_macros)]` to the crate attributes to enable
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/try-block/try-block-opt-init.stderr b/src/test/ui/try-block/try-block-opt-init.stderr
index 308906477d9..6bae3a8587d 100644
--- a/src/test/ui/try-block/try-block-opt-init.stderr
+++ b/src/test/ui/try-block/try-block-opt-init.stderr
@@ -4,7 +4,7 @@ error[E0381]: borrow of possibly-uninitialized variable: `cfg_res`
 LL |     assert_eq!(cfg_res, 5);
    |     ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly-uninitialized `cfg_res`
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
index 2f1ca2fe0c1..d6ea3626675 100644
--- a/src/test/ui/tuple/tuple-struct-fields/test2.stderr
+++ b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
@@ -8,6 +8,8 @@ LL |         struct S3(pub $t ());
 ...
 LL |     define_struct! { (foo) }
    |     ------------------------ in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `foo` in this scope
   --> $DIR/test2.rs:11:23
diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
index 5d42fe6ef50..b38513e5a92 100644
--- a/src/test/ui/tuple/tuple-struct-fields/test3.stderr
+++ b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
@@ -8,6 +8,8 @@ LL |         struct S3(pub($t) ());
 ...
 LL |     define_struct! { foo }
    |     ---------------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0412]: cannot find type `foo` in this scope
   --> $DIR/test3.rs:11:22
diff --git a/src/test/ui/type/ascription/issue-47666.stderr b/src/test/ui/type/ascription/issue-47666.stderr
index 648635f0c32..baffe4ea351 100644
--- a/src/test/ui/type/ascription/issue-47666.stderr
+++ b/src/test/ui/type/ascription/issue-47666.stderr
@@ -11,7 +11,7 @@ LL |     let _ = Option:Some(vec![0, 1]);
    |
    = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
    = note: for more information, see https://github.com/rust-lang/rust/issues/23416
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr
index 53cc769bae3..8162fed2cd8 100644
--- a/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr
+++ b/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr
@@ -6,7 +6,7 @@ LL |     let x = vec![];
    |         |
    |         consider giving `x` the explicit type `std::vec::Vec<T>`, where the type parameter `T` is specified
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr
index df7228ce9f2..e62565c8f9b 100644
--- a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr
+++ b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr
@@ -6,7 +6,7 @@ LL |     let (x, ) = (vec![], );
    |         |
    |         consider giving this pattern the explicit type `(std::vec::Vec<T>,)`, where the type parameter `T` is specified
    |
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/union/union-derive-clone.stderr b/src/test/ui/union/union-derive-clone.stderr
index 0ef5753b590..12b5321331a 100644
--- a/src/test/ui/union/union-derive-clone.stderr
+++ b/src/test/ui/union/union-derive-clone.stderr
@@ -5,6 +5,7 @@ LL | #[derive(Clone)]
    |          ^^^^^ the trait `std::marker::Copy` is not implemented for `U1`
    |
    = note: required by `std::clone::AssertParamIsCopy`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0599]: no method named `clone` found for union `U5<CloneNoCopy>` in the current scope
   --> $DIR/union-derive-clone.rs:37:15
diff --git a/src/test/ui/union/union-derive-eq.stderr b/src/test/ui/union/union-derive-eq.stderr
index f63ab1704c4..0955c161871 100644
--- a/src/test/ui/union/union-derive-eq.stderr
+++ b/src/test/ui/union/union-derive-eq.stderr
@@ -5,6 +5,7 @@ LL |     a: PartialEqNotEq,
    |     ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq`
    |
    = note: required by `std::cmp::AssertParamIsEq`
+   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unreachable-code-ret.stderr b/src/test/ui/unreachable-code-ret.stderr
index 3b93ef97f32..72abb4fc8db 100644
--- a/src/test/ui/unreachable-code-ret.stderr
+++ b/src/test/ui/unreachable-code-ret.stderr
@@ -11,7 +11,7 @@ note: the lint level is defined here
    |
 LL | #![deny(unreachable_code)]
    |         ^^^^^^^^^^^^^^^^
-   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unused/unused-macro-rules.stderr b/src/test/ui/unused/unused-macro-rules.stderr
index 9bb3c3f3dec..532d9339781 100644
--- a/src/test/ui/unused/unused-macro-rules.stderr
+++ b/src/test/ui/unused/unused-macro-rules.stderr
@@ -22,6 +22,8 @@ LL | |         }
 ...
 LL |   create_macro!();
    |   ---------------- in this macro invocation
+   |
+   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unused macro definition
   --> $DIR/unused-macro-rules.rs:24:5
diff --git a/src/test/ui/while-let.stderr b/src/test/ui/while-let.stderr
index 09f0d641de0..b2f2ec97c14 100644
--- a/src/test/ui/while-let.stderr
+++ b/src/test/ui/while-let.stderr
@@ -10,6 +10,7 @@ LL | |     });
    | |_______- in this macro invocation
    |
    = note: `#[warn(irrefutable_let_patterns)]` on by default
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: irrefutable while-let pattern
   --> $DIR/while-let.rs:7:13
@@ -21,6 +22,8 @@ LL | /     bar!(_a, 1, {
 LL | |         println!("irrefutable pattern");
 LL | |     });
    | |_______- in this macro invocation
+   |
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 warning: irrefutable while-let pattern
   --> $DIR/while-let.rs:27:5
diff --git a/src/tools/miri b/src/tools/miri
-Subproject 75417e5a660096929aa10f1072a21d6662c9c0d
+Subproject e3cfb61ece273d59b62fb959ed17c99c04941d8
diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml
index 327de29037c..e6e758dccdf 100644
--- a/src/tools/rustbook/Cargo.toml
+++ b/src/tools/rustbook/Cargo.toml
@@ -6,13 +6,14 @@ license = "MIT OR Apache-2.0"
 edition = "2018"
 
 [features]
-linkcheck = ["mdbook-linkcheck", "codespan-reporting"]
+linkcheck = ["mdbook-linkcheck", "codespan-reporting", "codespan"]
 
 [dependencies]
 clap = "2.25.0"
 failure = "0.1"
 mdbook-linkcheck = { version = "0.5.0", optional = true }
 # Keep in sync with mdbook-linkcheck.
+codespan = { version = "0.5", optional = true }
 codespan-reporting = { version = "0.5", optional = true }
 
 
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs
index fc283156693..023f5aa1e28 100644
--- a/src/tools/rustbook/src/main.rs
+++ b/src/tools/rustbook/src/main.rs
@@ -8,11 +8,6 @@ use clap::{App, AppSettings, ArgMatches, SubCommand};
 use mdbook::errors::Result as Result3;
 use mdbook::MDBook;
 
-#[cfg(feature = "linkcheck")]
-use failure::Error;
-#[cfg(feature = "linkcheck")]
-use mdbook::renderer::RenderContext;
-
 fn main() {
     let d_message = "-d, --dest-dir=[dest-dir]
 'The output directory for your book{n}(Defaults to ./book when omitted)'";
@@ -53,8 +48,18 @@ fn main() {
         ("linkcheck", Some(sub_matches)) => {
             #[cfg(feature = "linkcheck")]
             {
-                if let Err(err) = linkcheck(sub_matches) {
-                    eprintln!("Error: {}", err);
+                let (diags, files) = linkcheck(sub_matches).expect("Error while linkchecking.");
+                if !diags.is_empty() {
+                    let color = codespan_reporting::term::termcolor::ColorChoice::Auto;
+                    let mut writer =
+                        codespan_reporting::term::termcolor::StandardStream::stderr(color);
+                    let cfg = codespan_reporting::term::Config::default();
+
+                    for diag in diags {
+                        codespan_reporting::term::emit(&mut writer, &cfg, &files, &diag)
+                            .expect("Unable to emit linkcheck error.");
+                    }
+
                     std::process::exit(101);
                 }
             }
@@ -73,14 +78,55 @@ fn main() {
 }
 
 #[cfg(feature = "linkcheck")]
-pub fn linkcheck(args: &ArgMatches<'_>) -> Result<(), Error> {
+pub fn linkcheck(
+    args: &ArgMatches<'_>,
+) -> Result<(Vec<codespan_reporting::diagnostic::Diagnostic>, codespan::Files), failure::Error> {
+    use mdbook_linkcheck::Reason;
+
     let book_dir = get_book_dir(args);
+    let src_dir = book_dir.join("src");
     let book = MDBook::load(&book_dir).unwrap();
-    let cfg = book.config;
-    let render_ctx = RenderContext::new(&book_dir, book.book, cfg, &book_dir);
-    let cache_file = render_ctx.destination.join("cache.json");
-    let color = codespan_reporting::term::termcolor::ColorChoice::Auto;
-    mdbook_linkcheck::run(&cache_file, color, &render_ctx)
+    let linkck_cfg = mdbook_linkcheck::get_config(&book.config)?;
+    let mut files = codespan::Files::new();
+    let target_files = mdbook_linkcheck::load_files_into_memory(&book.book, &mut files);
+    let cache = mdbook_linkcheck::Cache::default();
+
+    let (links, incomplete) = mdbook_linkcheck::extract_links(target_files, &files);
+
+    let outcome =
+        mdbook_linkcheck::validate(&links, &linkck_cfg, &src_dir, &cache, &files, incomplete)?;
+
+    let mut is_real_error = false;
+
+    for link in outcome.invalid_links.iter() {
+        match &link.reason {
+            Reason::FileNotFound | Reason::TraversesParentDirectories => {
+                is_real_error = true;
+            }
+            Reason::UnsuccessfulServerResponse(status) => {
+                if status.is_client_error() {
+                    is_real_error = true;
+                } else {
+                    eprintln!("Unsuccessful server response for link `{}`", link.link.uri);
+                }
+            }
+            Reason::Client(err) => {
+                if err.is_timeout() {
+                    eprintln!("Timeout for link `{}`", link.link.uri);
+                } else if err.is_server_error() {
+                    eprintln!("Server error for link `{}`", link.link.uri);
+                } else {
+                    is_real_error = true;
+                }
+            }
+        }
+    }
+
+    if is_real_error {
+        Ok((outcome.generate_diagnostics(&files, linkck_cfg.warning_policy), files))
+    } else {
+        Ok((vec![], files))
+    }
 }
 
 // Build command implementation