about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-06 22:38:31 +0100
committerGitHub <noreply@github.com>2020-02-06 22:38:31 +0100
commit26c86a6a2828b1048fa2fd425595ef8fb475249a (patch)
tree114cc2dc0966b8b10ac3728890e4b84e89309d67
parent442ae7f04026c215a03b155eaaf9cde8bb5cf02a (diff)
parent96af578cd9249223c89266306b104820e771858f (diff)
downloadrust-26c86a6a2828b1048fa2fd425595ef8fb475249a.tar.gz
rust-26c86a6a2828b1048fa2fd425595ef8fb475249a.zip
Rollup merge of #67359 - eddyb:macro-backtrace-all-the-same, r=petrochenkov
Rename -Zexternal-macro-backtrace to -Zmacro-backtrace and clean up implementation.

This is my attempt at dealing with https://github.com/rust-lang/rust/pull/66364#issuecomment-565517232, although I'm not sure it's the least disruptive one.

The behavior of `-Zexternal-macro-backtrace` was already to enable full macro backtraces for *all* macros, the only part of it that was specific to cross-crate macros was showing this when *not used*:
```
note: this error originates in a macro outside of the current crate
  (in Nightly builds, run with -Z external-macro-backtrace for more info)
```

After this PR:
* the flag is renamed to `-Zmacro-backtrace`
  * do we need to have a deprecation period? cc @rust-lang/compiler
* the message informing you about the flag is always shown when an expansion of a bang macro/attribute/derive is involved, not just cross-crate ones
  * this accounts for most of the changes in tests
  * we could perhaps only show it for the bang macro case? feels odd for derives
* `fix_multispans_in_std_macros` is split into `fix_multispans_in_extern_macros` and `render_multispans_macro_backtrace`
  * this roughly reverts the non-behavioral parts of #46605, which combined the two functionalities
  * not sure where the old `std_macros` name came from, perhaps the `<std macros>` synthetic "file"? even then, odd that `std` specifically was mentioned
* `render_multispan_macro_backtrace`, by default (i.e. without `-Zmacro-backtrace`), hides the `in this macro invocation` label specifically to avoid redundancy in the diagnostic
  * that is, showing the macro use site is only useful when the diagnostic is inside the macro definition and the user can't otherwise tell which use site it applies to, not when the diagnostic is at/inside the use site already (which would make the label redundant)
  * before, it was only checking for the situation in which a cross-crate macro *definition* span would be replaced with the invocation span, which both made the connection to redundancy unobvious, and didn't help with other redundancy (e.g. when the diagnostic was pointing to an argument inside the macro invocation)
  * this accounts for the remaining test changes, which I've first noticed in https://github.com/rust-lang/rust/pull/66364#discussion_r356135967 but only later understood as part of this PR (hence the "redundancy" descriptions)

This PR is not needed for #66364, but it would help, as after this PR there's only one `.span_to_filename(...).is_macros()` check (i.e. for `<... macros>` synthetic "files") left in `rustc_errors`, and it's much more self-contained.

r? @petrochenkov
-rw-r--r--src/bootstrap/builder.rs8
-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_session/config.rs2
-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/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/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/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/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/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/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/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/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/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/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
291 files changed, 1082 insertions, 277 deletions
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/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_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/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/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/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/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/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/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/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/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/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/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/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